GoodsCoverImageMapper.xml
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.GoodsCoverImageMapper">
<resultMap id="GoodsCoverImage" type="com.yoho.search.dal.model.GoodsCoverImage">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="goods_id" property="goodsId" jdbcType="INTEGER"/>
<result column="cover_1" property="cover_1" jdbcType="VARCHAR"/>
<result column="cover_2" property="cover_2" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectGoodsCoverImage" resultMap="GoodsCoverImage">
<![CDATA[
SELECT
`a`.`id` AS `id`,
`a`.`goods_id` AS `goods_id`,
(
CASE `a`.`gender_cover`
WHEN 1 THEN
`a`.`image_url`
END
) AS `cover_1`,
(
CASE `a`.`gender_cover`
WHEN 2 THEN
`a`.`image_url`
END
) AS `cover_2`
FROM
`goods_images` `a`
where
(`a`.`gender_cover` <> 0)
AND goods_id in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>