mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-23 07:31:51 +08:00
315 lines
12 KiB
XML
315 lines
12 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.jsowell.system.mapper.SysTodoTaskMapper">
|
|
|
|
<resultMap type="SysTodoTask" id="SysTodoTaskResult">
|
|
<id property="todoId" column="todo_id" />
|
|
<result property="taskType" column="task_type" />
|
|
<result property="title" column="title" />
|
|
<result property="summary" column="summary" />
|
|
<result property="content" column="content" />
|
|
<result property="businessType" column="business_type" />
|
|
<result property="businessId" column="business_id" />
|
|
<result property="routeName" column="route_name" />
|
|
<result property="routeParams" column="route_params" />
|
|
<result property="assigneeUserId" column="assignee_user_id" />
|
|
<result property="assigneeMerchantId" column="assignee_merchant_id" />
|
|
<result property="priority" column="priority" />
|
|
<result property="taskStatus" column="task_status" />
|
|
<result property="readStatus" column="read_status" />
|
|
<result property="readTime" column="read_time" />
|
|
<result property="dueTime" column="due_time" />
|
|
<result property="completedTime" column="completed_time" />
|
|
<result property="completedBy" column="completed_by" />
|
|
<result property="cancelReason" column="cancel_reason" />
|
|
<result property="idempotentKey" column="idempotent_key" />
|
|
<result property="activeIdempotentKey" column="active_idempotent_key" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
<result property="delFlag" column="del_flag" />
|
|
</resultMap>
|
|
|
|
<sql id="selectTodoVo">
|
|
select todo_id, task_type, title, summary, cast(content as char) as content,
|
|
business_type, business_id, route_name, route_params,
|
|
assignee_user_id, assignee_merchant_id, priority, task_status,
|
|
read_status, read_time, due_time, completed_time, completed_by,
|
|
cancel_reason, idempotent_key, active_idempotent_key,
|
|
create_by, create_time, update_by, update_time, remark, del_flag
|
|
from sys_todo_task
|
|
</sql>
|
|
|
|
<select id="selectTodoById" parameterType="Long" resultMap="SysTodoTaskResult">
|
|
<include refid="selectTodoVo" />
|
|
where todo_id = #{todoId}
|
|
and del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectTodoByIdForAssignee" resultMap="SysTodoTaskResult">
|
|
<include refid="selectTodoVo" />
|
|
where todo_id = #{todoId}
|
|
and assignee_user_id = #{assigneeUserId}
|
|
and del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectActiveByIdempotentKey" parameterType="String" resultMap="SysTodoTaskResult">
|
|
<include refid="selectTodoVo" />
|
|
where active_idempotent_key = #{activeIdempotentKey}
|
|
and del_flag = '0'
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectTodoList" parameterType="com.jsowell.system.domain.dto.TodoTaskQuery"
|
|
resultMap="SysTodoTaskResult">
|
|
<include refid="selectTodoVo" />
|
|
<where>
|
|
del_flag = '0'
|
|
and assignee_user_id = #{assigneeUserId}
|
|
<if test="taskStatus != null and taskStatus == 'ACTIVE'">
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
</if>
|
|
<if test="taskStatus != null and taskStatus != '' and taskStatus != 'ACTIVE'">
|
|
and task_status = #{taskStatus}
|
|
</if>
|
|
<if test="readStatus != null and readStatus != ''">
|
|
and read_status = #{readStatus}
|
|
</if>
|
|
<if test="taskType != null and taskType != ''">
|
|
and task_type = #{taskType}
|
|
</if>
|
|
<if test="keyword != null and keyword != ''">
|
|
and (title like concat('%', #{keyword}, '%')
|
|
or business_id like concat('%', #{keyword}, '%'))
|
|
</if>
|
|
<if test="hideCompleted != null and hideCompleted">
|
|
and task_status != 'COMPLETED'
|
|
</if>
|
|
</where>
|
|
order by priority desc, create_time desc, todo_id desc
|
|
</select>
|
|
|
|
<select id="selectAdminTodoList" parameterType="com.jsowell.system.domain.dto.TodoTaskAdminQuery"
|
|
resultMap="SysTodoTaskResult">
|
|
<include refid="selectTodoVo" />
|
|
<where>
|
|
del_flag = '0'
|
|
<if test="assigneeUserId != null">
|
|
and assignee_user_id = #{assigneeUserId}
|
|
</if>
|
|
<if test="assigneeMerchantId != null and assigneeMerchantId != ''">
|
|
and assignee_merchant_id = #{assigneeMerchantId}
|
|
</if>
|
|
<if test="taskStatus != null and taskStatus == 'ACTIVE'">
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
</if>
|
|
<if test="taskStatus != null and taskStatus != '' and taskStatus != 'ACTIVE'">
|
|
and task_status = #{taskStatus}
|
|
</if>
|
|
<if test="readStatus != null and readStatus != ''">
|
|
and read_status = #{readStatus}
|
|
</if>
|
|
<if test="taskType != null and taskType != ''">
|
|
and task_type = #{taskType}
|
|
</if>
|
|
<if test="keyword != null and keyword != ''">
|
|
and (title like concat('%', #{keyword}, '%')
|
|
or business_id like concat('%', #{keyword}, '%'))
|
|
</if>
|
|
<if test="hideCompleted != null and hideCompleted">
|
|
and task_status != 'COMPLETED'
|
|
</if>
|
|
</where>
|
|
order by priority desc, create_time desc, todo_id desc
|
|
</select>
|
|
|
|
<select id="selectHomeList" resultMap="SysTodoTaskResult">
|
|
<include refid="selectTodoVo" />
|
|
where assignee_user_id = #{assigneeUserId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
order by priority desc, create_time desc, todo_id desc
|
|
limit #{limit}
|
|
</select>
|
|
|
|
<select id="countActive" parameterType="Long" resultType="int">
|
|
select count(1)
|
|
from sys_todo_task
|
|
where assignee_user_id = #{assigneeUserId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</select>
|
|
|
|
<select id="countUnread" parameterType="Long" resultType="int">
|
|
select count(1)
|
|
from sys_todo_task
|
|
where assignee_user_id = #{assigneeUserId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and read_status = '0'
|
|
and del_flag = '0'
|
|
</select>
|
|
|
|
<insert id="insertTodoTask" parameterType="SysTodoTask" useGeneratedKeys="true" keyProperty="todoId">
|
|
insert into sys_todo_task (
|
|
task_type, title, summary, content, business_type, business_id,
|
|
route_name, route_params, assignee_user_id, assignee_merchant_id,
|
|
priority, task_status, read_status, due_time, idempotent_key,
|
|
active_idempotent_key, create_by, create_time, remark, del_flag
|
|
) values (
|
|
#{taskType}, #{title}, #{summary}, #{content}, #{businessType}, #{businessId},
|
|
#{routeName}, #{routeParams}, #{assigneeUserId}, #{assigneeMerchantId},
|
|
#{priority}, #{taskStatus}, #{readStatus}, #{dueTime}, #{idempotentKey},
|
|
#{activeIdempotentKey}, #{createBy}, sysdate(), #{remark}, #{delFlag}
|
|
)
|
|
</insert>
|
|
|
|
<update id="markTodoRead">
|
|
update sys_todo_task
|
|
set read_status = '1',
|
|
read_time = sysdate(),
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where todo_id = #{todoId}
|
|
and assignee_user_id = #{assigneeUserId}
|
|
and read_status = '0'
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="markAllRead">
|
|
update sys_todo_task
|
|
set read_status = '1',
|
|
read_time = sysdate(),
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where assignee_user_id = #{assigneeUserId}
|
|
and read_status = '0'
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="completeTodoForAssignee">
|
|
update sys_todo_task
|
|
set task_status = 'COMPLETED',
|
|
completed_time = sysdate(),
|
|
completed_by = #{completedBy},
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where todo_id = #{todoId}
|
|
and assignee_user_id = #{assigneeUserId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="completeTodoByBusiness">
|
|
update sys_todo_task
|
|
set task_status = 'COMPLETED',
|
|
completed_time = sysdate(),
|
|
completed_by = #{completedBy},
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where business_type = #{businessType}
|
|
and business_id = #{businessId}
|
|
<if test="assigneeUserId != null">
|
|
and assignee_user_id = #{assigneeUserId}
|
|
</if>
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="cancelTodoForAssignee">
|
|
update sys_todo_task
|
|
set task_status = 'CANCELLED',
|
|
cancel_reason = #{reason},
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where todo_id = #{todoId}
|
|
and assignee_user_id = #{assigneeUserId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="cancelTodo">
|
|
update sys_todo_task
|
|
set task_status = 'CANCELLED',
|
|
cancel_reason = #{reason},
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where todo_id = #{todoId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="cancelTodoByBusiness">
|
|
update sys_todo_task
|
|
set task_status = 'CANCELLED',
|
|
cancel_reason = #{reason},
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where business_type = #{businessType}
|
|
and business_id = #{businessId}
|
|
<if test="assigneeUserId != null">
|
|
and assignee_user_id = #{assigneeUserId}
|
|
</if>
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="assignTodo">
|
|
update sys_todo_task
|
|
set assignee_user_id = #{assigneeUserId},
|
|
assignee_merchant_id = #{assigneeMerchantId},
|
|
read_status = '0',
|
|
read_time = null,
|
|
active_idempotent_key = #{activeIdempotentKey},
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where todo_id = #{todoId}
|
|
and task_status in ('PENDING', 'PROCESSING')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="hideTodo">
|
|
update sys_todo_task
|
|
set active_idempotent_key = null,
|
|
del_flag = '2',
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where todo_id = #{todoId}
|
|
and task_status in ('COMPLETED', 'CANCELLED', 'EXPIRED')
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="expireDueTasks">
|
|
update sys_todo_task
|
|
set task_status = 'EXPIRED',
|
|
completed_time = #{now},
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = #{now}
|
|
where task_status in ('PENDING', 'PROCESSING')
|
|
and due_time is not null
|
|
and due_time <= #{now}
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
<update id="archiveTerminalTasks">
|
|
update sys_todo_task
|
|
set del_flag = '2',
|
|
active_idempotent_key = null,
|
|
update_by = #{updateBy},
|
|
update_time = sysdate()
|
|
where task_status in ('COMPLETED', 'CANCELLED', 'EXPIRED')
|
|
and coalesce(completed_time, update_time, create_time) < #{archiveBefore}
|
|
and del_flag = '0'
|
|
</update>
|
|
|
|
</mapper>
|