|
@@ -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.OnsiteTaskMapper" >
|
|
|
+<mapper namespace="com.jihengbel.intelligent.applicationtask.model.OnsiteTaskMapper">
|
|
|
|
|
|
|
|
|
<resultMap id="calendarOnsite" type="com.jihengbel.intelligent.applicationtask.entry.OnsiteCalendar">
|
|
@@ -27,25 +27,29 @@
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="getMaxApproveLevel" resultType="int">
|
|
|
- select max(approval_level) from approval_rule where type = 3
|
|
|
+ select max(approval_level)
|
|
|
+ from approval_rule
|
|
|
+ where type = 3
|
|
|
</select>
|
|
|
|
|
|
<select id="getApproveTaskNoDeal" resultMap="approveMap">
|
|
|
select a.id, a.onsite_task_id , a.approval_level, a.approval_user_id
|
|
|
from onsite_approval_task a
|
|
|
- where a.status=0 and a.approval_level < ${approval_level} and now() > ADDDATE(a.created_time, interval 30 minute); <!--找到30分钟没处理的 -->
|
|
|
+ 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 onsite_approval_task
|
|
|
- set status=${status},reason='自动审批'
|
|
|
+ set status=${status},
|
|
|
+ reason='自动审批'
|
|
|
where id = ${id}
|
|
|
and status = 0
|
|
|
</update>
|
|
|
|
|
|
<insert id="addApproveTask">
|
|
|
- insert into onsite_approval_task(onsite_task_id, approval_level, approval_user_id,created_time,reason)
|
|
|
- values (${task_id}, ${approval_level}, ${approval_user_id},now(),'')
|
|
|
+ insert into onsite_approval_task(onsite_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">
|
|
@@ -63,25 +67,29 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <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>
|
|
|
|
|
|
<select id="getCalenderOnsitesForType" resultMap="calendarOnsite"> <!-- todo 这个还需要状态 -->
|
|
|
- SELECT b.* FROM benteler_plan a,onsite_calendar b,onsite_approval_plan oap
|
|
|
+ SELECT b.* FROM benteler_plan a,onsite_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}
|
|
|
<if test="week_day != null and week_day != ''">
|
|
|
- and b.week_day >= ${week_day}
|
|
|
+ and b.week_day >= ${week_day}
|
|
|
</if>
|
|
|
<if test="month_day != null and month_day != ''">
|
|
|
- and b.month_day >= ${month_day}
|
|
|
+ and b.month_day >= ${month_day}
|
|
|
</if>
|
|
|
and a.id = oap.benteler_plan_id
|
|
|
and a.plan_type = 2
|
|
@@ -90,38 +98,55 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <delete id="delTaskOld">
|
|
|
- delete from onsite_task where status=0
|
|
|
- and onsite_calendar_id in (select id from onsite_calendar where type_flag in (1,2) )
|
|
|
- and ADDDATE(task_time, interval 1 day) < now()
|
|
|
- </delete>
|
|
|
+ <delete id="delTaskOld">
|
|
|
+ delete from onsite_task where id in(
|
|
|
+ select a.id from onsite_calendar b,
|
|
|
+ (
|
|
|
+ select IF
|
|
|
+ ( date_format( task_time, '%w' ) = 0,
|
|
|
+ 7,
|
|
|
+ date_format( task_time, '%w')
|
|
|
+ ) wd , onsite_calendar_id,id
|
|
|
+ from onsite_task
|
|
|
+ ) a where a.onsite_calendar_id=b.id and a.wd!=b.week_day and b.type_flag=1
|
|
|
+ )
|
|
|
+ and ADDDATE(task_time, interval 1 day) < now() ;
|
|
|
+
|
|
|
+
|
|
|
+ delete from onsite_task where id in(
|
|
|
+ select a.id from onsite_calendar b,
|
|
|
+ (
|
|
|
+ select
|
|
|
+ date_format( task_time, '%e') mh , onsite_calendar_id,id
|
|
|
+ from onsite_task
|
|
|
+ ) a where a.onsite_calendar_id=b.id and a.mh!=b.month_day and b.type_flag=2
|
|
|
+ )
|
|
|
+ and ADDDATE(task_time, interval 1 day) < now() ;
|
|
|
+ </delete>
|
|
|
|
|
|
<select id="getRemindWork" resultMap="calendarOnsite">
|
|
|
select b.*,a.task_time ,a.id onsite_task_id
|
|
|
from onsite_task a,onsite_calendar b
|
|
|
where a.onsite_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 != null">
|
|
|
- and a.remind_nowork_flag = ${remind_nowork_flag}
|
|
|
+ and a.remind_nowork_flag = ${remind_nowork_flag}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <update id="updateOnsiteRemindFlag" >
|
|
|
- update onsite_task set ${flag}=${flagVal} where id=${onsite_task_id}
|
|
|
+ <update id="updateOnsiteRemindFlag">
|
|
|
+ update onsite_task
|
|
|
+ set ${flag}=${flagVal}
|
|
|
+ where id = ${onsite_task_id}
|
|
|
</update>
|
|
|
|
|
|
|
|
|
-
|
|
|
<insert id="insertOnsiteTask" parameterType="com.jihengbel.intelligent.applicationtask.entry.OnsiteTask">
|
|
|
- insert into onsite_task(onsite_calendar_id,task_time)
|
|
|
- values(
|
|
|
- ${onsite_calendar_id},#{task_time}
|
|
|
- )
|
|
|
+ insert into onsite_task(onsite_calendar_id, task_time)
|
|
|
+ values (${onsite_calendar_id}, #{task_time})
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
</mapper>
|