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.
 
 

349 lines
18 KiB

<?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.inspect.task.mapper.PatrolTaskMapper">
<resultMap type="PatrolTask" id="PatrolTaskResult">
<result property="taskId" column="task_id"/>
<result property="stationName" column="station_name"/>
<result property="stationCode" column="station_code"/>
<result property="type" column="type"/>
<result property="taskCode" column="task_code"/>
<result property="taskName" column="task_name"/>
<result property="priority" column="priority"/>
<result property="deviceLevel" column="device_level"/>
<result property="deviceList" column="device_list"/>
<result property="fixedStartTime" column="fixed_start_time"/>
<result property="cycleMonth" column="cycle_month"/>
<result property="cycleWeek" column="cycle_week"/>
<result property="cycleExecuteTime" column="cycle_execute_time"/>
<result property="cycleStartTime" column="cycle_start_time"/>
<result property="cycleEndTime" column="cycle_end_time"/>
<result property="intervalNumber" column="interval_number"/>
<result property="intervalType" column="interval_type"/>
<result property="intervalExecuteTime" column="interval_execute_time"/>
<result property="intervalStartTime" column="interval_start_time"/>
<result property="intervalEndTime" column="interval_end_time"/>
<result property="invalidStartTime" column="invalid_start_time"/>
<result property="invalidEndTime" column="invalid_end_time"/>
<result property="isEnable" column="is_enable"/>
<result property="createTime" column="create_time"/>
<result property="drafter" column="drafter"/>
<result property="fileStatus" column="file_status"/>
<result property="executionStatus" column="execution_status"/>
<result property="taskCycle" column="task_cycle"/>
<result property="devNo" column="dev_no"/>
<result property="devType" column="dev_type"/>
<result property="storage" column="storage"/>
<result property="areaId" column="area_id"/>
<result property="areaName" column="area_name"/>
<result property="executionMode" column="execution_mode"/>
<result property="linkageState" column="linkage_state"/>
<result property="isUp" column="is_up"/>
<result property="areaIdS" column="area_id_s"/>
</resultMap>
<sql id="selectPatrolTaskVo">
select task_id,
dev_no,
is_up,
linkage_state,
execution_mode,
storage,
area_name,
area_id,
dev_type,
task_cycle,
station_name,
file_status,
execution_status,
station_code,
type,
task_code,
task_name,
priority,
device_level,
device_list,
fixed_start_time,
cycle_month,
cycle_week,
cycle_execute_time,
cycle_start_time,
cycle_end_time,
interval_number,
interval_type,
interval_execute_time,
interval_start_time,
interval_end_time,
invalid_start_time,
invalid_end_time,
is_enable,
create_time,
drafter,
area_id_s
from patrol_task
</sql>
<select id="selectPatrolTaskList" parameterType="PatrolTask" resultMap="PatrolTaskResult">
<include refid="selectPatrolTaskVo"/>
<where>
<if test="stationName != null and stationName != ''">and station_name like concat('%', #{stationName},
'%')
</if>
<if test="stationCode != null and stationCode != ''">and station_code = #{stationCode}</if>
<if test="taskId != null ">and task_id = #{taskId}</if>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
<if test="priority != null and priority != ''">and priority = #{priority}</if>
<if test="deviceLevel != null and deviceLevel != ''">and device_level = #{deviceLevel}</if>
<if test="deviceList != null and deviceList != ''">and device_list like concat ('%',#{deviceList},'%')</if>
<if test="fixedStartTime != null ">and fixed_start_time = #{fixedStartTime}</if>
<if test="cycleMonth != null and cycleMonth != ''">and cycle_month = #{cycleMonth}</if>
<if test="cycleWeek != null and cycleWeek != ''">and cycle_week = #{cycleWeek}</if>
<if test="cycleExecuteTime != null ">and cycle_execute_time = #{cycleExecuteTime}</if>
<if test="cycleStartTime != null ">
and date_format(cycle_start_time,'%y%m%d') &gt;= date_format(#{cycleStartTime},'%y%m%d')
</if>
<if test="cycleEndTime != null ">
and date_format(cycle_end_time,'%y%m%d') &lt;= date_format(#{cycleEndTime},'%y%m%d')
</if>
<if test="intervalNumber != null and intervalNumber != ''">and interval_number = #{intervalNumber}</if>
<if test="intervalType != null and intervalType != ''">and interval_type = #{intervalType}</if>
<if test="intervalExecuteTime != null ">and interval_execute_time = #{intervalExecuteTime}</if>
<if test="intervalStartTime != null ">and interval_start_time = #{intervalStartTime}</if>
<if test="intervalEndTime != null ">and interval_end_time = #{intervalEndTime}</if>
<if test="invalidStartTime != null ">and invalid_start_time = #{invalidStartTime}</if>
<if test="invalidEndTime != null ">and invalid_end_time = #{invalidEndTime}</if>
<if test="isEnable != null and isEnable != ''">and is_enable = #{isEnable}</if>
<if test="drafter != null and drafter != ''">and drafter = #{drafter}</if>
<if test="fileStatus != null and fileStatus != ''">and file_status = #{fileStatus}</if>
<if test="executionStatus != null and executionStatus != ''">and execution_status = #{executionStatus}</if>
<if test="taskCycle != null and taskCycle != ''">and task_cycle = #{taskCycle}</if>
<if test="devNo != null and devNo != ''">and dev_no = #{devNo}</if>
<if test="devType != null and devType != ''">and dev_type = #{devType}</if>
<if test="storage != null and storage != ''">and storage = #{storage}</if>
<if test="areaId != null and areaId != ''">and area_id = #{areaId}</if>
<if test="areaName != null and areaName != ''">and area_name = #{areaName}</if>
<if test="executionMode != null and executionMode != ''">and execution_mode = #{executionMode}</if>
<if test="linkageState != null and linkageState != ''">and linkage_state = #{linkageState}</if>
<if test="isUp != null and isUp != ''">and is_up = #{isUp}</if>
<if test="areaIdS != null and areaIdS != ''">and area_id_s = #{areaIdS}</if>
<if test="beginTime != null and beginTime != ''">
and date_format(create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''">
and date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
order by task_id desc
</select>
<select id="selectPatrolTaskByTaskId" parameterType="Long" resultMap="PatrolTaskResult">
<include refid="selectPatrolTaskVo"/>
where task_id = #{taskId}
</select>
<select id="selectBasedataBdConfigDeviceConvert" parameterType="DeviceConvert" resultType="java.util.Map">
select * from basedata_bdconfig_device_convert
<where>
<if test="deviceId!=null and deviceId!=''">and device_id=#{deviceId}</if>
<if test="deviceCode!=null and deviceCode!=''">and device_code=#{deviceCode}</if>
<if test="originalDevicecode!=null and originalDevicecode!=''">and
original_device_code=#{originalDevicecode}
</if>
</where>
</select>
<select id="selectBaseDevice" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_device a
inner join basedata_area b on a.area_id = b.area_id
where b.area_code = #{AreaCode}
</select>
<select id="selectBaseDeviceByCode" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_device a
where a.device_code = #{devcode}
</select>
<select id="selectBasePoint" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_patrolpoint a
where a.main_device_id = #{devId}
</select>
<select id="selectBasePointByBj" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_patrolpoint a
where a.device_id = #{devId}
</select>
<select id="selectBasePointByPointId" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_patrolpoint a
where a.patrol_point_id = #{pointId}
</select>
<select id="selectBasePointPre" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_patrolpoint_preset a
where a.patrol_point_id = #{pointId}
</select>
<select id="selectBaseEqBook" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_eqpbook a
where a.eqp_book_id = #{eqId}
</select>
<select id="selectConfigByKey" parameterType="String" resultType="String">
select config_value
from sys_config
where config_key = #{taskId}
</select>
<insert id="insertPatrolTask" parameterType="PatrolTask" useGeneratedKeys="true" keyProperty="taskId">
insert into patrol_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationName != null">station_name,</if>
<if test="stationCode != null">station_code,</if>
<if test="type != null">type,</if>
<if test="taskCode != null">task_code,</if>
<if test="taskName != null">task_name,</if>
<if test="priority != null">priority,</if>
<if test="deviceLevel != null">device_level,</if>
<if test="deviceList != null">device_list,</if>
<if test="fixedStartTime != null">fixed_start_time,</if>
<if test="cycleMonth != null">cycle_month,</if>
<if test="cycleWeek != null">cycle_week,</if>
<if test="cycleExecuteTime != null">cycle_execute_time,</if>
<if test="cycleStartTime != null">cycle_start_time,</if>
<if test="cycleEndTime != null">cycle_end_time,</if>
<if test="intervalNumber != null">interval_number,</if>
<if test="intervalType != null">interval_type,</if>
<if test="intervalExecuteTime != null">interval_execute_time,</if>
<if test="intervalStartTime != null">interval_start_time,</if>
<if test="intervalEndTime != null">interval_end_time,</if>
<if test="invalidStartTime != null">invalid_start_time,</if>
<if test="invalidEndTime != null">invalid_end_time,</if>
<if test="isEnable != null">is_enable,</if>
<if test="createTime != null">create_time,</if>
<if test="drafter != null">drafter,</if>
<if test="fileStatus != null">file_status,</if>
<if test="executionStatus != null">execution_status,</if>
<if test="taskCycle != null">task_cycle,</if>
<if test="devNo != null">dev_no,</if>
<if test="devType != null">dev_type,</if>
<if test="storage != null">storage,</if>
<if test="areaId != null">area_id,</if>
<if test="areaName != null">area_name,</if>
<if test="executionMode != null">execution_mode,</if>
<if test="linkageState != null">linkage_state,</if>
<if test="isUp != null">is_up,</if>
<if test="areaIdS != null">area_id_s,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationName != null">#{stationName},</if>
<if test="stationCode != null">#{stationCode},</if>
<if test="type != null">#{type},</if>
<if test="taskCode != null">#{taskCode},</if>
<if test="taskName != null">#{taskName},</if>
<if test="priority != null">#{priority},</if>
<if test="deviceLevel != null">#{deviceLevel},</if>
<if test="deviceList != null">#{deviceList},</if>
<if test="fixedStartTime != null">#{fixedStartTime},</if>
<if test="cycleMonth != null">#{cycleMonth},</if>
<if test="cycleWeek != null">#{cycleWeek},</if>
<if test="cycleExecuteTime != null">#{cycleExecuteTime},</if>
<if test="cycleStartTime != null">#{cycleStartTime},</if>
<if test="cycleEndTime != null">#{cycleEndTime},</if>
<if test="intervalNumber != null">#{intervalNumber},</if>
<if test="intervalType != null">#{intervalType},</if>
<if test="intervalExecuteTime != null">#{intervalExecuteTime},</if>
<if test="intervalStartTime != null">#{intervalStartTime},</if>
<if test="intervalEndTime != null">#{intervalEndTime},</if>
<if test="invalidStartTime != null">#{invalidStartTime},</if>
<if test="invalidEndTime != null">#{invalidEndTime},</if>
<if test="isEnable != null">#{isEnable},</if>
<if test="createTime != null">#{createTime},</if>
<if test="drafter != null">#{drafter},</if>
<if test="fileStatus != null">#{fileStatus},</if>
<if test="executionStatus != null">#{executionStatus},</if>
<if test="taskCycle != null">#{taskCycle},</if>
<if test="devNo != null">#{devNo},</if>
<if test="devType != null">#{devType},</if>
<if test="storage != null">#{storage},</if>
<if test="areaId != null">#{areaId},</if>
<if test="areaName != null">#{areaName},</if>
<if test="executionMode != null">#{executionMode},</if>
<if test="linkageState != null">#{linkageState},</if>
<if test="isUp != null">#{isUp},</if>
<if test="areaIdS != null">#{areaIdS},</if>
</trim>
</insert>
<update id="updatePatrolTask" parameterType="PatrolTask">
update patrol_task
<trim prefix="SET" suffixOverrides=",">
<if test="stationName != null">station_name = #{stationName},</if>
<if test="stationCode != null">station_code = #{stationCode},</if>
<if test="type != null">type = #{type},</if>
<if test="taskCode != null">task_code = #{taskCode},</if>
<if test="taskName != null">task_name = #{taskName},</if>
<if test="priority != null">priority = #{priority},</if>
<if test="deviceLevel != null">device_level = #{deviceLevel},</if>
<if test="deviceList != null">device_list = #{deviceList},</if>
<if test="fixedStartTime != null">fixed_start_time = #{fixedStartTime},</if>
<if test="cycleMonth != null">cycle_month = #{cycleMonth},</if>
<if test="cycleWeek != null">cycle_week = #{cycleWeek},</if>
<if test="cycleExecuteTime != null">cycle_execute_time = #{cycleExecuteTime},</if>
<if test="cycleStartTime != null">cycle_start_time = #{cycleStartTime},</if>
<if test="cycleEndTime != null">cycle_end_time = #{cycleEndTime},</if>
<if test="intervalNumber != null">interval_number = #{intervalNumber},</if>
<if test="intervalType != null">interval_type = #{intervalType},</if>
<if test="intervalExecuteTime != null">interval_execute_time = #{intervalExecuteTime},</if>
<if test="intervalStartTime != null">interval_start_time = #{intervalStartTime},</if>
<if test="intervalEndTime != null">interval_end_time = #{intervalEndTime},</if>
<if test="invalidStartTime != null">invalid_start_time = #{invalidStartTime},</if>
<if test="invalidEndTime != null">invalid_end_time = #{invalidEndTime},</if>
<if test="isEnable != null">is_enable = #{isEnable},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="drafter != null">drafter = #{drafter},</if>
<if test="fileStatus != null">file_status = #{fileStatus},</if>
<if test="executionStatus != null">execution_status = #{executionStatus},</if>
<if test="taskCycle != null">task_cycle = #{taskCycle},</if>
<if test="devNo != null">dev_no = #{devNo},</if>
<if test="devType != null">dev_type = #{devType},</if>
<if test="storage != null">storage = #{storage},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="areaName != null">area_name = #{areaName},</if>
<if test="executionMode != null">execution_mode = #{executionMode},</if>
<if test="linkageState != null">linkage_state = #{linkageState},</if>
<if test="isUp != null">is_up = #{isUp},</if>
<if test="areaIdS != null">area_id_s = #{areaIdS},</if>
</trim>
where task_id = #{taskId}
</update>
<update id="updatePatrolTaskTime" parameterType="String">
update patrol_task
<trim prefix="SET" suffixOverrides=",">
fixed_start_time = null
</trim>
where task_id = #{taskId}
</update>
<delete id="deletePatrolTaskByTaskId" parameterType="Long">
delete
from patrol_task
where task_id = #{taskId}
</delete>
<delete id="deletePatrolTaskByTaskIds" parameterType="String">
delete from patrol_task where task_id in
<foreach item="taskId" collection="array" open="(" separator="," close=")">
#{taskId}
</foreach>
</delete>
<select id="selectTaskRationalGroupByType" resultType="java.util.Map">
select p.type, COUNT(1) num
from patrol_task p
group by p.type;
</select>
</mapper>