feiyu02
2024-08-15 196bb14112448857a885e32dc4149e308e00b01a
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
<?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="cn.flightfeather.supervision.domain.mapper.BaseInfoMapper">
    <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.entity.BaseInfo">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="BI_GUID" jdbcType="VARCHAR" property="biGuid"/>
        <result column="BI_Name" jdbcType="VARCHAR" property="biName"/>
        <result column="BI_Nick_Name" jdbcType="VARCHAR" property="biNickName"/>
        <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid"/>
        <result column="CI_Name" jdbcType="VARCHAR" property="ciName"/>
        <result column="BI_Province_Code" jdbcType="VARCHAR" property="biProvinceCode"/>
        <result column="BI_Province_Name" jdbcType="VARCHAR" property="biProvinceName"/>
        <result column="BI_City_Code" jdbcType="VARCHAR" property="biCityCode"/>
        <result column="BI_City_Name" jdbcType="VARCHAR" property="biCityName"/>
        <result column="BI_District_Code" jdbcType="VARCHAR" property="biDistrictCode"/>
        <result column="BI_District_Name" jdbcType="VARCHAR" property="biDistrictName"/>
        <result column="BI_Town_Code" jdbcType="VARCHAR" property="biTownCode"/>
        <result column="BI_Town_Name" jdbcType="VARCHAR" property="biTownName"/>
        <result column="BI_Area_Code" jdbcType="VARCHAR" property="biAreaCode"/>
        <result column="BI_Area" jdbcType="VARCHAR" property="biArea"/>
        <result column="BI_Management_Company_Id" jdbcType="VARCHAR" property="biManagementCompanyId"/>
        <result column="BI_Management_Company" jdbcType="VARCHAR" property="biManagementCompany"/>
        <result column="BI_Contact" jdbcType="VARCHAR" property="biContact"/>
        <result column="BI_Telephone" jdbcType="VARCHAR" property="biTelephone"/>
        <result column="BI_Address" jdbcType="VARCHAR" property="biAddress"/>
        <result column="BI_Create_Time" jdbcType="TIMESTAMP" property="biCreateTime"/>
        <result column="BI_Update_Time" jdbcType="TIMESTAMP" property="biUpdateTime"/>
        <result column="BI_Extension1" jdbcType="VARCHAR" property="biExtension1"/>
        <result column="BI_Extension2" jdbcType="VARCHAR" property="biExtension2"/>
        <result column="BI_Extension3" jdbcType="VARCHAR" property="biExtension3"/>
        <result column="BI_Remark" jdbcType="VARCHAR" property="biRemark"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        BI_GUID, BI_Name, BI_Nick_Name, CI_GUID, CI_Name, BI_Province_Code, BI_Province_Name,
        BI_City_Code, BI_City_Name, BI_District_Code, BI_District_Name, BI_Town_Code, BI_Town_Name,
        BI_Area_Code, BI_Area, BI_Management_Company_Id, BI_Management_Company, BI_Contact,
        BI_Telephone, BI_Address, BI_Create_Time, BI_Update_Time, BI_Extension1, BI_Extension2,
        BI_Extension3, BI_Remark
    </sql>
 
    <resultMap id="UserMap" type="cn.flightfeather.supervision.lightshare.vo.BaseInfoVo" extends="BaseResultMap">
        <result column="SC_Name" jdbcType="VARCHAR" property="sceneTypeName"/>
        <association property="userInfo" resultMap="cn.flightfeather.supervision.domain.mapper.UserinfoMapper.BaseResultMap" />
    </resultMap>
 
    <select id="searchUser" resultMap="UserMap">
        SELECT
        c.SC_Name,
        a.*,
        b.*
        FROM
        sm_t_userinfo AS a
        LEFT JOIN ea_t_baseinfo AS b ON a.UI_GUID = b.BI_GUID
        LEFT JOIN ea_t_scene_type AS c ON a.UI_Extension2 = c.SC_Id
        <where>
            <if test="provinceCode != null">
                AND b.BI_Province_Code = #{provinceCode}
            </if>
            <if test="provinceName != null">
                AND b.BI_Province_Name = #{provinceName}
            </if>
            <if test="cityCode != null">
                AND b.BI_City_Code = #{cityCode}
            </if>
            <if test="cityName != null">
                AND b.BI_City_Name = #{cityName}
            </if>
            <if test="districtCode != null">
                AND b.BI_District_Code = #{districtCode}
            </if>
            <if test="districtName != null">
                AND (b.BI_District_Name = #{districtName} OR a.UI_Extension1 = #{districtName})
            </if>
            <if test="townCode != null">
                AND b.BI_Town_Code = #{townCode}
            </if>
            <if test="townName != null">
                AND b.BI_Town_Name = #{townName}
            </if>
            <if test="areaCode != null">
                AND b.BI_Area_Code = #{areaCode}
            </if>
            <if test="area != null">
                AND b.BI_Area = #{area}
            </if>
            <if test="mcId != null">
                AND b.BI_Management_Company_Id = #{mcId}
            </if>
            <if test="mcName != null">
                AND b.BI_Management_Company = #{mcName}
            </if>
            <if test="userTypeId != null">
                AND a.UI_UserTypeID = #{userTypeId}
            </if>
            <if test="userSubTypeId != null">
                AND a.UI_User_SubType_Id = #{userSubTypeId}
            </if>
            <if test="online != null">
                AND a.UI_IsEnable = #{online}
            </if>
            <if test="sceneTypes.size() != 0">
                AND a.UI_Extension2 in
                <foreach collection="sceneTypes" item="type" open="(" separator="," close=")">
                    #{type, jdbcType=VARCHAR}
                </foreach>
            </if>
            <if test="searchText != null and searchText != ''">
                AND a.UI_RealName LIKE CONCAT('%', #{searchText}, '%')
            </if>
        </where>
    </select>
</mapper>