IMMemberCollectMapper.xml 2.8 KB
<?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>