青羊经侦大队-数据平台
whj
2022-07-19 caaa6ec6ee809b1c9e56600ba1468e8f4da0103b
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
<?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="com.example.jz.dao.ReportDao">
 
    <select id="getPage" resultType="com.example.jz.modle.vo.ReportListVo">
        select u.user_mobile mobile,u.user_idcard idcard,u.real_name reporterName,r.*
        from report r
        join user u on r.user_id = u.id
        <where>
            1=1
            <if test="reportParamDto.people != ''">
                and (u.real_name like '%${reportParamDto.people}%' or u.user_idcard like '%${reportParamDto.people}%')
            </if>
            <if test="reportParamDto.phoneNumber != ''">
                and u.user_mobile = ${reportParamDto.phoneNumber}
            </if>
            <if test="reportParamDto.havaMaterial != ''">
                <if test="reportParamDto.havaMaterial == 1">
                    and r.report_materials is not null
                </if>
                <if test="reportParamDto.havaMaterial == 0">
                    and r.report_materials is null
                </if>
            </if>
            <if test="reportParamDto.isInGroup != ''">
                and r.status = ${reportParamDto.isInGroup}
            </if>
        </where>
    </select>
    <select id="getReportListVoById" resultType="com.example.jz.modle.vo.ReportListVo">
        select u.user_mobile mobile, u.user_idcard idcard, u.real_name reporterName, r.*
        from report r
                 join user u on r.user_id = u.id
        where r.id = #{id}
    </select>
    <select id="getPageByGroupId" resultType="com.example.jz.modle.vo.ReportListVo">
        select u.user_mobile mobile,u.user_idcard idcard,u.real_name reporterName,r.*
        from report r
        join user u on r.user_id = u.id
        join group_user gu on gu.user_id = u.id
        <where>
            1=1
            <if test="reportParamDto.people != ''">
                and (u.real_name like '%${reportParamDto.people}%' or u.user_idcard like '%${reportParamDto.people}%')
            </if>
            <if test="reportParamDto.phoneNumber != ''">
                and u.user_mobile = ${reportParamDto.phoneNumber}
            </if>
            <if test="reportParamDto.havaMaterial != ''">
                <if test="reportParamDto.havaMaterial == 1">
                    and r.report_materials is not null
                </if>
                <if test="reportParamDto.havaMaterial == 0">
                    and r.report_materials is null
                </if>
            </if>
            <if test="reportParamDto.isInGroup != ''">
                and r.status = ${reportParamDto.isInGroup}
            </if>
        </where>
        and gu.group_id = #{groupId}
    </select>
</mapper>