地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
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
162
163
164
165
166
167
<?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.javaweb.platform.mapper.FrontUserMapper">
    
    <resultMap type="FrontUser" id="FrontUserResult">
        <result property="id"    column="id"    />
        <result property="userName"    column="user_name"    />
        <result property="userType"    column="user_type"    />
        <result property="email"    column="email"    />
        <result property="phone"    column="phone"    />
        <result property="password"    column="password"    />
        <result property="salt"    column="salt"    />
        <result property="status"    column="status"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="avatar"    column="avatar"    />
        <result property="loginIp"    column="login_ip"    />
        <result property="createTime"    column="create_time"    />
        <result property="address"    column="address"    />
        <result property="company"    column="company"    />
        <result property="applyLicense"    column="apply_license"    />
        <result property="contacts"    column="contacts"    />
        <result property="companyProps"    column="company_props"    />
        <result property="businessNo"    column="business_no"    />
    </resultMap>
 
    <sql id="selectFrontUserVo">
        select id, user_name, user_type, email, phone, password, salt, status, is_deleted, avatar, login_ip, create_time, address, 
        company, apply_license,contacts,company_props,business_no from js_front_user
    </sql>
    
    
    <select id="checkLoginNameUnique" parameterType="FrontUser" resultType="int">
         select count(id) from js_front_user where user_name = #{userName}
    </select>
           
    <select id="checkEmailUnique" parameterType="FrontUser" resultType="int">
         select count(id) from js_front_user where email = #{email}
    </select>
         
    <select id="checkPhoneUnique" parameterType="FrontUser" resultType="int">
         select count(id) from js_front_user where phone = #{phone}
    </select>
    
    <select id="checkBusinessNoUnique" parameterType="FrontUser" resultType="int">
         select count(id) from js_front_user where business_no = #{businessNo}
    </select>
    
    
     <select id="selectByUserName" parameterType="FrontUser" resultMap="FrontUserResult">
        <include refid="selectFrontUserVo"/>
        where user_name = #{userName}   
     </select>
 
    <select id="selectFrontUserList" parameterType="FrontUser" resultMap="FrontUserResult">
        <include refid="selectFrontUserVo"/>
        <where>  
            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
            <if test="userType != null  and userType != ''"> and user_type = #{userType}</if>
            <if test="email != null  and email != ''"> and email = #{email}</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="password != null  and password != ''"> and password = #{password}</if>
            <if test="salt != null  and salt != ''"> and salt = #{salt}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="isDeleted != null  and isDeleted != ''"> and is_deleted = #{isDeleted}</if>
            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
            <if test="loginIp != null  and loginIp != ''"> and login_ip = #{loginIp}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="company != null  and company != ''"> and company = #{company}</if>
            <if test="applyLicense != null  and applyLicense != ''"> and apply_license = #{applyLicense}</if>
            <if test="businessNo != null  and businessNo != ''"> and business_no = #{businessNo}</if>
        </where>
    </select>
    
    <select id="selectFrontUserByLoginName" parameterType="FrontUser" resultMap="FrontUserResult">
          <include refid="selectFrontUserVo"/>
           where user_name = #{userName}
    </select>
    
    <select id="selectFrontUserById" parameterType="Long" resultMap="FrontUserResult">
        <include refid="selectFrontUserVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertFrontUser" parameterType="FrontUser" useGeneratedKeys="true" keyProperty="id">
        insert into js_front_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userName != null  and userName != ''">user_name,</if>
            <if test="userType != null  and userType != ''">user_type,</if>
            <if test="email != null  and email != ''">email,</if>
            <if test="phone != null  and phone != ''">phone,</if>
            <if test="password != null  and password != ''">password,</if>
            <if test="salt != null  and salt != ''">salt,</if>
            <if test="status != null  and status != ''">status,</if>
            <if test="isDeleted != null  and isDeleted != ''">is_deleted,</if>
            <if test="avatar != null  and avatar != ''">avatar,</if>
            <if test="loginIp != null  and loginIp != ''">login_ip,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="address != null  and address != ''">address,</if>
            <if test="company != null  and company != ''">company,</if>
            <if test="applyLicense != null  and applyLicense != ''">apply_license,</if>
            <if test="contacts != null  and contacts != ''">contacts,</if>
            <if test="companyProps != null  and companyProps != ''">company_props,</if>
            <if test="businessNo != null  and businessNo != ''">business_no,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userName != null  and userName != ''">#{userName},</if>
            <if test="userType != null  and userType != ''">#{userType},</if>
            <if test="email != null  and email != ''">#{email},</if>
            <if test="phone != null  and phone != ''">#{phone},</if>
            <if test="password != null  and password != ''">#{password},</if>
            <if test="salt != null  and salt != ''">#{salt},</if>
            <if test="status != null  and status != ''">#{status},</if>
            <if test="isDeleted != null  and isDeleted != ''">#{isDeleted},</if>
            <if test="avatar != null  and avatar != ''">#{avatar},</if>
            <if test="loginIp != null  and loginIp != ''">#{loginIp},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="address != null  and address != ''">#{address},</if>
            <if test="company != null  and company != ''">#{company},</if>
            <if test="applyLicense != null  and applyLicense != ''">#{applyLicense},</if>
            <if test="contacts != null  and contacts != ''">#{contacts},</if>
            <if test="companyProps != null  and companyProps != ''">#{companyProps},</if>
            <if test="businessNo != null  and businessNo != ''">#{businessNo},</if>
         </trim>
    </insert>
 
    <update id="updateFrontUser" parameterType="FrontUser">
        update js_front_user
        <trim prefix="SET" suffixOverrides=",">
            <if test="userName != null  and userName != ''">user_name = #{userName},</if>
            <if test="userType != null  and userType != ''">user_type = #{userType},</if>
            <if test="email != null  and email != ''">email = #{email},</if>
            <if test="phone != null  and phone != ''">phone = #{phone},</if>
            <if test="password != null  and password != ''">password = #{password},</if>
            <if test="salt != null  and salt != ''">salt = #{salt},</if>
            <if test="status != null  and status != ''">status = #{status},</if>
            <if test="isDeleted != null  and isDeleted != ''">is_deleted = #{isDeleted},</if>
            <if test="avatar != null  and avatar != ''">avatar = #{avatar},</if>
            <if test="loginIp != null  and loginIp != ''">login_ip = #{loginIp},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="address != null  and address != ''">address = #{address},</if>
            <if test="company != null  and company != ''">company = #{company},</if>
            <if test="applyLicense != null  and applyLicense != ''">apply_license = #{applyLicense},</if>
            <if test="contacts != null  and contacts != ''">contacts = #{contacts},</if>
            <if test="companyProps != null  and companyProps != ''">company_props = #{companyProps},</if>
            <if test="businessNo != null  and businessNo != ''">business_no = #{businessNo},</if>
        </trim>
        where id = #{id}
    </update>
    
    <update id="approve" parameterType="FrontUser">
         update js_front_user set status = '1' where id = #{id}
    </update>
 
    <delete id="deleteFrontUserById" parameterType="Long">
        delete from js_front_user where id = #{id}
    </delete>
 
    <delete id="deleteFrontUserByIds" parameterType="String">
        delete from js_front_user where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>