UfoProductPoolDetailMapper.xml
2.28 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.UfoProductPoolDetailMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.goodsmanage.ProductPoolDetails">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="pool_id" property="poolId" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="order_by" property="orderBy" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, pool_id, product_id, create_time, order_by
</sql>
<insert id="batchInsertProductPoolDetails" parameterType="list">
insert into product_pool_detail(pool_id, product_id, create_time, order_by) values
<foreach collection="list" item="item" separator="," index="index">
(#{item.poolId}, #{item.productId}, #{item.createTime}, #{item.orderBy})
</foreach>
</insert>
<delete id="deleteProductPoolDetailsByPoolId">
delete from product_pool_detail where pool_id = #{poolId}
</delete>
<delete id="deleteProductPoolDetail">
DELETE FROM product_pool_detail WHERE pool_id = #{productPoolId} AND product_id = #{productId}
</delete>
<select id="selectByPoolIdAndProductId" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from product_pool_detail where 1=1
<if test="poolId != null">
and pool_id = #{poolId}
</if>
<if test="productId != null">
and product_id = #{productId}
</if>
</select>
<select id="selectByPoolIdAndOrderBy" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from product_pool_detail where 1=1
<if test="poolId != null">
and pool_id = #{poolId}
</if>
<if test="orderBy != null">
and order_by = #{orderBy}
</if>
</select>
<update id="updateProductOrderBy">
update product_pool_detail set order_by=#{orderBy} where pool_id=#{poolId} and product_id=#{productId}
</update>
</mapper>