SizePoolMapper.xml
4.16 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?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.SizePoolMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.dal.model.SizePool">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="range_type" property="rangeType" jdbcType="INTEGER" />
<result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="update_uid" property="updateUid" jdbcType="INTEGER" />
<result column="image_width" property="imageWidth" jdbcType="INTEGER" />
<result column="image_height" property="imageHeight" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, status, range_type, image_url, update_time, update_uid, image_width, image_height
</sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.yoho.ufo.dal.model.SizePool">
insert into size_pool(id, status, range_type, image_url, update_time, update_uid, image_width, image_height)
values (#{id}, #{status}, #{rangeType}, #{imageUrl}, #{updateTime}, #{updateUid}, #{imageWidth}, #{imageHeight})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.ufo.dal.model.SizePool">
update size_pool
<set>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="rangeType != null" >
range_type = #{rangeType,jdbcType=INTEGER},
</if>
<if test="imageUrl != null" >
image_url = #{imageUrl,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="updateUid != null" >
update_uid = #{updateUid,jdbcType=INTEGER},
</if>
<if test="imageWidth != null" >
image_width = #{imageWidth,jdbcType=INTEGER},
</if>
<if test="imageHeight != null" >
image_height = #{imageHeight,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from size_pool
where id = #{id,jdbcType=INTEGER}
</delete>
<select id="querySizePoolById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool
where id= #{id, jdbcType=INTEGER}
</select>
<sql id="Query_Sql" >
<if test="sizePoolReq.brandId != null">
and b.is_include=1 and b.item_type=1 and b.item_id=#{sizePoolReq.brandId}
</if>
<if test="sizePoolReq.productId != null">
and b.is_include=1 and b.item_type=2 and b.item_id=#{sizePoolReq.productId}
</if>
<if test="sizePoolReq.status != null">
and a.status=#{sizePoolReq.status}
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yohobuy.ufo.model.request.size.SizePoolRequest">
select count(distinct a.id)
from size_pool a
<if test="sizePoolReq.brandId != null or sizePoolReq.productId">
LEFT JOIN size_pool_detail b
ON(b.size_pool_id=a.id)
</if>
where 1=1
<include refid="Query_Sql"></include>
</select>
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yohobuy.ufo.model.request.size.SizePoolRequest">
select a.id, a.status, a.range_type, a.image_url
from size_pool a
<if test="sizePoolReq.brandId != null or sizePoolReq.productId">
LEFT JOIN size_pool_detail b
ON(b.size_pool_id=a.id)
</if>
where 1=1
<include refid="Query_Sql"></include>
order by a.id desc
<if test="sizePoolReq.startIndex!=null and sizePoolReq.rows != null">
limit #{sizePoolReq.startIndex},#{sizePoolReq.rows}
</if>
</select>
<update id="updateStatus">
update size_pool set status=#{status}
where id=#{id}
</update>
</mapper>