<?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.backblast.mapper.BackblastPubRecordMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="backblastPubRecordResultMap" type="org.springblade.modules.backblast.vo.BackblastPubRecordVO">
|
</resultMap>
|
|
<!--自定义分页列表查询-->
|
<select id="selectBackblastPubRecordPage" resultMap="backblastPubRecordResultMap">
|
select
|
jbpr.*,
|
br.town_name AS townName,
|
br.NAME AS communityName,
|
jpag.pcs_name pcsName,
|
jda.aoi_name,
|
CONCAT( jda.building_name, '-', jda.unit_name, '-', jda.house_name ) houseName,
|
bd.dept_name
|
from jczz_backblast_pub_record jbpr
|
LEFT JOIN jczz_grid jg on jg.grid_code = jbpr.grid_code and jg.is_deleted = 0
|
LEFT JOIN jczz_police_affairs_grid jpag on jbpr.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
LEFT JOIN blade_region br on br.code = jpag.community_code
|
LEFT JOIN blade_user bu ON bu.id = jbpr.create_user
|
LEFT JOIN blade_dept bd on bd.id = bu.dept_id
|
LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jbpr.house_code
|
where jbpr.is_deleted = 0
|
<if test="backblastPubRecord.townName != null and backblastPubRecord.townName != ''">
|
and br.town_name like concat('%',#{backblastPubRecord.townName},'%')
|
</if>
|
<if test="backblastPubRecord.communityName != null and backblastPubRecord.communityName != ''">
|
and jbr.name like concat('%',#{backblastPubRecord.communityName},'%')
|
</if>
|
<if test="backblastPubRecord.pcsName != null and backblastPubRecord.pcsName != ''">
|
and jpag.pcs_name like concat('%',#{backblastPubRecord.pcsName},'%')
|
</if>
|
<if test="backblastPubRecord.houseCode != null and backblastPubRecord.houseCode != ''">
|
and jbpr.house_code = #{backblastPubRecord.houseCode}
|
</if>
|
<if test="backblastPubRecord.address != null and backblastPubRecord.address != ''">
|
and jbpr.address like concat('%',#{backblastPubRecord.address},'%')
|
</if>
|
<if test="backblastPubRecord.deptName != null and backblastPubRecord.deptName != ''">
|
and bd.dept_name like concat('%',#{backblastPubRecord.deptName},'%')
|
</if>
|
<if test="backblastPubRecord.pubContent != null and backblastPubRecord.pubContent != ''">
|
and jbpr.pub_content like concat('%',#{backblastPubRecord.pubContent},'%')
|
</if>
|
<if test="backblastPubRecord.policeman != null and backblastPubRecord.policeman != ''">
|
and jbpr.policeman like concat('%',#{backblastPubRecord.policeman},'%')
|
</if>
|
<if test="backblastPubRecord.createUser != null">
|
and jbpr.create_user = #{backblastPubRecord.createUser}
|
</if>
|
<if test="backblastPubRecord.policemanPhone != null and backblastPubRecord.policemanPhone != ''">
|
and jbpr.policeman_phone like concat('%',#{backblastPubRecord.policemanPhone},'%')
|
</if>
|
<if test="backblastPubRecord.startTime != null and backblastPubRecord.startTime != ''">
|
and date_format(jbpr.create_time,'%Y-%m-%d') >= #{backblastPubRecord.startTime}
|
</if>
|
<if test="backblastPubRecord.endTime != null and backblastPubRecord.endTime != ''">
|
and date_format(jbpr.create_time,'%Y-%m-%d') <= #{backblastPubRecord.endTime}
|
</if>
|
<if test="backblastPubRecord.searchKey!=null and backblastPubRecord.searchKey!=''">
|
and CONCAT(
|
ifnull(jbpr.policeman_phone,''),
|
ifnull(jbpr.address,''),
|
ifnull(jbpr.pub_content,''),
|
ifnull(jbpr.policeman,'')
|
) like CONCAT ('%', #{backblastPubRecord.searchKey},'%')
|
</if>
|
<if test="isAdministrator==2">
|
<choose>
|
<when test="backblastPubRecord.roleName != null and backblastPubRecord.roleName != ''">
|
<if test="backblastPubRecord.roleName=='wgy'">
|
<choose>
|
<when test="gridCodeList !=null and gridCodeList.size()>0">
|
and jg.grid_code in
|
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jg.grid_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
<if test="backblastPubRecord.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>
|
and
|
(
|
jg.grid_code in ('') or jpag.community_code in ('')
|
)
|
</otherwise>
|
</choose>
|
</otherwise>
|
</choose>
|
</if>
|
order by jbpr.id desc,jbpr.create_time desc
|
</select>
|
|
<!--详情map-->
|
<resultMap id="detailMap" type="org.springblade.modules.backblast.vo.BackblastPubRecordVO" autoMapping="true">
|
<id property="id" column="id"/>
|
<collection property="backblastPubPersonEntityList" javaType="java.util.List"
|
ofType="org.springblade.modules.backblast.entity.BackblastPubPersonEntity"
|
autoMapping="true">
|
<id property="id" column="cid"/>
|
<result property="address" column="caddress"/>
|
</collection>
|
</resultMap>
|
|
<!--反炸宣传记录表 自定义详情-->
|
<select id="getDetail" resultMap="detailMap">
|
select
|
jbpr.*,
|
br.town_name as townName,
|
br.name as communityName,
|
jpag.pcs_name pcsName,
|
jbpp.id as cid,
|
jbpp.name,
|
jbpp.telephone,
|
jbpp.id_card,
|
jbpp.address as caddress,
|
jbpp.occupation
|
from jczz_backblast_pub_record jbpr
|
LEFT JOIN jczz_grid jg on jg.grid_code = jbpr.grid_code and jg.is_deleted = 0
|
LEFT JOIN jczz_police_affairs_grid jpag on jbpr.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
LEFT JOIN blade_region br on br.code = jpag.community_code
|
LEFT JOIN jczz_backblast_pub_person jbpp on jbpp.backblast_pub_record_id = jbpr.id and jbpp.is_deleted = 0
|
where jbpr.is_deleted = 0
|
<if test="backblastPubRecord.id != null">
|
and jbpr.id = #{backblastPubRecord.id}
|
</if>
|
<if test="backblastPubRecord.townName != null and backblastPubRecord.townName != ''">
|
and br.town_name like concat('%',#{backblastPubRecord.townName},'%')
|
</if>
|
<if test="backblastPubRecord.communityName != null and backblastPubRecord.communityName != ''">
|
and jbr.name like concat('%',#{backblastPubRecord.communityName},'%')
|
</if>
|
<if test="backblastPubRecord.pcsName != null and backblastPubRecord.pcsName != ''">
|
and jpag.pcs_name like concat('%',#{backblastPubRecord.pcsName},'%')
|
</if>
|
<if test="backblastPubRecord.houseCode != null and backblastPubRecord.houseCode != ''">
|
and jbpr.house_code = #{backblastPubRecord.houseCode}
|
</if>
|
<if test="backblastPubRecord.address != null and backblastPubRecord.address != ''">
|
and jbpr.address like concat('%',#{backblastPubRecord.address},'%')
|
</if>
|
<if test="backblastPubRecord.pubContent != null and backblastPubRecord.pubContent != ''">
|
and jbpr.pub_content like concat('%',#{backblastPubRecord.pubContent},'%')
|
</if>
|
<if test="backblastPubRecord.policeman != null and backblastPubRecord.policeman != ''">
|
and jbpr.policeman like concat('%',#{backblastPubRecord.policeman},'%')
|
</if>
|
<if test="backblastPubRecord.policemanPhone != null and backblastPubRecord.policemanPhone != ''">
|
and jbpr.policeman_phone like concat('%',#{backblastPubRecord.policemanPhone},'%')
|
</if>
|
order by jbpr.id desc,jbpr.create_time desc
|
</select>
|
|
|
<select id="selectBackblastPubRecordExport"
|
resultType="org.springblade.modules.backblast.excel.BackblastPubRecordExcel">
|
select
|
jbpr.*,
|
br.town_name AS townName,
|
br.NAME AS communityName,
|
jpag.pcs_name pcsName,
|
jda.aoi_name,
|
CONCAT( jda.building_name, '-', jda.unit_name, '-', jda.house_name ) houseName,
|
bd.dept_name
|
from jczz_backblast_pub_record jbpr
|
LEFT JOIN jczz_grid jg on jg.grid_code = jbpr.grid_code and jg.is_deleted = 0
|
LEFT JOIN jczz_police_affairs_grid jpag on jbpr.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
|
LEFT JOIN blade_region br on br.code = jpag.community_code
|
LEFT JOIN blade_user bu ON bu.id = jbpr.create_user
|
LEFT JOIN blade_dept bd on bd.id = bu.dept_id
|
LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jbpr.house_code
|
where jbpr.is_deleted = 0
|
<if test="backblastPubRecord.townName != null and backblastPubRecord.townName != ''">
|
and br.town_name like concat('%',#{backblastPubRecord.townName},'%')
|
</if>
|
<if test="backblastPubRecord.communityName != null and backblastPubRecord.communityName != ''">
|
and jbr.name like concat('%',#{backblastPubRecord.communityName},'%')
|
</if>
|
<if test="backblastPubRecord.pcsName != null and backblastPubRecord.pcsName != ''">
|
and jpag.pcs_name like concat('%',#{backblastPubRecord.pcsName},'%')
|
</if>
|
<if test="backblastPubRecord.houseCode != null and backblastPubRecord.houseCode != ''">
|
and jbpr.house_code = #{backblastPubRecord.houseCode}
|
</if>
|
<if test="backblastPubRecord.address != null and backblastPubRecord.address != ''">
|
and jbpr.address like concat('%',#{backblastPubRecord.address},'%')
|
</if>
|
<if test="backblastPubRecord.deptName != null and backblastPubRecord.deptName != ''">
|
and bd.dept_name like concat('%',#{backblastPubRecord.deptName},'%')
|
</if>
|
<if test="backblastPubRecord.pubContent != null and backblastPubRecord.pubContent != ''">
|
and jbpr.pub_content like concat('%',#{backblastPubRecord.pubContent},'%')
|
</if>
|
<if test="backblastPubRecord.policeman != null and backblastPubRecord.policeman != ''">
|
and jbpr.policeman like concat('%',#{backblastPubRecord.policeman},'%')
|
</if>
|
<if test="backblastPubRecord.createUser != null">
|
and jbpr.create_user = #{backblastPubRecord.createUser}
|
</if>
|
<if test="backblastPubRecord.policemanPhone != null and backblastPubRecord.policemanPhone != ''">
|
and jbpr.policeman_phone like concat('%',#{backblastPubRecord.policemanPhone},'%')
|
</if>
|
<if test="backblastPubRecord.startTime != null and backblastPubRecord.startTime != ''">
|
and date_format(jbpr.create_time,'%Y-%m-%d') >= #{backblastPubRecord.startTime}
|
</if>
|
<if test="backblastPubRecord.endTime != null and backblastPubRecord.endTime != ''">
|
and date_format(jbpr.create_time,'%Y-%m-%d') <= #{backblastPubRecord.endTime}
|
</if>
|
<if test="backblastPubRecord.searchKey!=null and backblastPubRecord.searchKey!=''">
|
and CONCAT(
|
ifnull(jbpr.policeman_phone,''),
|
ifnull(jbpr.address,''),
|
ifnull(jbpr.pub_content,''),
|
ifnull(jbpr.policeman,'')
|
) like CONCAT ('%', #{backblastPubRecord.searchKey},'%')
|
</if>
|
<if test="isAdministrator==2">
|
<choose>
|
<when test="backblastPubRecord.roleName != null and backblastPubRecord.roleName != ''">
|
<if test="backblastPubRecord.roleName=='wgy'">
|
<choose>
|
<when test="gridCodeList !=null and gridCodeList.size()>0">
|
and jg.grid_code in
|
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
|
#{code}
|
</foreach>
|
</when>
|
<otherwise>
|
and jg.grid_code in ('')
|
</otherwise>
|
</choose>
|
</if>
|
<if test="backblastPubRecord.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>
|
and
|
(
|
jg.grid_code in ('') or jpag.community_code in ('')
|
)
|
</otherwise>
|
</choose>
|
</otherwise>
|
</choose>
|
</if>
|
order by jbpr.id desc,jbpr.create_time desc
|
|
</select>
|
|
|
</mapper>
|