YohoodProductMapper.xml
4.89 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?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.YohoodProductMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.YohoodProduct">
<id column="product_sku" property="productSku" jdbcType="INTEGER" />
<result column="product_skc" property="productSkc" jdbcType="INTEGER" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="gender" property="gender" jdbcType="INTEGER" />
<result column="sort_id" property="sortId" jdbcType="INTEGER" />
<result column="brand_id" property="brandId" jdbcType="INTEGER" />
<result column="is_recommend" property="isRecommend" jdbcType="CHAR" />
<result column="buy_number" property="buyNumber" jdbcType="INTEGER" />
<result column="preset_number" property="presetNumber"
jdbcType="INTEGER" />
<result column="is_vote" property="isVote" jdbcType="CHAR" />
<result column="founder" property="founder" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="middle_sort_id" property="middleSortId"
jdbcType="INTEGER" />
<result column="is_online" property="isOnline" jdbcType="CHAR" />
</resultMap>
<sql id="Base_Column_List">
product_sku, product_skc, product_skn, gender, sort_id,
brand_id, is_recommend,
buy_number,
preset_number, is_vote, founder,
status, create_time, middle_sort_id, is_online
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer" timeout="20000">
select
<include refid="Base_Column_List" />
from yohood_product
where product_sku = #{productSku,jdbcType=INTEGER}
limit 1
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
timeout="20000">
delete from yohood_product
where product_sku =
#{productSku,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.YohoodProduct"
timeout="20000">
insert ignore into yohood_product (product_sku, product_skc,
product_skn,
gender, sort_id, brand_id,
is_recommend, buy_number,
preset_number,
is_vote, founder, status,
create_time, middle_sort_id,
is_online
)
values (#{productSku,jdbcType=INTEGER},
#{productSkc,jdbcType=INTEGER},
#{productSkn,jdbcType=INTEGER},
#{gender,jdbcType=INTEGER}, #{sortId,jdbcType=INTEGER},
#{brandId,jdbcType=INTEGER},
#{isRecommend,jdbcType=CHAR},
#{buyNumber,jdbcType=INTEGER},
#{presetNumber,jdbcType=INTEGER},
#{isVote,jdbcType=CHAR}, #{founder,jdbcType=INTEGER},
#{status,jdbcType=INTEGER},
#{createTime,jdbcType=INTEGER},
#{middleSortId,jdbcType=INTEGER},
#{isOnline,jdbcType=CHAR}
)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.YohoodProduct"
timeout="20000">
update yohood_product
<set>
<if test="productSkc != null">
product_skc = #{productSkc,jdbcType=INTEGER},
</if>
<if test="productSkn != null">
product_skn = #{productSkn,jdbcType=INTEGER},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=INTEGER},
</if>
<if test="sortId != null">
sort_id = #{sortId,jdbcType=INTEGER},
</if>
<if test="brandId != null">
brand_id = #{brandId,jdbcType=INTEGER},
</if>
<if test="isRecommend != null">
is_recommend = #{isRecommend,jdbcType=CHAR},
</if>
<if test="buyNumber != null">
buy_number = #{buyNumber,jdbcType=INTEGER},
</if>
<if test="presetNumber != null">
preset_number = #{presetNumber,jdbcType=INTEGER},
</if>
<if test="isVote != null">
is_vote = #{isVote,jdbcType=CHAR},
</if>
<if test="founder != null">
founder = #{founder,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="middleSortId != null">
middle_sort_id = #{middleSortId,jdbcType=INTEGER},
</if>
<if test="isOnline != null">
is_online = #{isOnline,jdbcType=CHAR},
</if>
</set>
where product_sku = #{productSku,jdbcType=INTEGER}
</update>
<resultMap id="yohoodMap" type="java.util.Map">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="is_yohood" property="isYohood" jdbcType="VARCHAR" />
</resultMap>
<select id="selectIsYohood" resultMap="yohoodMap" parameterType="java.lang.Integer"
timeout="20000">
<![CDATA[
SELECT p.id AS product_id, yp.`product_skn`,IF(yp.`product_skn` IS NULL,"N", "Y") AS `is_yohood`
FROM product p
LEFT JOIN yohood_product yp
ON p.`erp_product_id`=yp.`product_skn` WHERE p.erp_product_id=#{productSkn,jdbcType=INTEGER} LIMIT 0,1
]]>
</select>
</mapper>