万材erp项目
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.

304 lines
16 KiB

1 year ago
<?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.process.todoitem.mapper.BizTodoItemMapper">
<resultMap type="BizTodoItem" id="BizTodoItemResult">
<result property="id" column="id" />
<result property="itemName" column="item_name" />
<result property="itemContent" column="item_content" />
<result property="module" column="module" />
<result property="moduleName" column="modulename" />
<result property="instanceId" column="instance_id" />
<result property="taskId" column="task_id" />
<result property="taskName" column="task_name" />
<result property="nodeName" column="node_name" />
<result property="isView" column="is_view" />
<result property="isHandle" column="is_handle" />
<result property="todoUserId" column="todo_user_id" />
<result property="todoUserName" column="todo_user_name" />
<result property="handleUserId" column="handle_user_id" />
<result property="handleUserName" column="handle_user_name" />
<result property="todoTime" column="todo_time" />
<result property="handleTime" column="handle_time" />
<result property="moduleUrl" column="moduleUrl" />
<result property="keyNo" column="keyNo" />
<result property="projectName" column="projectName" />
</resultMap>
<sql id="selectBizTodoItemVo">
select id, item_name, item_content, module,modulename,instance_id,task_id, task_name, node_name, is_view, is_handle, todo_user_id, todo_user_name, handle_user_id, handle_user_name, todo_time, handle_time from biz_todo_item
</sql>
<select id="selectBizTodoItemList" parameterType="BizTodoItem" resultMap="BizTodoItemResult">
<include refid="selectBizTodoItemVo"/>
<where>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="itemContent != null and itemContent != ''"> and item_content = #{itemContent}</if>
<if test="module != null and module != ''"> and module = #{module}</if>
<if test="moduleName != null and moduleName != ''"> and moduleName = #{moduleName}</if>
<if test="projectName != null and projectName != ''"> and projectName = #{projectName}</if>
<if test="instanceId != null and instanceId != ''"> and instance_id = #{instanceId}</if>
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="isView != null and isView != ''"> and is_view = #{isView}</if>
<if test="isHandle != null and isHandle != ''"> and is_handle = #{isHandle}</if>
<if test="todoUserId != null and todoUserId != ''"> and todo_user_id like concat('%', #{todoUserId}, '%')</if>
<if test="todoUserName != null and todoUserName != ''"> and todo_user_name like concat('%', #{todoUserName}, '%')</if>
<if test="handleUserId != null and handleUserId != ''"> and handle_user_id like concat('%', #{handleUserId}, '%')</if>
<if test="handleUserName != null and handleUserName != ''"> and handle_user_name like concat('%', #{handleUserName}, '%')</if>
<if test="todoTime != null "> and todo_time = #{todoTime}</if>
<if test="handleTime != null "> and handle_time = #{handleTime}</if>
<if test="params.todoItemStartTime != null and params.todoItemStartTime != ''">开始时间检索
and date_format(todo_time,'%y%m%d') &gt;= date_format(#{params.todoItemStartTime},'%y%m%d')
</if>
<if test="params.todoItemEndTime != null and params.todoItemEndTime != ''">结束时间检索
and date_format(todo_time,'%y%m%d') &lt;= date_format(#{params.todoItemEndTime},'%y%m%d')
</if>
<if test="params.handleStartTime != null and params.handleStartTime != ''">开始时间检索
and date_format(handle_time,'%y%m%d') &gt;= date_format(#{params.handleStartTime},'%y%m%d')
</if>
<if test="params.handleEndTime != null and params.handleEndTime != ''">结束时间检索
and date_format(handle_time,'%y%m%d') &lt;= date_format(#{params.handleEndTime},'%y%m%d')
</if>
order by todo_time desc
</where>
</select>
<select id="getTodoItemList" parameterType="map" resultMap="BizTodoItemResult">
select top ${pageSize} a.*,b.projectName
from biz_todo_item a,biz_request_item b
where
a.id not in ( select top ${pageIndex} a.id from biz_todo_item a,biz_request_item b
<where>
and a.moduleUrl = b.moduleurl
and a.keyNo = b.keyNo
<if test="fromBegin!=null and fromBegin!=''">
and <![CDATA[a.todo_time >=#{todoTime} ]]>
</if>
<if test="toEnd!=null and toEnd!=''">
and <![CDATA[a.todo_time <=#{todoTime} ]]>
</if>
<if test="todoUserId!=null and todoUserId!=''">
and <![CDATA[a.todo_user_id = #{todoUserId} ]]>
</if>
<if test="isHandle!=null and isHandle!=''">
and <![CDATA[a.is_handle = #{isHandle} ]]>
</if>
<if test="vague!=null and vague!=''">
and (a.item_name like '%'+ #{vague}+'%'
or a.item_content like '%'+ #{vague}+'%'
or a.module like '%'+ #{vague}+'%'
or a.task_id like '%'+ #{vague}+'%'
or a.instance_id like '%'+ #{vague}+'%'
or a.task_name like '%'+ #{vague}+'%'
or a.node_name like '%'+ #{vague}+'%'
or a.todo_user_id like '%'+ #{vague}+'%'
or a.todo_user_name like '%'+ #{vague}+'%'
or a.handle_user_id like '%'+ #{vague}+'%'
or a.handle_user_name like '%'+ #{vague}+'%'
or a.todo_time like '%'+ #{vague}+'%'
or a.handle_time like '%'+ #{vague}+'%'
or a.modulename like '%'+ #{vague}+'%'
or a.moduleUrl like '%'+ #{vague}+'%'
or b.projectName like '%'+ #{vague}+'%')
</if>order by id desc)
and a.moduleUrl = b.moduleurl
and a.keyNo = b.keyNo
<if test="fromBegin!=null and fromBegin!=''">
and <![CDATA[a.todo_time >=#{todoTime} ]]>
</if>
<if test="toEnd!=null and toEnd!=''">
and <![CDATA[a.todo_time <=#{todoTime} ]]>
</if>
<if test="todoUserId!=null and todoUserId!=''">
and a.todo_user_id = #{todoUserId}
</if>
<if test="isHandle!=null and isHandle!=''">
and <![CDATA[a.is_handle = #{isHandle} ]]>
</if>
<if test="vague!=null and vague!=''">
and (a.item_name like '%'+ #{vague}+'%'
or a.item_content like '%'+ #{vague}+'%'
or a.module like '%'+ #{vague}+'%'
or a.task_id like '%'+ #{vague}+'%'
or a.instance_id like '%'+ #{vague}+'%'
or a.task_name like '%'+ #{vague}+'%'
or a.node_name like '%'+ #{vague}+'%'
or a.todo_user_id like '%'+ #{vague}+'%'
or a.todo_user_name like '%'+ #{vague}+'%'
or a.handle_user_id like '%'+ #{vague}+'%'
or a.handle_user_name like '%'+ #{vague}+'%'
or a.todo_time like '%'+ #{vague}+'%'
or a.handle_time like '%'+ #{vague}+'%'
or a.modulename like '%'+ #{vague}+'%'
or a.moduleUrl like '%'+ #{vague}+'%'
or b.projectName like '%'+ #{vague}+'%')
</if>
</where>
order by id desc
</select>
<!--查询我的待办条数 -->
<select id="getTodoItemTotal" parameterType="map" resultType="long">
select count(*) from biz_todo_item a
left join biz_request_item b
on a.moduleUrl = b.moduleurl
and a.keyNo = b.keyNo
<where>
<if test="fromBegin!=null and fromBegin!=''">
and <![CDATA[a.todo_time >=#{todoTime} ]]>
</if>
<if test="toEnd!=null and toEnd!=''">
and <![CDATA[a.todo_time <=#{todoTime} ]]>
</if>
<if test="todoUserId!=null and todoUserId!=''">
and a.todo_user_id = #{todoUserId}
</if>
<if test="isHandle!=null and isHandle!=''">
and <![CDATA[a.is_handle = #{isHandle} ]]>
</if>
<if test="vague!=null and vague!=''">
and (a.item_name like '%'+ #{vague}+'%'
or a.item_content like '%'+ #{vague}+'%'
or a.module like '%'+ #{vague}+'%'
or a.task_id like '%'+ #{vague}+'%'
or a.instance_id like '%'+ #{vague}+'%'
or a.task_name like '%'+ #{vague}+'%'
or a.node_name like '%'+ #{vague}+'%'
or a.todo_user_id like '%'+ #{vague}+'%'
or a.todo_user_name like '%'+ #{vague}+'%'
or a.handle_user_id like '%'+ #{vague}+'%'
or a.handle_user_name like '%'+ #{vague}+'%'
or a.todo_time like '%'+ #{vague}+'%'
or a.handle_time like '%'+ #{vague}+'%'
or a.modulename like '%'+ #{vague}+'%'
or a.moduleUrl like '%'+ #{vague}+'%'
or b.projectName like '%'+ #{vague}+'%')
</if>
</where>
</select>
<select id="selectBizTodoItemById" parameterType="Long" resultMap="BizTodoItemResult">
<include refid="selectBizTodoItemVo"/>
where id = #{id}
</select>
<insert id="insertBizTodoItem" parameterType="BizTodoItem" useGeneratedKeys="true" keyProperty="id">
insert into biz_todo_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemName != null and itemName != ''">item_name,</if>
<if test="itemContent != null and itemContent != ''">item_content,</if>
<if test="module != null and module != ''">module,</if>
<if test="moduleName != null and moduleName != ''">modulename,</if>
<if test="moduleUrl != null and moduleUrl != ''">moduleUrl,</if>
<if test="projectName != null and projectName != ''">projectName,</if>
<if test="keyNo != null and keyNo != ''">keyNo,</if>
<if test="instanceId != null and instanceId != ''">instance_id,</if>
<if test="taskId != null and taskId != ''">task_id,</if>
<if test="taskName != null and taskName != ''">task_name,</if>
<if test="nodeName != null and nodeName != ''">node_name,</if>
<if test="isView != null and isView != ''">is_view,</if>
<if test="isHandle != null and isHandle != ''">is_handle,</if>
<if test="todoUserId != null ">todo_user_id,</if>
<if test="todoUserName != null and todoUserName != ''">todo_user_name,</if>
<if test="handleUserId != null ">handle_user_id,</if>
<if test="handleUserName != null and handleUserName != ''">handle_user_name,</if>
<if test="todoTime != null ">todo_time,</if>
<if test="handleTime != null ">handle_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemName != null and itemName != ''">#{itemName},</if>
<if test="itemContent != null and itemContent != ''">#{itemContent},</if>
<if test="module != null and module != ''">#{module},</if>
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
<if test="moduleUrl != null and moduleUrl != ''">#{moduleUrl},</if>
<if test="projectName != null and projectName != ''">#{projectName},</if>
<if test="keyNo != null and keyNo != ''">#{keyNo},</if>
<if test="instanceId != null and instanceId != ''">#{instanceId},</if>
<if test="taskId != null and taskId != ''">#{taskId},</if>
<if test="taskName != null and taskName != ''">#{taskName},</if>
<if test="nodeName != null and nodeName != ''">#{nodeName},</if>
<if test="isView != null and isView != ''">#{isView},</if>
<if test="isHandle != null and isHandle != ''">#{isHandle},</if>
<if test="todoUserId != null ">#{todoUserId},</if>
<if test="todoUserName != null and todoUserName != ''">#{todoUserName},</if>
<if test="handleUserId != null ">#{handleUserId},</if>
<if test="handleUserName != null and handleUserName != ''">#{handleUserName},</if>
<if test="todoTime != null ">#{todoTime},</if>
<if test="handleTime != null ">#{handleTime},</if>
</trim>
</insert>
<update id="updateBizTodoItem" parameterType="BizTodoItem">
update biz_todo_item
<trim prefix="SET" suffixOverrides=",">
<if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
<if test="itemContent != null and itemContent != ''">item_content = #{itemContent},</if>
<if test="module != null and module != ''">module = #{module},</if>
<if test="moduleName != null and moduleName != ''">modulename = #{moduleName},</if>
<if test="moduleUrl != null and moduleUrl != ''">moduleUrl = #{moduleUrl},</if>
<if test="projectName != null and projectName != ''">projectName = #{projectName},</if>
<if test="keyNo != null and keyNo != ''">keyNo = #{keyNo},</if>
<if test="instanceId != null and instanceId != ''">instance_id = #{instanceId},</if>
<if test="taskId != null and taskId != ''">task_id = #{taskId},</if>
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
<if test="nodeName != null and nodeName != ''">node_name = #{nodeName},</if>
<if test="isView != null and isView != ''">is_view = #{isView},</if>
<if test="isHandle != null and isHandle != ''">is_handle = #{isHandle},</if>
<if test="todoUserId != null ">todo_user_id = #{todoUserId},</if>
<if test="todoUserName != null and todoUserName != ''">todo_user_name = #{todoUserName},</if>
<if test="handleUserId != null ">handle_user_id = #{handleUserId},</if>
<if test="handleUserName != null and handleUserName != ''">handle_user_name = #{handleUserName},</if>
<if test="todoTime != null ">todo_time = #{todoTime},</if>
<if test="handleTime != null ">handle_time = #{handleTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBizTodoItemById" parameterType="Long">
delete from biz_todo_item where id = #{id}
</delete>
<delete id="deleteBizTodoItemByIds" parameterType="String">
delete from biz_todo_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectTodoItemByTaskId" resultMap="BizTodoItemResult">
select * from biz_todo_item where task_id = #{taskId} and is_handle = #{isHandle}
</select>
<!-- 查询当前节点用户 -->
<select id="getCurrentFlowUser" parameterType="map" resultType="String">
select todo_user_id from biz_todo_item where instance_id = #{instanceId} and todo_user_id=#{todoUserId} and is_handle = #{isHandle}
</select>
<!-- 查询当前节点名称 -->
<select id="getCurrentNodeName" parameterType="map" resultType="String">
select node_name from biz_todo_item
<where>
<if test="instanceId != null and instanceId != ''">and instance_id = #{instanceId}</if>
<if test="todoUserId != null and todoUserId != ''">and todo_user_id = #{todoUserId}</if>
<if test="isHandle != null">and is_handle = #{isHandle}</if>
</where>
</select>
<!-- 查询当前任务ID -->
<select id="selectTodoItemTaskId" resultType="String">
select task_id from biz_todo_item where instance_id = #{instanceId} and todo_user_id=#{todoUserId} and is_handle = #{isHandle}
</select>
<!-- -->
<select id="getTodoItemListNoPaging" parameterType="map" resultMap="BizTodoItemResult">
select * from biz_todo_item
where todo_user_id = #{todoUserId} and is_handle = #{isHandle}
order by id desc
</select>
</mapper>