wlcb-system-task/src/main/resources/mybatis/mapper/receiveruserpatrol/receiver-user-patrol-mapper.xml

360 lines
13 KiB
XML
Raw Normal View History

<?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="cn.com.tenlion.systemtask.dao.receiveruserpatrol.IReceiverUserPatrolDao">
<resultMap id="receiverUserPatrolDTO" type="cn.com.tenlion.systemtask.pojo.dtos.receiveruserpatrol.ReceiverUserPatrolDTO">
<result column="receiver_user_patrol_id" property="receiverUserPatrolId"/>
<result column="receiver_user_id" property="receiverUserId"/>
<result column="patrol_time" property="patrolTime"/>
<result column="patrol_content" property="patrolContent"/>
<result column="patrol_result" property="patrolResult"/>
<result column="patrol_photo" property="patrolPhoto"/>
<result column="patrol_video" property="patrolVideo"/>
<result column="remake" property="remake"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="receiverUserPatrolBO" type="cn.com.tenlion.systemtask.pojo.bos.receiveruserpatrol.ReceiverUserPatrolBO">
<result column="receiver_user_patrol_id" property="receiverUserPatrolId"/>
<result column="receiver_user_id" property="receiverUserId"/>
<result column="patrol_time" property="patrolTime"/>
<result column="patrol_content" property="patrolContent"/>
<result column="patrol_result" property="patrolResult"/>
<result column="patrol_photo" property="patrolPhoto"/>
<result column="patrol_video" property="patrolVideo"/>
<result column="remake" property="remake"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="receiverUserPatrolPO" type="cn.com.tenlion.systemtask.pojo.pos.receiveruserpatrol.ReceiverUserPatrolPO">
<result column="receiver_user_patrol_id" property="receiverUserPatrolId"/>
<result column="receiver_user_id" property="receiverUserId"/>
<result column="patrol_time" property="patrolTime"/>
<result column="patrol_content" property="patrolContent"/>
<result column="patrol_result" property="patrolResult"/>
<result column="patrol_photo" property="patrolPhoto"/>
<result column="patrol_video" property="patrolVideo"/>
<result column="remake" property="remake"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增任务结果上报 -->
<insert id="save" parameterType="map">
INSERT INTO task_receiver_user_patrol(
receiver_user_patrol_id,
receiver_user_id,
patrol_time,
patrol_content,
patrol_result,
patrol_photo,
patrol_video,
remake,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{receiverUserPatrolId},
#{receiverUserId},
#{patrolTime},
#{patrolContent},
#{patrolResult},
#{patrolPhoto},
#{patrolVideo},
#{remake},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除任务结果上报 -->
<update id="remove" parameterType="map">
UPDATE
task_receiver_user_patrol
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
receiver_user_patrol_id IN
<foreach collection="receiverUserPatrolIds" index="index" open="(" separator="," close=")">
#{receiverUserPatrolIds[${index}]}
</foreach>
</update>
<!-- 删除任务结果上报(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
task_receiver_user_patrol
WHERE
receiver_user_patrol_id IN
<foreach collection="receiverUserPatrolIds" index="index" open="(" separator="," close=")">
#{receiverUserPatrolIds[${index}]}
</foreach>
</update>
<!-- 修改任务结果上报 -->
<update id="update" parameterType="map">
UPDATE
task_receiver_user_patrol
SET
<if test="receiverUserId != null and receiverUserId != ''">
receiver_user_id = #{receiverUserId},
</if>
<if test="patrolTime != null and patrolTime != ''">
patrol_time = #{patrolTime},
</if>
<if test="patrolContent != null and patrolContent != ''">
patrol_content = #{patrolContent},
</if>
<if test="patrolResult != null and patrolResult != ''">
patrol_result = #{patrolResult},
</if>
<if test="patrolPhoto != null and patrolPhoto != ''">
patrol_photo = #{patrolPhoto},
</if>
<if test="patrolVideo != null and patrolVideo != ''">
patrol_video = #{patrolVideo},
</if>
<if test="remake != null and remake != ''">
remake = #{remake},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
receiver_user_patrol_id = receiver_user_patrol_id
WHERE
receiver_user_patrol_id = #{receiverUserPatrolId}
</update>
<!-- 任务结果上报详情 -->
<select id="get" parameterType="map" resultMap="receiverUserPatrolDTO">
SELECT
t1.receiver_user_id,
t1.patrol_time,
t1.patrol_content,
t1.patrol_result,
t1.patrol_photo,
t1.patrol_video,
t1.remake,
t1.receiver_user_patrol_id
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
<if test="receiverUserPatrolId != null and receiverUserPatrolId != ''">
AND
t1.receiver_user_patrol_id = #{receiverUserPatrolId}
</if>
</select>
<!-- 任务结果上报详情 -->
<select id="getBO" parameterType="map" resultMap="receiverUserPatrolBO">
SELECT
t1.receiver_user_patrol_id,
t1.receiver_user_id,
t1.patrol_time,
t1.patrol_content,
t1.patrol_result,
t1.patrol_photo,
t1.patrol_video,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
<if test="receiverUserPatrolId != null and receiverUserPatrolId != ''">
AND
t1.receiver_user_patrol_id = #{receiverUserPatrolId}
</if>
</select>
<!-- 任务结果上报详情 -->
<select id="getPO" parameterType="map" resultMap="receiverUserPatrolPO">
SELECT
t1.receiver_user_patrol_id,
t1.receiver_user_id,
t1.patrol_time,
t1.patrol_content,
t1.patrol_result,
t1.patrol_photo,
t1.patrol_video,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
<if test="receiverUserPatrolId != null and receiverUserPatrolId != ''">
AND
t1.receiver_user_patrol_id = #{receiverUserPatrolId}
</if>
</select>
<!-- 任务结果上报列表 -->
<select id="list" parameterType="map" resultMap="receiverUserPatrolDTO">
SELECT
t1.receiver_user_patrol_id,
t1.receiver_user_id,
t1.patrol_time,
t1.patrol_content,
t1.patrol_result,
t1.patrol_photo,
t1.patrol_video,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
1
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="receiverUserId != null and receiverUserId != ''">
AND t1.receiver_user_id = #{receiverUserId}
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="receiverUserPatrolIds != null and receiverUserPatrolIds.size > 0">
AND
t1.receiver_user_patrol_id IN
<foreach collection="receiverUserPatrolIds" index="index" open="(" separator="," close=")">
#{receiverUserPatrolIds[${index}]}
</foreach>
</if>
</select>
<!-- 任务结果上报列表 -->
<select id="listBO" parameterType="map" resultMap="receiverUserPatrolBO">
SELECT
t1.receiver_user_patrol_id,
t1.receiver_user_id,
t1.patrol_time,
t1.patrol_content,
t1.patrol_result,
t1.patrol_photo,
t1.patrol_video,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="receiverUserPatrolIds != null and receiverUserPatrolIds.size > 0">
AND
t1.receiver_user_patrol_id IN
<foreach collection="receiverUserPatrolIds" index="index" open="(" separator="," close=")">
#{receiverUserPatrolIds[${index}]}
</foreach>
</if>
</select>
<!-- 任务结果上报列表 -->
<select id="listPO" parameterType="map" resultMap="receiverUserPatrolPO">
SELECT
t1.receiver_user_patrol_id,
t1.receiver_user_id,
t1.patrol_time,
t1.patrol_content,
t1.patrol_result,
t1.patrol_photo,
t1.patrol_video,
t1.remake,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="receiverUserPatrolIds != null and receiverUserPatrolIds.size > 0">
AND
t1.receiver_user_patrol_id IN
<foreach collection="receiverUserPatrolIds" index="index" open="(" separator="," close=")">
#{receiverUserPatrolIds[${index}]}
</foreach>
</if>
</select>
<!-- 任务结果上报统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
task_receiver_user_patrol t1
WHERE
t1.is_delete = 0
</select>
</mapper>