ChannelSkuCompareMapper.xml
4.06 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
<?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.ChannelSkuCompareMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.ChannelSkuCompare">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="sku" property="sku" jdbcType="INTEGER" />
<result column="size_id" property="sizeId" jdbcType="INTEGER" />
<result column="channel_price" property="channelPrice" jdbcType="DECIMAL" />
<result column="low_rate" property="lowRate" jdbcType="DECIMAL" />
<result column="high_rate" property="highRate" jdbcType="DECIMAL" />
<result column="channel_url" property="channelUrl" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="update_uid" property="updateUid" jdbcType="INTEGER" />
<result column="channel_average_price" property="channelAveragePrice" jdbcType="DECIMAL" />
</resultMap>
<sql id="Base_Column_List">
id, product_id, sku, size_id, channel_price, low_rate, high_rate, channel_url,
status, update_time, update_uid, channel_average_price
</sql>
<select id="selectById" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from channel_sku_compare
where id=#{id}
</select>
<sql id="Query_Sql" >
<if test="channelSkuCompareReq.sku != null and channelSkuCompareReq.sku != 0 ">
and a.sku = #{channelSkuCompareReq.sku}
</if>
<if test="channelSkuCompareReq.productId != null and channelSkuCompareReq.productId != 0 ">
and a.product_id = #{channelSkuCompareReq.productId}
</if>
<if test="channelSkuCompareReq.productIdList != null and channelSkuCompareReq.productIdList.size()>0">
and a.product_id in
<foreach collection="channelSkuCompareReq.productIdList" item="productId" open="(" close=")" separator=",">
#{productId}
</foreach>
</if>
<if test="channelSkuCompareReq.sizeIdList != null and channelSkuCompareReq.sizeIdList.size()>0">
and a.size_id in
<foreach collection="channelSkuCompareReq.sizeIdList" item="sizeId" open="(" close=")" separator=",">
#{sizeId}
</foreach>
</if>
<if test="channelSkuCompareReq.status != null">
and a.status = #{channelSkuCompareReq.status}
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.ufo.model.ChannelSkuCompareReq">
select count(a.id)
from channel_sku_compare a
where a.channel_price != 0
<include refid="Query_Sql" />
</select>
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.ufo.model.ChannelSkuCompareReq">
select a.*
from channel_sku_compare a
where a.channel_price != 0
<include refid="Query_Sql" />
order by a.product_id desc, a.sku asc
<if test="channelSkuCompareReq.start!=null and channelSkuCompareReq.size != null">
limit #{channelSkuCompareReq.start},#{channelSkuCompareReq.size}
</if>
</select>
<update id="updateChangeStatusById">
update channel_sku_compare set status=#{status}, update_time=unix_timestamp(), update_uid=#{updateUid}
where id=#{id}
</update>
<update id="updateRateById">
update channel_sku_compare set low_rate=#{lowRate}, high_rate=#{highRate}, update_uid=#{uid}, update_time=unix_timestamp()
where id=#{id}
</update>
<update id="updateStatusByIds">
update channel_sku_compare set status=#{status}, update_time=unix_timestamp(), update_uid=#{uid} where id in
<foreach collection="idList" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper>