<?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.ruoyi.shop.mapper.task.ShopTaskMapper">
|
|
<resultMap type="ShopTask" id="ShopTaskResult">
|
<result property="taskId" column="task_id" />
|
<result property="delFlag" column="del_flag" />
|
<result property="shopId" column="shop_id" />
|
<result property="followType" column="follow_type" />
|
<result property="followContent" column="follow_content" />
|
<result property="nextFollowDate" column="next_follow_date" />
|
<result property="taskTitle" column="task_title" />
|
<result property="emergencyState" column="emergency_state" />
|
<result property="createTime" column="create_time" />
|
</resultMap>
|
|
<sql id="selectShopTaskVo">
|
select task_id, del_flag, shop_id, follow_type, follow_content, next_follow_date, task_title, emergency_state, create_time from t_shop_task
|
</sql>
|
|
<select id="selectShopTaskList" parameterType="ShopTask" resultMap="ShopTaskResult">
|
<include refid="selectShopTaskVo"/>
|
<where>
|
<if test="shopId != null "> and shop_id = #{shopId}</if>
|
<if test="followType != null "> and follow_type = #{followType}</if>
|
<if test="followContent != null and followContent != ''"> and follow_content = #{followContent}</if>
|
<if test="nextFollowDate != null "> and next_follow_date = #{nextFollowDate}</if>
|
<if test="taskTitle != null and taskTitle != ''"> and task_title = #{taskTitle}</if>
|
<if test="emergencyState != null "> and emergency_state = #{emergencyState}</if>
|
</where>
|
</select>
|
|
<select id="selectShopTaskByTaskId" parameterType="String" resultMap="ShopTaskResult">
|
<include refid="selectShopTaskVo"/>
|
where task_id = #{taskId}
|
</select>
|
|
<insert id="insertShopTask" parameterType="ShopTask">
|
insert into t_shop_task
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="taskId != null">task_id,</if>
|
<if test="delFlag != null">del_flag,</if>
|
<if test="shopId != null">shop_id,</if>
|
<if test="followType != null">follow_type,</if>
|
<if test="followContent != null">follow_content,</if>
|
<if test="nextFollowDate != null">next_follow_date,</if>
|
<if test="taskTitle != null">task_title,</if>
|
<if test="emergencyState != null">emergency_state,</if>
|
<if test="createTime != null">create_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="taskId != null">#{taskId},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
<if test="shopId != null">#{shopId},</if>
|
<if test="followType != null">#{followType},</if>
|
<if test="followContent != null">#{followContent},</if>
|
<if test="nextFollowDate != null">#{nextFollowDate},</if>
|
<if test="taskTitle != null">#{taskTitle},</if>
|
<if test="emergencyState != null">#{emergencyState},</if>
|
<if test="createTime != null">#{createTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateShopTask" parameterType="ShopTask">
|
update t_shop_task
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="shopId != null">shop_id = #{shopId},</if>
|
<if test="followType != null">follow_type = #{followType},</if>
|
<if test="followContent != null">follow_content = #{followContent},</if>
|
<if test="nextFollowDate != null">next_follow_date = #{nextFollowDate},</if>
|
<if test="taskTitle != null">task_title = #{taskTitle},</if>
|
<if test="emergencyState != null">emergency_state = #{emergencyState},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
</trim>
|
where task_id = #{taskId}
|
</update>
|
|
<delete id="deleteShopTaskByTaskId" parameterType="String">
|
delete from t_shop_task where task_id = #{taskId}
|
</delete>
|
|
<delete id="deleteShopTaskByTaskIds" parameterType="String">
|
delete from t_shop_task where task_id in
|
<foreach item="taskId" collection="array" open="(" separator="," close=")">
|
#{taskId}
|
</foreach>
|
</delete>
|
|
|
<select id="getShopIngTotal" resultType="java.lang.Integer">
|
SELECT COUNT(task_id)
|
FROM t_shop_task
|
WHERE del_flag = 0 AND task_status = 1
|
<if test="shopIds!=null and shopIds!=''">
|
AND shop_id IN
|
<foreach collection="shopIds" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
AND task_date = DATE(NOW())
|
</select>
|
|
<select id="pageStaffShopTask" resultType="com.ruoyi.shop.domain.vo.StaffShopTaskPageVo">
|
SELECT
|
tst.task_id taskId,
|
tst.task_date taskDate,
|
tst.follow_content taskContent,
|
tst.task_title taskTitle,
|
tst.emergency_state emergencyState,
|
CASE WHEN tst.task_date = DATE(now()) THEN 1 ELSE 0 END todayFlag,
|
tstr.user_id userId,
|
tstr.create_time followTime
|
FROM t_shop_task tst
|
LEFT JOIN t_shop_task_record tstr ON tstr.task_id = tst.task_id AND tstr.id = (SELECT MAX(id) FROM t_shop_task_record WHERE task_id = tst.task_id)
|
WHERE tst.del_flag = 0 AND tst.shop_id = #{param.shopId}
|
<if test="param.taskStatus!=null and param.taskStatus != ''">
|
AND tst.task_status = #{param.taskStatus}
|
</if>
|
ORDER BY tst.task_status ASC
|
</select>
|
|
<update id="checkShopTaskStatus">
|
UPDATE t_shop_task
|
SET task_status = CASE
|
WHEN task_date = CURDATE() THEN 1
|
WHEN task_date < CURDATE() AND task_status < 2 THEN 3
|
ELSE task_status
|
END
|
</update>
|
|
<update id="checkMemberTaskStatus">
|
UPDATE t_member_task
|
SET task_status = CASE
|
WHEN task_date = CURDATE() THEN 1
|
WHEN task_date < CURDATE() AND task_status < 2 THEN 3
|
ELSE task_status
|
END
|
</update>
|
|
<update id="checkAgencyTaskStatus">
|
UPDATE t_agency_task
|
SET task_status = CASE
|
WHEN task_date = CURDATE() THEN 1
|
WHEN task_date < CURDATE() AND task_status < 2 THEN 3
|
ELSE task_status
|
END
|
</update>
|
|
</mapper>
|