IMMemberCollectMapper.xml
2.8 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
<?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.sibu.orderHelper.integral.dao.IMMemberCollectDao">
<!-- 收藏字段 -->
<sql id="memberCollectColumn">
im_member_collect_id,open_id,im_product_id,name,thumb_img,exchange_integral,retail_price,market_price,product_type,create_dt
</sql>
<!-- 添加我的收藏 -->
<insert id="addMemberCollect" parameterType="map">
insert into ${memberCollectTable} (<include refid="memberCollectColumn"/>)
value(
#{memberCollect.imMemberCollectId},
#{memberCollect.openId},
#{memberCollect.imProductId},
#{memberCollect.name},
#{memberCollect.thumbImg},
#{memberCollect.exchangeIntegral},
#{memberCollect.retailPrice},
#{memberCollect.marketPrice},
#{memberCollect.productType},
#{memberCollect.createDt}
)
</insert>
<!-- 我的收藏查询-->
<select id="pagerMemberCollect" parameterType="map" resultMap="listMemberCollect">
select <include refid="memberCollectColumn"/>
from ${memberCollectTable}
where open_id = #{openId} and product_type = ${productType}
order by create_dt DESC
limit ${pageNow}, ${pageSize}
</select>
<!-- 收藏详情 -->
<select id="getMemberCollectDetail" parameterType="map" resultMap="listMemberCollect">
select <include refid="memberCollectColumn"/>
from ${memberCollectTable}
where open_id = #{openId} and im_product_id = #{productId} limit 1
</select>
<!-- 查询我的收藏数量 -->
<select id="countMemberCollect" parameterType="map" resultType="int">
select count(*) from ${memberCollectTable}
where open_id = #{openId} and product_type = ${productType}
</select>
<!-- 删除我的收藏 -->
<delete id="deleteMemberCollect" parameterType="map">
delete from ${memberCollectTable} where open_id = #{openId} and im_product_id = #{productId}
</delete>
<!-- 更新产品关注度【收藏】 -->
<update id="updateProductAttention" parameterType="map">
update im_product_inventory set attention = attention + 1 where im_product_id = #{imProductId}
</update>
<resultMap type="IMMemberCollectBean" id="listMemberCollect">
<id column="im_member_collect_id" property="imMemberCollectId" />
<result column="open_id" property="openId" />
<result column="im_product_id" property="imProductId" />
<result column="name" property="name" />
<result column="thumb_img" property="thumbImg" />
<result column="exchange_integral" property="exchangeIntegral" />
<result column="retail_price" property="retailPrice" />
<result column="market_price" property="marketPrice" />
<result column="product_type" property="productType" />
<result column="create_dt" property="createDt" />
</resultMap>
</mapper>