update wxmp_work_user_subscribe
set COUNT=COUNT + #{incr},
WX_SUBSCRIBE_STATUS = 'subscribe',
UPDATED_TIME = now()
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{openId}
and del_flag =0
update Wxmp_Work_User_Subscribe
set count = if(count < 1, 0, count - ${num} ),
UPDATED_TIME = now()
where
del_flag =0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and user_id = #{userId}
update Wxmp_Work_User_Subscribe
set count = 0, UPDATED_TIME = now()
where
del_flag =0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and user_id = #{userId}
update wxmp_work_user_subscribe
set WX_SUBSCRIBE_STATUS = 'unsubscribe'
UPDATED_TIME = now()
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{workOpenId}
and del_flag =0