<?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.smartor.mapper.ServiceTaskScheduleMapper">
|
|
<resultMap type="com.smartor.domain.ServiceTaskSchedule" id="ServiceTaskScheduleResult">
|
<id property="id" column="id"/>
|
<result property="taskid" column="taskid"/>
|
<result property="maxLoopCount" column="max_loop_count"/>
|
<result property="currentLoopCount" column="current_loop_count"/>
|
<result property="currentSeq" column="current_seq"/>
|
<result property="nextSeq" column="next_seq"/>
|
<result property="scheduleStyle" column="schedule_style"/>
|
<result property="scheduleTimeNum" column="schedule_time_num"/>
|
<result property="scheduleTimeUnit" column="schedule_time_unit"/>
|
<result property="nextExecuteTime" column="next_execute_time"/>
|
<result property="scheduleBenchmark" column="schedule_benchmark"/>
|
<result property="scheduleBenchmarkCustomTime" column="schedule_benchmark_custom_time"/>
|
<result property="deptCodes" column="dept_codes"/>
|
<result property="wardCodes" column="ward_codes"/>
|
<result property="icd10Codes" column="icd10_codes"/>
|
<result property="oplevelCodes" column="remark"/>
|
<result property="remark" column="remark"/>
|
<result property="delFlag" column="del_flag"/>
|
<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="orgid" column="orgid"/>
|
<result property="campusid" column="campusid"/>
|
</resultMap>
|
|
<sql id="selectServiceTaskScheduleVo">
|
select id,
|
taskid,
|
max_loop_count,
|
current_loop_count,
|
current_seq,
|
next_seq,
|
schedule_style,
|
schedule_time_num,
|
schedule_time_unit,
|
next_execute_time,
|
schedule_benchmark,
|
schedule_benchmark_custom_time,
|
deptCodes,
|
wardCodes,
|
icd10Codes,
|
oplevelCodes,
|
remark,
|
del_flag,
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
orgid,
|
campusid
|
from service_task_schedule
|
</sql>
|
|
<select id="selectServiceTaskScheduleById" parameterType="Long" resultMap="ServiceTaskScheduleResult">
|
<include refid="selectServiceTaskScheduleVo"/>
|
where id = #{id} and del_flag = '0'
|
</select>
|
|
<select id="selectByTaskid" resultMap="ServiceTaskScheduleResult">
|
<include refid="selectServiceTaskScheduleVo"/>
|
where taskid = #{taskid} and del_flag = '0'
|
order by id desc
|
limit 1
|
</select>
|
|
<select id="selectServiceTaskScheduleList" parameterType="com.smartor.domain.ServiceTaskSchedule"
|
resultMap="ServiceTaskScheduleResult">
|
<include refid="selectServiceTaskScheduleVo"/>
|
where del_flag = '0'
|
<if test="taskid != null">and taskid = #{taskid}</if>
|
<if test="scheduleStyle != null">and schedule_style = #{scheduleStyle}</if>
|
<if test="deptCode != null">and INSTR(dept_codes, #{deptCode}) > 0</if>
|
<if test="wardCode != null">and INSTR(ward_codes, #{wardCode}) > 0</if>
|
<if test="icd10Code != null">and INSTR(icd10_codes, #{icd10Code}) > 0</if>
|
<if test="oplevelCode != null">and INSTR(oplevel_codes, #{oplevelCode}) > 0</if>
|
<if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
|
<if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
|
order by id desc
|
</select>
|
|
<insert id="insertServiceTaskSchedule" parameterType="com.smartor.domain.ServiceTaskSchedule"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into service_task_schedule
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="taskid != null">taskid,</if>
|
<if test="maxLoopCount != null">max_loop_count,</if>
|
<if test="currentLoopCount != null">current_loop_count,</if>
|
<if test="currentSeq != null">current_seq,</if>
|
<if test="nextSeq != null">next_seq,</if>
|
<if test="scheduleStyle != null">schedule_style,</if>
|
<if test="scheduleTimeNum != null">schedule_time_num,</if>
|
<if test="scheduleTimeUnit != null">schedule_time_unit,</if>
|
<if test="nextExecuteTime != null">next_execute_time,</if>
|
<if test="scheduleBenchmark != null">schedule_benchmark,</if>
|
<if test="scheduleBenchmarkCustomTime != null">schedule_benchmark_custom_time,</if>
|
<if test="deptCodes != null">dept_codes,</if>
|
<if test="wardCodes != null">ward_codes,</if>
|
<if test="icd10Codes != null">icd10_codes,</if>
|
<if test="oplevelCodes != null">oplevel_codes,</if>
|
<if test="remark != null">remark,</if>
|
<if test="delFlag != null">del_flag,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateBy != null">update_by,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="orgid != null">orgid,</if>
|
<if test="campusid != null">campusid,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="taskid != null">#{taskid},</if>
|
<if test="maxLoopCount != null">#{maxLoopCount},</if>
|
<if test="currentLoopCount != null">#{currentLoopCount},</if>
|
<if test="currentSeq != null">#{currentSeq},</if>
|
<if test="nextSeq != null">#{nextSeq},</if>
|
<if test="scheduleStyle != null">#{scheduleStyle},</if>
|
<if test="scheduleTimeNum != null">#{scheduleTimeNum},</if>
|
<if test="scheduleTimeUnit != null">#{scheduleTimeUnit},</if>
|
<if test="nextExecuteTime != null">#{nextExecuteTime},</if>
|
<if test="scheduleBenchmark != null">#{scheduleBenchmark},</if>
|
<if test="scheduleBenchmarkCustomTime != null">#{scheduleBenchmarkCustomTime},</if>
|
<if test="deptCodes != null">#{deptCodes},</if>
|
<if test="wardCodes != null">#{wardCodes},</if>
|
<if test="icd10Codes != null">#{icd10Codes},</if>
|
<if test="oplevelCodes != null">#{oplevelCodes},</if>
|
<if test="remark != null">#{remark},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="orgid != null">#{orgid},</if>
|
<if test="campusid != null">#{campusid},</if>
|
</trim>
|
</insert>
|
|
<update id="updateServiceTaskSchedule" parameterType="com.smartor.domain.ServiceTaskSchedule">
|
update service_task_schedule
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="taskid != null">taskid = #{taskid},</if>
|
<if test="maxLoopCount != null">max_loop_count = #{maxLoopCount},</if>
|
<if test="currentLoopCount != null">current_loop_count = #{currentLoopCount},</if>
|
<if test="currentSeq != null">current_seq = #{currentSeq},</if>
|
<if test="nextSeq != null">next_seq = #{nextSeq},</if>
|
<if test="scheduleStyle != null">schedule_style = #{scheduleStyle},</if>
|
<if test="scheduleTimeNum != null">schedule_time_num = #{scheduleTimeNum},</if>
|
<if test="scheduleTimeUnit != null">schedule_time_unit = #{scheduleTimeUnit},</if>
|
<if test="nextExecuteTime != null">next_execute_time = #{nextExecuteTime},</if>
|
<if test="scheduleBenchmark != null">schedule_benchmark = #{scheduleBenchmark},</if>
|
<if test="scheduleBenchmarkCustomTime != null">
|
schedule_benchmark_custom_time = #{scheduleBenchmarkCustomTime},
|
</if>
|
<if test="deptCodes != null">dept_codes = #{deptCodes},</if>
|
<if test="wardCodes != null">ward_codes = #{wardCodes},</if>
|
<if test="icd10Codes != null">icd10_codes = #{icd10Codes},</if>
|
<if test="oplevelCodes != null">oplevel_codes = #{oplevelCodes},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="orgid != null">orgid = #{orgid},</if>
|
<if test="campusid != null">campusid = #{campusid},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<update id="deleteServiceTaskScheduleById" parameterType="Long">
|
update service_task_schedule
|
set del_flag = '1',
|
update_time = now()
|
where id = #{id}
|
</update>
|
|
<update id="deleteByTaskid">
|
update service_task_schedule
|
set del_flag = '1',
|
update_time = now()
|
where taskid = #{taskid}
|
and del_flag = '0'
|
</update>
|
|
<select id="selectActiveCycleSchedules" resultMap="ServiceTaskScheduleResult">
|
<include refid="selectServiceTaskScheduleVo"/>
|
where del_flag = '0'
|
and schedule_style = 1
|
and (max_loop_count is null
|
or max_loop_count = 0
|
or current_loop_count < max_loop_count)
|
order by id asc
|
limit #{limit}
|
</select>
|
|
</mapper>
|