<?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="org.springblade.modules.task.mapper.TaskNoFraudReportingMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="taskNoFraudReportingResultMap" type="org.springblade.modules.task.vo.TaskNoFraudReportingVO">
|
<result property="id" column="id"/>
|
<result property="taskId" column="task_id"/>
|
<result property="taskName" column="task_name"/>
|
<result property="placeName" column="place_name"/>
|
<result property="remark" column="remark"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="createTime" column="create_time"/>
|
<result property="houseCode" column="house_code"/>
|
<result property="createUser" column="create_user"/>
|
<result property="imageUrls" column="image_urls"/>
|
<result property="type" column="type"/>
|
<result property="status" column="status"/>
|
<result property="deleteFlag" column="delete_flag"/>
|
<collection property="taskPlaceRecordVOList" column="id" select="selectPatrolRecordList"
|
javaType="java.util.List" ofType="org.springblade.modules.task.vo.TaskPlaceRecordVO"
|
autoMapping="true">
|
</collection>
|
</resultMap>
|
|
|
<select id="selectTaskNoFraudReportingPage" resultMap="taskNoFraudReportingResultMap">
|
select jtnfr.*,
|
jp.id jpid,
|
jp.place_name,
|
jp.location,
|
jg.grid_name,
|
jp.principal,
|
jp.principal_phone,
|
IFNULL(jtnfr.no_fraud_type,jp.no_explosion_category) noExplosionCategory,
|
br.town_name as streetName,
|
br.village_name as communityName,
|
jpag.pcs_name,
|
bu.`name`,
|
jpe.legal_tel,
|
jpe.legal_person from jczz_task_no_fraud_reporting jtnfr
|
LEFT JOIN jczz_place jp ON jtnfr.house_code = jp.house_code and jp.is_deleted = 0
|
LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
|
LEFT JOIN blade_region br ON br.`code` = jg.community_code
|
LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
|
LEFT JOIN blade_user bu ON bu.id = jtnfr.create_user and bu.is_deleted = 0
|
LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
<where>
|
<if test="place.id != null ">and jtnfr.id = #{place.id}</if>
|
<if test="place.taskId != null ">and jtnfr.task_id = #{place.taskId}</if>
|
<if test="place.taskName != null and place.taskName != ''">and jtnfr.task_name = #{place.taskName}</if>
|
<if test="place.placeName != null and place.placeName != ''">and jtnfr.place_name = #{place.placeName}</if>
|
<if test="place.remark != null and place.remark != ''">and jtnfr.remark = #{place.remark}</if>
|
<if test="place.updateTime != null ">and jtnfr.update_time = #{place.updateTime}</if>
|
<if test="place.createTime != null ">and jtnfr.create_time = #{place.createTime}</if>
|
<if test="place.houseCode != null and place.houseCode != ''">and jtnfr.house_code = #{place.houseCode}</if>
|
<if test="place.createUser != null ">and jtnfr.create_user = #{place.createUser}</if>
|
<if test="place.imageUrls != null and place.imageUrls != ''">and jtnfr.image_urls = #{place.imageUrls}</if>
|
<if test="place.status != null ">and jtnfr.status = #{place.status}</if>
|
<if test="place.deleteFlag != null ">and jtnfr.delete_flag = #{place.deleteFlag}</if>
|
|
<if test="place.noExplosionCategory != null ">and jp.no_explosion_category = #{place.noExplosionCategory}</if>
|
|
<if test="place.placeName != null and place.placeName != ''">
|
and jp.place_name like concat('%', #{place.placeName},'%')
|
</if>
|
<if test="place.principal != null and place.principal != ''">
|
and jp.principal like concat('%', #{place.principal},'%')
|
</if>
|
<if test="place.streetName!=null and place.streetName!=''">
|
and br.town_name like concat('%', #{place.streetName},'%')
|
</if>
|
|
<if test="place.communityName!=null and place.communityName!=''">
|
and br.village_name like concat('%', #{place.communityName},'%')
|
</if>
|
<if test="place.gridName!=null and place.gridName!=''">
|
and jg.grid_name like concat('%', #{place.gridName},'%')
|
</if>
|
|
<if test="place.pcsName!=null and place.pcsName!=''">
|
and jtnfr.pcs_name like concat('%', #{place.pcsName},'%')
|
</if>
|
|
<if test="isAdministrator==2">
|
<choose>
|
<when test="place.roleName != null and place.roleName != ''">
|
<if test="place.roleName=='wgy'">
|
<choose>
|
<when test="gridCodeList !=null and gridCodeList.size()>0">
|
and jp.grid_code in
|
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jp.grid_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
<if test="place.roleName=='mj'">
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and (
|
jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")"
|
separator=",">
|
#{code}
|
</foreach>
|
or
|
jtnfr.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")"
|
separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
<otherwise>
|
and jpag.community_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
</when>
|
<otherwise>
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and
|
(
|
jg.grid_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
or
|
jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
<otherwise>
|
|
</otherwise>
|
</choose>
|
</otherwise>
|
</choose>
|
</if>
|
</where>
|
order by jtnfr.create_time desc
|
</select>
|
|
<select id="selectPatrolRecordList" parameterType="Long"
|
resultType="org.springblade.modules.task.vo.TaskPlaceRecordVO">
|
select jpr.id,
|
jpr.item_id,
|
jpr.task_place_self_check_id,
|
jpr.state,
|
jpr.remark,
|
jpr.image_urls,
|
jpr.create_user,
|
jpr.create_time,
|
jpr.is_deleted,
|
jpr.rectification_image_urls,
|
jpr.rectification_remark,
|
jpr.rectification_time,
|
jpgi.items_name
|
from jczz_task_place_record jpr
|
LEFT JOIN jczz_patrol_group_item jpgi on jpr.item_id = jpgi.id
|
where task_place_self_check_id = #{id}
|
and jpr.type = '2'
|
</select>
|
|
<resultMap type="org.springblade.modules.task.vo.TaskNoFraudReportingVO" id="TaskNoFraudReportingDTOResult">
|
<result property="id" column="id"/>
|
<result property="taskId" column="task_id"/>
|
<result property="taskName" column="task_name"/>
|
<result property="placeName" column="place_name"/>
|
<result property="remark" column="remark"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="createTime" column="create_time"/>
|
<result property="houseCode" column="house_code"/>
|
<result property="createUser" column="create_user"/>
|
<result property="imageUrls" column="image_urls"/>
|
<result property="status" column="status"/>
|
<result property="deleteFlag" column="delete_flag"/>
|
|
<collection property="taskPlaceRecordVOList" column="id" select="selectPatrolRecordList"
|
javaType="java.util.List" ofType="org.springblade.modules.task.vo.TaskPlaceRecordVO"
|
autoMapping="true">
|
</collection>
|
</resultMap>
|
|
<sql id="selectTaskNoFraudReporting">
|
select id,
|
task_id,
|
task_name,
|
place_name,
|
remark,
|
update_time,
|
create_time,
|
house_code,
|
create_user,
|
image_urls,
|
status,
|
delete_flag
|
from jczz_task_no_fraud_reporting
|
</sql>
|
|
<select id="selectTaskNoFraudReportingById" parameterType="long" resultMap="TaskNoFraudReportingDTOResult">
|
SELECT
|
jtnfpr.*,
|
jp.id jpid,
|
jp.place_name,
|
jp.location,
|
jg.grid_name,
|
jp.principal,
|
jp.no_explosion_category,
|
jp.principal_phone,
|
br.town_name,
|
br.village_name,
|
bu.`name`,
|
jpe.legal_tel,
|
jpe.legal_person,
|
jt.remark reasonFailure,
|
jda.address_name
|
FROM
|
jczz_task_no_fraud_reporting jtnfpr
|
LEFT JOIN jczz_task jt ON jt.id = jtnfpr.task_id
|
LEFT JOIN jczz_place jp ON jtnfpr.house_code = jp.house_code
|
LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
|
LEFT JOIN blade_region br ON br.`code` = jg.community_code
|
LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
|
LEFT JOIN blade_user bu ON bu.id = jtnfpr.create_user
|
LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jtnfpr.house_code
|
<where>
|
<if test="reporting.id != null ">and jtnfpr.id = #{reporting.id}</if>
|
<if test="reporting.taskId != null ">and jtnfpr.task_id = #{reporting.taskId}</if>
|
</where>
|
</select>
|
|
<select id="selectTaskNoFraudReportingList" parameterType="org.springblade.modules.task.vo.TaskNoFraudReportingVO"
|
resultMap="TaskNoFraudReportingDTOResult">
|
<include refid="selectTaskNoFraudReporting"/>
|
<where>
|
<if test="id != null ">and id = #{id}</if>
|
<if test="taskId != null ">and task_id = #{taskId}</if>
|
<if test="taskName != null and taskName != ''">and task_name = #{taskName}</if>
|
<if test="placeName != null and placeName != ''">and place_name = #{placeName}</if>
|
<if test="remark != null and remark != ''">and remark = #{remark}</if>
|
<if test="updateTime != null ">and update_time = #{updateTime}</if>
|
<if test="createTime != null ">and create_time = #{createTime}</if>
|
<if test="houseCode != null and houseCode != ''">and house_code = #{houseCode}</if>
|
<if test="createUser != null ">and create_user = #{createUser}</if>
|
<if test="imageUrls != null and imageUrls != ''">and image_urls = #{imageUrls}</if>
|
<if test="status != null ">and status = #{status}</if>
|
<if test="deleteFlag != null ">and delete_flag = #{deleteFlag}</if>
|
</where>
|
</select>
|
|
<select id="selectTaskNoFraudReporting"
|
resultType="org.springblade.modules.task.excel.TaskNoExplosionExcel">
|
|
select jtnfr.*,
|
jp.id jpid,
|
jp.place_name,
|
jp.location,
|
jg.grid_name,
|
jp.principal,
|
jp.principal_phone,
|
jp.no_explosion_category,
|
br.town_name as streetName,
|
br.village_name as communityName,
|
bu.`name`,
|
jpe.legal_tel,
|
jpe.legal_person from jczz_task_no_fraud_reporting jtnfr
|
LEFT JOIN jczz_place jp ON jtnfr.house_code = jp.house_code and jp.is_deleted = 0
|
LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
|
LEFT JOIN blade_region br ON br.`code` = jg.community_code
|
LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
|
LEFT JOIN blade_user bu ON bu.id = jtnfr.create_user and bu.is_deleted = 0
|
LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
<where>
|
<if test="place.id != null ">and jtnfr.id = #{place.id}</if>
|
<if test="place.taskId != null ">and jtnfr.task_id = #{place.taskId}</if>
|
<if test="place.taskName != null and place.taskName != ''">and jtnfr.task_name = #{place.taskName}</if>
|
<if test="place.placeName != null and place.placeName != ''">and jtnfr.place_name = #{place.placeName}</if>
|
<if test="place.remark != null and place.remark != ''">and jtnfr.remark = #{place.remark}</if>
|
<if test="place.updateTime != null ">and jtnfr.update_time = #{place.updateTime}</if>
|
<if test="place.createTime != null ">and jtnfr.create_time = #{place.createTime}</if>
|
<if test="place.houseCode != null and place.houseCode != ''">and jtnfr.house_code = #{place.houseCode}</if>
|
<if test="place.createUser != null ">and jtnfr.create_user = #{createUser}</if>
|
<if test="place.imageUrls != null and place.imageUrls != ''">and jtnfr.image_urls = #{place.imageUrls}</if>
|
<if test="place.status != null ">and jtnfr.status = #{place.status}</if>
|
<if test="place.deleteFlag != null ">and jtnfr.delete_flag = #{place.deleteFlag}</if>
|
|
<if test="place.noExplosionCategory != null ">and jp.no_explosion_category = #{place.noExplosionCategory}</if>
|
|
<if test="place.placeName != null and place.placeName != ''">
|
and jp.place_name like concat('%', #{place.placeName},'%')
|
</if>
|
<if test="place.principal != null and place.principal != ''">
|
and jp.principal like concat('%', #{place.principal},'%')
|
</if>
|
<if test="place.streetName!=null and place.streetName!=''">
|
and br.town_name like concat('%', #{place.streetName},'%')
|
</if>
|
|
<if test="place.communityName!=null and place.communityName!=''">
|
and br.village_name like concat('%', #{place.communityName},'%')
|
</if>
|
<if test="place.gridName!=null and place.gridName!=''">
|
and jg.grid_name like concat('%', #{place.gridName},'%')
|
</if>
|
|
<if test="isAdministrator==2">
|
<choose>
|
<when test="place.roleName != null and place.roleName != ''">
|
<if test="place.roleName=='wgy'">
|
<choose>
|
<when test="gridCodeList !=null and gridCodeList.size()>0">
|
and jp.grid_code in
|
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jp.grid_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
<if test="place.roleName=='mj'">
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")"
|
separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jpag.community_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
</when>
|
<otherwise>
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and
|
(
|
jg.grid_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
or
|
jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
<otherwise>
|
|
</otherwise>
|
</choose>
|
</otherwise>
|
</choose>
|
</if>
|
</where>
|
order by jtnfr.create_time desc
|
|
</select>
|
|
|
<select id="selectTaskNoFraudReportingCount" resultType="java.lang.Integer">
|
select count(1) from jczz_task_no_fraud_reporting jtnfr
|
LEFT JOIN jczz_place jp ON jtnfr.house_code = jp.house_code and jp.is_deleted = 0
|
LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
|
LEFT JOIN blade_region br ON br.`code` = jg.community_code
|
LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
|
LEFT JOIN blade_user bu ON bu.id = jtnfr.create_user and bu.is_deleted = 0
|
LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
<where>
|
<if test="place.id != null ">and jtnfr.id = #{place.id}</if>
|
<if test="place.taskId != null ">and jtnfr.task_id = #{place.taskId}</if>
|
<if test="place.taskName != null and place.taskName != ''">and jtnfr.task_name = #{place.taskName}</if>
|
<if test="place.placeName != null and place.placeName != ''">and jtnfr.place_name = #{place.placeName}</if>
|
<if test="place.remark != null and place.remark != ''">and jtnfr.remark = #{place.remark}</if>
|
<if test="place.updateTime != null ">and jtnfr.update_time = #{place.updateTime}</if>
|
<if test="place.createTime != null ">and jtnfr.create_time = #{place.createTime}</if>
|
<if test="place.houseCode != null and place.houseCode != ''">and jtnfr.house_code = #{place.houseCode}</if>
|
<if test="place.createUser != null ">and jtnfr.create_user = #{place.createUser}</if>
|
<if test="place.imageUrls != null and place.imageUrls != ''">and jtnfr.image_urls = #{place.imageUrls}</if>
|
<if test="place.status != null ">and jtnfr.status = #{place.status}</if>
|
<if test="place.deleteFlag != null ">and jtnfr.delete_flag = #{place.deleteFlag}</if>
|
|
<if test="place.noExplosionCategory != null ">and jp.no_explosion_category = #{place.noExplosionCategory}</if>
|
|
<if test="place.placeName != null and place.placeName != ''">
|
and jp.place_name like concat('%', #{place.placeName},'%')
|
</if>
|
<if test="place.principal != null and place.principal != ''">
|
and jp.principal like concat('%', #{place.principal},'%')
|
</if>
|
<if test="place.streetName!=null and place.streetName!=''">
|
and br.town_name like concat('%', #{place.streetName},'%')
|
</if>
|
|
<if test="place.communityName!=null and place.communityName!=''">
|
and br.village_name like concat('%', #{place.communityName},'%')
|
</if>
|
<if test="place.gridName!=null and place.gridName!=''">
|
and jg.grid_name like concat('%', #{place.gridName},'%')
|
</if>
|
|
<if test="place.pcsName!=null and place.pcsName!=''">
|
and jtnfr.pcs_name like concat('%', #{place.pcsName},'%')
|
</if>
|
|
<if test="isAdministrator==2">
|
<choose>
|
<when test="place.roleName != null and place.roleName != ''">
|
<if test="place.roleName=='wgy'">
|
<choose>
|
<when test="gridCodeList !=null and gridCodeList.size()>0">
|
and jp.grid_code in
|
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jp.grid_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
<if test="place.roleName=='mj'">
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and (
|
jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")"
|
separator=",">
|
#{code}
|
</foreach>
|
or
|
jtnfr.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")"
|
separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
<otherwise>
|
and jpag.community_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
</when>
|
<otherwise>
|
<choose>
|
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
|
and
|
(
|
jg.grid_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
or
|
jpag.community_code in
|
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
)
|
</when>
|
<otherwise>
|
|
</otherwise>
|
</choose>
|
</otherwise>
|
</choose>
|
</if>
|
</where>
|
</select>
|
|
|
</mapper>
|