|
@@ -1,6 +1,6 @@
|
|
|
<?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.jihengbel.intelligent.applicationtask.model.FirstTaskMapper" >
|
|
|
+<mapper namespace="com.jihengbel.intelligent.applicationtask.model.FirstTaskMapper">
|
|
|
|
|
|
|
|
|
<resultMap id="calendarFirst" type="com.jihengbel.intelligent.applicationtask.entry.FirstCalendar">
|
|
@@ -16,31 +16,71 @@
|
|
|
<result column="task_time" property="task_time"/>
|
|
|
<result column="first_task_id" property="first_task_id"/>
|
|
|
</resultMap>
|
|
|
+ <resultMap id="approveMap" type="com.jihengbel.intelligent.applicationtask.entry.ApproveEntry">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="first_article_task_id" property="task_id"/>
|
|
|
+ <result column="approval_level" property="approval_level"/>
|
|
|
+ <result column="approval_user_id" property="approval_user_id"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
+ <select id="getMaxApproveLevel" resultType="int">
|
|
|
+ select max(approval_level) from approval_rule where type = 2
|
|
|
+ </select>
|
|
|
|
|
|
+ <select id="getApproveTaskNoDeal" resultMap="approveMap">
|
|
|
+ select a.id, a.first_article_task_id , a.approval_level, a.approval_user_id
|
|
|
+ from first_article_approval_task a
|
|
|
+ where a.status=0 and a.approval_level < ${approval_level} and now() > ADDDATE(a.created_time, interval 30 minute); <!--找到30分钟没处理的 -->
|
|
|
+ </select>
|
|
|
|
|
|
+ <update id="updateApproveTask">
|
|
|
+ update first_article_approval_task
|
|
|
+ set status=${status}
|
|
|
+ where id = ${id}
|
|
|
+ and status = 0
|
|
|
+ </update>
|
|
|
|
|
|
+ <insert id="addApproveTask">
|
|
|
+ insert into first_article_approval_task(first_article_task_id, approval_level, approval_user_id,created_time,reason)
|
|
|
+ values (${task_id}, ${approval_level}, ${approval_user_id},now(),'自动审批')
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="getApprovalUser" resultType="com.jihengbel.intelligent.applicationtask.entry.ApprovalUserRes">
|
|
|
+ SELECT uur.user_id,
|
|
|
+ ar.type,
|
|
|
+ ar.approval_level
|
|
|
+ FROM approval_rule ar,
|
|
|
+ us_user_role uur,
|
|
|
+ us_user uu
|
|
|
+ WHERE ar.role_id = uur.role_id
|
|
|
+ AND uu.del_flag = 0
|
|
|
+ AND uu.lock = 0
|
|
|
+ AND ar.approval_level = ${approvalLevel}
|
|
|
+ AND ar.type = 2 LIMIT 0,1
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
<select id="getCalenderFirstForType" resultMap="calendarFirst">
|
|
|
- SELECT b.* FROM benteler_plan a,first_article_calendar b,onsite_approval_plan oap
|
|
|
- WHERE a.id=b.benteler_plan_id and a.pause_flag=0 and a.deleted=0 and a.effective_date <= now()
|
|
|
- and b.type_flag=${type_flag}
|
|
|
- and a.id = oap.benteler_plan_id
|
|
|
- and a.plan_type = 1
|
|
|
- and oap.approval_level = 2
|
|
|
- and oap.status = 1
|
|
|
+ SELECT b.*
|
|
|
+ FROM benteler_plan a,
|
|
|
+ first_article_calendar b,
|
|
|
+ onsite_approval_plan oap
|
|
|
+ WHERE a.id = b.benteler_plan_id
|
|
|
+ and a.pause_flag = 0
|
|
|
+ and a.deleted = 0
|
|
|
+ and a.effective_date <= now()
|
|
|
+ and b.type_flag = ${type_flag}
|
|
|
+ and a.id = oap.benteler_plan_id
|
|
|
+ and a.plan_type = 1
|
|
|
+ and oap.approval_level = 2
|
|
|
+ and oap.status = 1
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertFirstTask" parameterType="com.jihengbel.intelligent.applicationtask.entry.FirstTask">
|
|
|
- insert into first_article_task_key(first_article_calendar_id,task_time)
|
|
|
- values(
|
|
|
- ${first_article_calendar_id},#{task_time}
|
|
|
- );
|
|
|
- insert into first_article_task(first_article_calendar_id,task_time)
|
|
|
- values(
|
|
|
- ${first_article_calendar_id},#{task_time}
|
|
|
- );
|
|
|
+ insert into first_article_task_key(first_article_calendar_id, task_time)
|
|
|
+ values (${first_article_calendar_id}, #{task_time});
|
|
|
+ insert into first_article_task(first_article_calendar_id, task_time)
|
|
|
+ values (${first_article_calendar_id}, #{task_time});
|
|
|
</insert>
|
|
|
|
|
|
<select id="getRemindWork" resultMap="calendarFirst">
|
|
@@ -48,29 +88,32 @@
|
|
|
from first_article_task a,first_article_calendar b
|
|
|
where a.first_article_calendar_id=b.id and a.status=0 and b.type_flag=${type_flag}
|
|
|
<if test="remind_task_flag != null">
|
|
|
- and a.remind_task_flag = ${remind_task_flag}
|
|
|
+ and a.remind_task_flag = ${remind_task_flag}
|
|
|
</if>
|
|
|
<if test="remind_nowork_flag">
|
|
|
- and a.remind_nowork_flag = ${remind_nowork_flag}
|
|
|
+ and a.remind_nowork_flag = ${remind_nowork_flag}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <update id="updateFirstRemindFlag" >
|
|
|
- update first_article_task set ${flag}=${flagVal} where id=${first_task_id}
|
|
|
+ <update id="updateFirstRemindFlag">
|
|
|
+ update first_article_task
|
|
|
+ set ${flag}=${flagVal}
|
|
|
+ where id = ${first_task_id}
|
|
|
</update>
|
|
|
|
|
|
- <insert id="addRemindNowork" >
|
|
|
- insert into remind_approval_task(task_id,approval_user_id,task_type)
|
|
|
- values(${task_id},${approval_user_id},${task_type})
|
|
|
+ <insert id="addRemindNowork">
|
|
|
+ insert into remind_approval_task(task_id, approval_user_id, task_type)
|
|
|
+ values (${task_id}, ${approval_user_id}, ${task_type})
|
|
|
</insert>
|
|
|
|
|
|
<select id="getRemindNoworkToManager" resultType="Long">
|
|
|
- select b.user_id from nowork_remind_rule a ,us_user_role b where a.type=${type} and a.role_id=b.role_id limit 1
|
|
|
+ select b.user_id
|
|
|
+ from nowork_remind_rule a,
|
|
|
+ us_user_role b
|
|
|
+ where a.type = ${type}
|
|
|
+ and a.role_id = b.role_id limit 1
|
|
|
</select>
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</mapper>
|