移风店镇项目初始化
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

87 lines
2.7 KiB

<?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.epmet.dao.WxmpWorkUserSubscribeDao">
<update id="incrSubscribeCount">
update wxmp_work_user_subscribe
set COUNT=COUNT + #{incr},
WX_SUBSCRIBE_STATUS = 'subscribe'
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{openId}
</update>
<select id="getWorkSubscribeInfo" parameterType="String" resultType="Integer">
select
`count`
from Wxmp_Work_User_Subscribe
where
del_flag =0
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
</select>
<update id="decreaseWorkSubscribeCount">
update Wxmp_Work_User_Subscribe
set count = if(count &lt; 1, 0, count - ${num} )
where
del_flag =0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
</update>
<update id="clearWorkSubscribeCount" parameterType="String">
update Wxmp_Work_User_Subscribe
set count = 0,
wx_subscribe_status = 'unsubscribe'
where
del_flag =0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
</update>
<select id="getWorkSubscribeTemplateId" resultType="String">
select
template_id
from Wxmp_Work_User_Subscribe
where
del_flag = 0
and customer_id = #{customerId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
limit 1
</select>
<update id="unSubscribe">
update wxmp_work_user_subscribe
set WX_SUBSCRIBE_STATUS = 'unsubscribe',
COUNT = 0
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{resiOpenId}
</update>
<select id="getWxWorkSubscribe" resultType="com.epmet.entity.WxmpWorkUserSubscribeEntity">
select id,
customer_id,
template_id,
user_id,
wx_open_id,
wx_subscribe_status,
count,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from wxmp_work_user_subscribe
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
</select>
</mapper>