linwe
2024-09-03 764d883b5ea3bdc06abbec548b6df0511e567978
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
<?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.smsTask.mapper.SmsTaskMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="smsTaskResultMap" type="org.springblade.modules.smsTask.entity.SmsTaskEntity">
    </resultMap>
 
 
    <select id="selectSmsTaskPage" resultMap="smsTaskResultMap">
        <include refid="selectSmsTask"/>
        <where>
            <if test="smsTask.id != null "> and id = #{smsTask.id}</if>
            <if test="smsTask.name != null  and smsTask.name != ''"> and name = #{smsTask.name}</if>
            <if test="smsTask.community != null  and smsTask.community != ''"> and community = #{smsTask.community}</if>
            <if test="smsTask.createTime != null "> and create_time = #{smsTask.createTime}</if>
            <if test="smsTask.updateTime != null "> and update_time = #{smsTask.updateTime}</if>
            <if test="smsTask.smsTemplate != null "> and sms_template = #{smsTask.smsTemplate}</if>
            <if test="smsTask.deleteFlag != null  and smsTask.deleteFlag != ''"> and delete_flag = #{smsTask.deleteFlag}</if>
            <if test="smsTask.aoiCode != null  and smsTask.aoiCode != ''"> and district_id = #{smsTask.aoiCode}</if>
            <if test="smsTask.buildingCode != null  smsTask.and buildingCode != ''"> and building_code = #{smsTask.buildingCode}</if>
        </where>
    </select>
 
    <resultMap type="org.springblade.modules.smsTask.dto.SmsTaskDTO" id="SmsTaskDTOResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="community"    column="community"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="smsTemplate"    column="sms_template"    />
        <result property="deleteFlag"    column="delete_flag"    />
        <result property="districtId"    column="district_id"    />
        <result property="buildingCode"    column="building_code"    />
    </resultMap>
 
    <sql id="selectSmsTask">
        select
            id,
            name,
            community,
            create_time,
            update_time,
            sms_template,
            delete_flag,
            district_id,
            building_code,
            building_name,
            district_name,
            status
        from
            jczz_sms_task
    </sql>
 
    <select id="selectSmsTaskById" parameterType="long" resultMap="SmsTaskDTOResult">
        <include refid="selectSmsTask"/>
        where
        id = #{id}
    </select>
 
    <select id="selectSmsTaskList" parameterType="org.springblade.modules.smsTask.dto.SmsTaskDTO" resultMap="SmsTaskDTOResult">
        <include refid="selectSmsTask"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="name != null  and name != ''"> and name = #{name}</if>
            <if test="community != null  and community != ''"> and community = #{community}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="smsTemplate != null "> and sms_template = #{smsTemplate}</if>
            <if test="deleteFlag != null  and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
            <if test="districtId != null  and districtId != ''"> and district_id = #{districtId}</if>
            <if test="buildingCode != null  and buildingCode != ''"> and building_code = #{buildingCode}</if>
        </where>
    </select>
 
 
    <select id="selectSmsTaskListByPhone" resultType="org.springblade.modules.system.entity.User">
        SELECT DISTINCT
        bu.phone,
        bu.name
        FROM
        blade_user bu
        LEFT JOIN jczz_household jhd ON bu.id = jhd.associated_user_id
        LEFT JOIN jczz_house jh ON jhd.house_code = jh.house_code
        LEFT JOIN jczz_district jd ON jd.aoi_code = jh.district_code
        LEFT JOIN jczz_sms_task jst ON jst.district_id = jd.id
        LEFT JOIN jczz_doorplate_address jda on jda.address_code = jhd.house_code
        <where>
            <if test="id != null">jst.id = #{id}</if>
            <if test="buildingCode != null  and buildingCode != ''">and jda.building_code = #{buildingCode}</if>
            and jhd.relationship = 1
            and bu.phone is not null
        </where>
    </select>
 
 
 
 
</mapper>