GoodsImagesMapper.xml
2.56 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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.ufo.dal.GoodsImagesMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.dal.model.GoodsImages">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="goods_id" jdbcType="INTEGER" property="goodsId" />
<result column="product_id" jdbcType="INTEGER" property="productId" />
<result column="is_default" jdbcType="CHAR" property="isDefault" />
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
<result column="order_by" jdbcType="INTEGER" property="orderBy" />
</resultMap>
<insert id="insert" parameterType="com.yoho.ufo.dal.model.GoodsImages">
insert into goods_images (id, goods_id, product_id,
is_default, image_url, order_by
)
values (#{id,jdbcType=INTEGER}, #{goodsId,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER},
#{isDefault,jdbcType=CHAR}, #{imageUrl,jdbcType=VARCHAR}, #{orderBy,jdbcType=INTEGER}
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.yoho.ufo.dal.model.GoodsImages">
update goods_images
set goods_id = #{goodsId,jdbcType=INTEGER},
product_id = #{productId,jdbcType=INTEGER},
is_default = #{isDefault,jdbcType=CHAR},
image_url = #{imageUrl,jdbcType=VARCHAR},
order_by = #{orderBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select id, goods_id, product_id, is_default, image_url, order_by
from goods_images
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select id, goods_id, product_id, is_default, image_url, order_by
from goods_images
</select>
<delete id="deleteByGoodsId" parameterType="java.lang.Integer">
delete from goods_images
where goods_id = #{goodsId,jdbcType=INTEGER}
</delete>
<select id="selectByGoodsId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select id, goods_id, product_id, is_default, image_url, order_by
from goods_images
where goods_id = #{goodsId,jdbcType=INTEGER}
</select>
<select id="selectDefaultByGoodsIdList" resultMap="BaseResultMap">
select id, goods_id, product_id, is_default, image_url, order_by
from goods_images
where is_default='Y' and goods_id in
<foreach collection="list" item="goodsId" open="(" close=")" separator=",">
#{goodsId}
</foreach>
</select>
</mapper>