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.
 
 

253 lines
13 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.resultmain.mapper.PatrolTaskResultMainMapper">
<resultMap type="PatrolTaskResultMain" id="PatrolTaskResultMainResult">
<result property="lineId" column="line_id"/>
<result property="taskId" column="task_id"/>
<result property="taskName" column="task_name"/>
<result property="taskCode" column="task_code"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="fileStatus" column="file_status"/>
<result property="areaName" column="area_name"/>
<result property="taskType" column="task_type"/>
<result property="taskTime" column="task_time"/>
<result property="intervalName" column="interval_name"/>
<result property="devType" column="dev_type"/>
<result property="taskResult" column="task_result"/>
<result property="requestId" column="request_id"/>
<result property="checkPerson" column="check_person"/>
<result property="checkTime" column="check_time"/>
<result property="taskPatrolledId" column="task_patrolled_id"/>
</resultMap>
<sql id="selectPatrolTaskResultMainVo">
select line_id,
task_id,
task_patrolled_id,
task_name,
task_code,
create_time,
create_by,
file_status,
area_name,
task_type,
task_time,
interval_name,
dev_type,
task_result,
request_id,
check_person,
check_time
from patrol_task_result_main
</sql>
<select id="selectPatrolTaskResultMainList" parameterType="PatrolTaskResultMain"
resultMap="PatrolTaskResultMainResult">
<!-- SELECT-->
<!-- a.line_id,-->
<!-- a.task_id,-->
<!-- a.task_patrolled_id,-->
<!-- a.task_name,-->
<!-- a.task_code,-->
<!-- a.create_time,-->
<!-- a.create_by,-->
<!-- a.file_status,-->
<!-- a.area_name,-->
<!-- a.task_type,-->
<!-- a.task_time,-->
<!-- a.interval_name,-->
<!-- a.dev_type,-->
<!-- a.task_result,-->
<!-- a.request_id,-->
<!-- a.check_person,-->
<!-- a.check_time-->
<!-- FROM-->
<!-- patrol_task_result_main a,-->
<!-- patrol_task_status b-->
<!-- WHERE-->
<!-- a.task_patrolled_id = b.task_patrolled_id-->
<!-- AND b.task_state = '1'-->
<!-- <where>-->
<!-- <if test="taskId != null and taskId != ''"> and a.task_id = #{taskId}</if>-->
<!-- <if test="taskName != null and taskName != ''"> and a.task_name like concat('%', #{taskName}, '%')</if>-->
<!-- <if test="taskCode != null and taskCode != ''"> and a.task_code = #{taskCode}</if>-->
<!-- <if test="createBy != null and createBy != ''"> and a.create_by = #{createBy}</if>-->
<!-- <if test="fileStatus != null and fileStatus != ''"> and a.file_status = #{fileStatus}</if>-->
<!-- <if test="areaName != null and areaName != ''"> and a.area_name like concat('%', #{areaName}, '%')</if>-->
<!-- <if test="taskType != null and taskType != ''"> and a.task_type = #{taskType}</if>-->
<!-- <if test="taskTime != null "> and a.task_time = #{taskTime}</if>-->
<!-- <if test="intervalName != null and intervalName != ''"> and a.interval_name like concat('%', #{intervalName}, '%')</if>-->
<!-- <if test="devType != null and devType != ''"> and a.dev_type = #{devType}</if>-->
<!-- <if test="taskResult != null and taskResult != ''"> and a.task_result = #{taskResult}</if>-->
<!-- <if test="requestId != null and requestId != ''"> and a.request_id = #{requestId}</if>-->
<!-- <if test="checkPerson != null and checkPerson != ''"> and a.check_person = #{checkPerson}</if>-->
<!-- <if test="checkTime != null "> and a.check_time = #{checkTime}</if>-->
<!-- <if test="taskPatrolledId != null "> and a.task_patrolled_id = #{taskPatrolledId}</if>-->
<!-- </where>-->
<!-- ORDER BY a.line_id desc-->
<include refid="selectPatrolTaskResultMainVo"/>
<where>
<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="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="fileStatus != null and fileStatus != ''">and file_status = #{fileStatus}</if>
<if test="areaName != null and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
<if test="taskType != null and taskType != ''">and task_type = #{taskType}</if>
<if test="taskTime != null ">and task_time = #{taskTime}</if>
<if test="intervalName != null and intervalName != ''">and interval_name like concat('%', #{intervalName},
'%')
</if>
<if test="devType != null and devType != ''">and dev_type = #{devType}</if>
<if test="taskResult != null and taskResult != ''">and task_result = #{taskResult}</if>
<if test="requestId != null and requestId != ''">and request_id = #{requestId}</if>
<if test="checkPerson != null and checkPerson != ''">and check_person = #{checkPerson}</if>
<if test="checkTime != null ">and check_time = #{checkTime}</if>
<if test="taskPatrolledId != null ">and task_patrolled_id = #{taskPatrolledId}</if>
</where>
ORDER BY line_id desc
</select>
<select id="selectPatrolTaskResultMain" parameterType="PatrolTaskResultMain" resultMap="PatrolTaskResultMainResult">
SELECT
a.line_id,
a.task_id,
a.task_patrolled_id,
a.task_name,
a.task_code,
a.create_time,
a.create_by,
a.file_status,
a.area_name,
a.task_type,
a.task_time,
a.interval_name,
a.dev_type,
a.task_result,
a.request_id,
a.check_person,
a.check_time
FROM
patrol_task_result_main a,
patrol_task_status b
WHERE
a.task_patrolled_id = b.task_patrolled_id
AND b.task_state = '1'
<if test="taskId != null and taskId != ''">and a.task_id = #{taskId}</if>
<if test="taskName != null and taskName != ''">and a.task_name like concat('%', #{taskName}, '%')</if>
<if test="taskCode != null and taskCode != ''">and a.task_code = #{taskCode}</if>
<if test="createBy != null and createBy != ''">and a.create_by = #{createBy}</if>
<if test="fileStatus != null and fileStatus != ''">and a.file_status = #{fileStatus}</if>
<if test="areaName != null and areaName != ''">and a.area_name like concat('%', #{areaName}, '%')</if>
<if test="taskType != null and taskType != ''">and a.task_type = #{taskType}</if>
<if test="taskTime != null ">and a.task_time = #{taskTime}</if>
<if test="intervalName != null and intervalName != ''">and a.interval_name like concat('%', #{intervalName},
'%')
</if>
<if test="devType != null and devType != ''">and a.dev_type = #{devType}</if>
<if test="taskResult != null and taskResult != ''">and a.task_result = #{taskResult}</if>
<if test="requestId != null and requestId != ''">and a.request_id = #{requestId}</if>
<if test="checkPerson != null and checkPerson != ''">and a.check_person = #{checkPerson}</if>
<if test="checkTime != null ">and a.check_time = #{checkTime}</if>
<if test="taskPatrolledId != null ">and a.task_patrolled_id = #{taskPatrolledId}</if>
ORDER BY a.line_id desc
</select>
<select id="selectPatrolTaskResultMainByLineId" parameterType="Long" resultMap="PatrolTaskResultMainResult">
<include refid="selectPatrolTaskResultMainVo"/>
where line_id = #{lineId}
</select>
<select id="selectMainFileStatus" parameterType="String" resultMap="PatrolTaskResultMainResult">
SELECT
line_id,
task_patrolled_id,
file_status
FROM
patrol_task_result_main
WHERE
task_patrolled_id in (${ids})
</select>
<insert id="insertPatrolTaskResultMain" parameterType="PatrolTaskResultMain" useGeneratedKeys="true"
keyProperty="lineId">
insert into patrol_task_result_main
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">task_id,</if>
<if test="taskName != null">task_name,</if>
<if test="taskCode != null">task_code,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="fileStatus != null">file_status,</if>
<if test="areaName != null">area_name,</if>
<if test="taskType != null">task_type,</if>
<if test="taskTime != null">task_time,</if>
<if test="intervalName != null">interval_name,</if>
<if test="devType != null">dev_type,</if>
<if test="taskResult != null">task_result,</if>
<if test="requestId != null">request_id,</if>
<if test="checkPerson != null">check_person,</if>
<if test="checkTime != null">check_time,</if>
<if test="taskPatrolledId != null">task_patrolled_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskId != null">#{taskId},</if>
<if test="taskName != null">#{taskName},</if>
<if test="taskCode != null">#{taskCode},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="fileStatus != null">#{fileStatus},</if>
<if test="areaName != null">#{areaName},</if>
<if test="taskType != null">#{taskType},</if>
<if test="taskTime != null">#{taskTime},</if>
<if test="intervalName != null">#{intervalName},</if>
<if test="devType != null">#{devType},</if>
<if test="taskResult != null">#{taskResult},</if>
<if test="requestId != null">#{requestId},</if>
<if test="checkPerson != null">#{checkPerson},</if>
<if test="checkTime != null">#{checkTime},</if>
<if test="taskPatrolledId != null">#{taskPatrolledId},</if>
</trim>
</insert>
<update id="updatePatrolTaskResultMain" parameterType="PatrolTaskResultMain">
update patrol_task_result_main
<trim prefix="SET" suffixOverrides=",">
<if test="taskId != null">task_id = #{taskId},</if>
<if test="taskName != null">task_name = #{taskName},</if>
<if test="taskCode != null">task_code = #{taskCode},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="fileStatus != null">file_status = #{fileStatus},</if>
<if test="areaName != null">area_name = #{areaName},</if>
<if test="taskType != null">task_type = #{taskType},</if>
<if test="taskTime != null">task_time = #{taskTime},</if>
<if test="intervalName != null">interval_name = #{intervalName},</if>
<if test="devType != null">dev_type = #{devType},</if>
<if test="taskResult != null">task_result = #{taskResult},</if>
<if test="requestId != null">request_id = #{requestId},</if>
<if test="checkPerson != null">check_person = #{checkPerson},</if>
<if test="checkTime != null">check_time = #{checkTime},</if>
<if test="taskPatrolledId != null">task_patrolled_id = #{taskPatrolledId},</if>
</trim>
where line_id = #{lineId}
</update>
<delete id="deletePatrolTaskResultMainByLineId" parameterType="Long">
delete
from patrol_task_result_main
where line_id = #{lineId}
</delete>
<delete id="deletePatrolTaskResultMainByLineIds" parameterType="String">
delete from patrol_task_result_main where line_id in
<foreach item="lineId" collection="array" open="(" separator="," close=")">
#{lineId}
</foreach>
</delete>
</mapper>