linwe
2024-08-09 8b7258c9427882bb1798f1502eaa35184c6e374e
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
<?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.grid.mapper.GridPatrolRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="gridPatrolRecordResultMap" type="org.springblade.modules.grid.entity.GridPatrolRecordEntity">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="context"    column="context"    />
        <result property="url"    column="url"    />
        <result property="patrolTime"    column="patrol_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="latitude"    column="latitude"    />
        <result property="longitude"    column="longitude"    />
        <result property="location"    column="location"    />
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectGridPatrolRecordPage" resultType="org.springblade.modules.grid.vo.GridPatrolRecordVO">
        select
        jgpr.*,
        bu.name as userName,
        br.town_name as townStreetName,
        br.name as neiName
        FROM
        jczz_grid_patrol_record jgpr
        LEFT JOIN blade_user bu ON bu.id = jgpr.create_user
        LEFT JOIN blade_dept bd ON bd.id = bu.dept_id
        LEFT JOIN jczz_grid jg on jg.grid_code=jgpr.grid_code
        LEFT JOIN blade_region br on br.code = jg.community_code
        <where>
            <if test="gridPatrolRecord.name!=null and gridPatrolRecord.name!=''">
                and jgpr.name like concat('%',#{gridPatrolRecord.name},'%')
            </if>
 
            <if test="gridPatrolRecord.userName!=null and gridPatrolRecord.userName!=''">
                and bu.name like concat('%',#{gridPatrolRecord.userName},'%')
            </if>
 
            <if test="gridPatrolRecord.townStreetName!=null and gridPatrolRecord.townStreetName!=''">
                and br.town_name like concat('%',#{gridPatrolRecord.townStreetName},'%')
            </if>
 
            <if test="gridPatrolRecord.neiName!=null and gridPatrolRecord.neiName!=''">
                and br.name like concat('%',#{gridPatrolRecord.neiName},'%')
            </if>
 
            <if test="gridPatrolRecord.context!=null and gridPatrolRecord.context!=''">
                and jgpr.context like concat('%',#{gridPatrolRecord.context},'%')
            </if>
            <if test="gridPatrolRecord.createUser!=null">
                and jgpr.create_user = #{gridPatrolRecord.createUser}
            </if>
            and jgpr.is_deleted = 0
        </where>
 
        order by jgpr.id desc
    </select>
 
 
    <select id="selectGridPatrolRecordExport"
            resultType="org.springblade.modules.grid.excel.GridPatrolRecordExcel">
        select
        jgpr.*,
        bu.name as userName,
        br.town_name as townStreetName,
        br.name as neiName
        FROM
        jczz_grid_patrol_record jgpr
        LEFT JOIN blade_user bu ON bu.id = jgpr.create_user
        LEFT JOIN blade_dept bd ON bd.id = bu.dept_id
        LEFT JOIN jczz_grid jg on jg.grid_code=jgpr.grid_code
        LEFT JOIN blade_region br on br.code = jg.community_code
        <where>
            <if test="gridPatrolRecord.name!=null and gridPatrolRecord.name!=''">
                and jgpr.name like concat('%',#{gridPatrolRecord.name},'%')
            </if>
 
            <if test="gridPatrolRecord.userName!=null and gridPatrolRecord.userName!=''">
                and bu.name like concat('%',#{gridPatrolRecord.userName},'%')
            </if>
 
            <if test="gridPatrolRecord.townStreetName!=null and gridPatrolRecord.townStreetName!=''">
                and br.town_name like concat('%',#{gridPatrolRecord.townStreetName},'%')
            </if>
 
            <if test="gridPatrolRecord.neiName!=null and gridPatrolRecord.neiName!=''">
                and br.name like concat('%',#{gridPatrolRecord.neiName},'%')
            </if>
 
            <if test="gridPatrolRecord.context!=null and gridPatrolRecord.context!=''">
                and jgpr.context like concat('%',#{gridPatrolRecord.context},'%')
            </if>
            <if test="gridPatrolRecord.createUser!=null">
                and jgpr.create_user = #{gridPatrolRecord.createUser}
            </if>
            and jgpr.is_deleted = 0
        </where>
 
        order by jgpr.id desc
 
    </select>
 
 
</mapper>