212 lines
8.1 KiB
XML
212 lines
8.1 KiB
XML
<?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.cool.store.mapper.HyFollowTaskMapper">
|
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyFollowTaskDO">
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
<result column="partner_line_id" jdbcType="BIGINT" property="partnerLineId"/>
|
|
<result column="follow_user_id" jdbcType="VARCHAR" property="followUserId"/>
|
|
<result column="task_title" jdbcType="VARCHAR" property="taskTitle"/>
|
|
<result column="communication_type" jdbcType="TINYINT" property="communicationType"/>
|
|
<result column="deadline" jdbcType="TIMESTAMP" property="deadline"/>
|
|
<result column="communication_content" jdbcType="VARCHAR" property="communicationContent"/>
|
|
<result column="task_status" jdbcType="TINYINT" property="taskStatus"/>
|
|
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, partner_line_id, follow_user_id, task_title, communication_type, deadline, communication_content,
|
|
task_status, deleted, create_time, update_time
|
|
</sql>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
|
insert into hy_follow_task
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="record.partnerLineId != null">
|
|
partner_line_id,
|
|
</if>
|
|
<if test="record.followUserId != null">
|
|
follow_user_id,
|
|
</if>
|
|
<if test="record.taskTitle != null">
|
|
task_title,
|
|
</if>
|
|
<if test="record.communicationType != null">
|
|
communication_type,
|
|
</if>
|
|
<if test="record.deadline != null">
|
|
deadline,
|
|
</if>
|
|
<if test="record.communicationContent != null">
|
|
communication_content,
|
|
</if>
|
|
<if test="record.taskStatus != null">
|
|
task_status,
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
deleted,
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
update_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="record.partnerLineId != null">
|
|
#{record.partnerLineId},
|
|
</if>
|
|
<if test="record.followUserId != null">
|
|
#{record.followUserId},
|
|
</if>
|
|
<if test="record.taskTitle != null">
|
|
#{record.taskTitle},
|
|
</if>
|
|
<if test="record.communicationType != null">
|
|
#{record.communicationType},
|
|
</if>
|
|
<if test="record.deadline != null">
|
|
#{record.deadline},
|
|
</if>
|
|
<if test="record.communicationContent != null">
|
|
#{record.communicationContent},
|
|
</if>
|
|
<if test="record.taskStatus != null">
|
|
#{record.taskStatus},
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
#{record.deleted},
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
#{record.createTime},
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
#{record.updateTime},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective">
|
|
update hy_follow_task
|
|
<set>
|
|
<if test="record.partnerLineId != null">
|
|
partner_line_id = #{record.partnerLineId},
|
|
</if>
|
|
<if test="record.followUserId != null">
|
|
follow_user_id = #{record.followUserId},
|
|
</if>
|
|
<if test="record.taskTitle != null">
|
|
task_title = #{record.taskTitle},
|
|
</if>
|
|
<if test="record.communicationType != null">
|
|
communication_type = #{record.communicationType},
|
|
</if>
|
|
<if test="record.deadline != null">
|
|
deadline = #{record.deadline},
|
|
</if>
|
|
<if test="record.communicationContent != null">
|
|
communication_content = #{record.communicationContent},
|
|
</if>
|
|
<if test="record.taskStatus != null">
|
|
task_status = #{record.taskStatus},
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
deleted = #{record.deleted},
|
|
</if>
|
|
<if test="record.createTime != null">
|
|
create_time = #{record.createTime},
|
|
</if>
|
|
<if test="record.updateTime != null">
|
|
update_time = #{record.updateTime},
|
|
</if>
|
|
</set>
|
|
where id = #{record.id}
|
|
</update>
|
|
|
|
<select id="getTaskListByLineId" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
hy_follow_task
|
|
where
|
|
deleted = '0' and partner_line_id = #{partnerLineId}
|
|
</select>
|
|
|
|
<select id="getTaskPage" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
hy_follow_task
|
|
where
|
|
deleted = '0' and follow_user_id = #{followUserId}
|
|
<if test="taskStatus != null">
|
|
and task_status = #{taskStatus}
|
|
</if>
|
|
<if test="deadlineStartTIme != null">
|
|
and deadline >= #{deadlineStartTIme}
|
|
</if>
|
|
<if test="deadlineEndTIme != null">
|
|
<![CDATA[ and deadline <= #{deadlineEndTIme}]]>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getFollowTask" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
hy_follow_task
|
|
where
|
|
deleted = '0' and id = #{followTaskId}
|
|
</select>
|
|
|
|
<update id="updateUndoTaskFollowUserId">
|
|
update hy_follow_task set follow_user_id = #{followUserId} where partner_line_id = #{partnerLineId}
|
|
</update>
|
|
|
|
<update id="cancelUndoFollowTask">
|
|
update hy_follow_task set task_status = '3' where partner_line_id = #{partnerLineId} and task_status in ('0', '2')
|
|
</update>
|
|
|
|
<select id="getRemindFollowUserIds" resultType="string">
|
|
select
|
|
follow_user_id
|
|
from
|
|
hy_follow_task
|
|
where
|
|
deleted = '0' and (task_status in ('2') or (task_status in ('0') and deadline >= #{startTime} and #{endTime} >= deadline))
|
|
</select>
|
|
|
|
<select id="getUserTaskNum" resultType="com.cool.store.dto.follow.FollowTaskNumDTO">
|
|
select
|
|
follow_user_id,
|
|
sum(if(task_status=2 or (task_status in ('0') and now() >= deadline, 1,0))) as overdueNum,
|
|
sum(if(task_status=0, 1, 0)) as todoNum
|
|
from
|
|
hy_follow_task
|
|
where
|
|
follow_user_id in <foreach collection="followUserIds" item="followUserId" separator="," open="(" close=")">#{followUserId}</foreach>
|
|
group by follow_user_id
|
|
</select>
|
|
|
|
<select id="getUndoTaskPage" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
hy_follow_task
|
|
where
|
|
deleted = '0' and task_status in ('0') and deadline >= #{startTime} and #{endTime} >= deadline
|
|
</select>
|
|
|
|
<update id="updateUndoTaskStatusToOverdue">
|
|
<![CDATA[ update hy_follow_task set task_status = '2' where task_status = '0' and deadline < now() ]]]>
|
|
</update>
|
|
|
|
<select id="getFollowTaskList" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
hy_follow_task
|
|
where
|
|
deleted = '0' and id in <foreach collection="followTaskIds" item="followTaskId" separator="," open="(" close=")">#{followTaskId}</foreach>
|
|
</select>
|
|
|
|
</mapper> |