zhongrj
2024-03-22 8a881a2c54673d4223425f17bc5cae8eef4e5649
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?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
        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
        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.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>
        <if test="backblastPubRecord.startTime != null and backblastPubRecord.startTime != ''">
            and date_format(jbpr.create_time,'%Y-%m-%d') &gt;= #{backblastPubRecord.startTime}
        </if>
        <if test="backblastPubRecord.endTime != null and backblastPubRecord.endTime != ''">
            and date_format(jbpr.create_time,'%Y-%m-%d') &lt;= #{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>
 
    <!--反炸宣传记录表 自定义详情-->
    <select id="getDetail" resultType="org.springblade.modules.backblast.vo.BackblastPubRecordVO">
        select
        jbpr.*,
        br.town_name as townName,
        br.name as communityName,
        jpag.pcs_name pcsName
        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
        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>
 
 
</mapper>