|
|
@@ -0,0 +1,191 @@
|
|
|
+<?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.dromara.business.mapper.UserMapper">
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectVoPage" resultType="org.dromara.business.domain.vo.UserVo">
|
|
|
+ SELECT id,
|
|
|
+ login_name,
|
|
|
+ login_pass,
|
|
|
+ phone,
|
|
|
+ create_at,
|
|
|
+ update_at,
|
|
|
+ sex,
|
|
|
+ email,
|
|
|
+ nick_name,
|
|
|
+ remark,
|
|
|
+ captcha,
|
|
|
+ avatar,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ area,
|
|
|
+ place_detail,
|
|
|
+ register_ip,
|
|
|
+ register_device,
|
|
|
+ status,
|
|
|
+ is_locked,
|
|
|
+ last_login_time,
|
|
|
+ last_login_ip,
|
|
|
+ del_flag
|
|
|
+ FROM user ${ew.customSqlSegment}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectUserList" resultType="org.dromara.business.domain.vo.UserVo">
|
|
|
+ SELECT id,
|
|
|
+ login_name,
|
|
|
+ login_pass,
|
|
|
+ phone,
|
|
|
+ create_at,
|
|
|
+ update_at,
|
|
|
+ sex,
|
|
|
+ email,
|
|
|
+ nick_name,
|
|
|
+ remark,
|
|
|
+ captcha,
|
|
|
+ avatar,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ area,
|
|
|
+ place_detail,
|
|
|
+ register_ip,
|
|
|
+ register_device,
|
|
|
+ status,
|
|
|
+ is_locked,
|
|
|
+ last_login_time,
|
|
|
+ last_login_ip,
|
|
|
+ del_flag FROM user ${ew.customSqlSegment}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectVoByIdInfo" resultType="org.dromara.business.domain.vo.UserVo">
|
|
|
+ SELECT id,
|
|
|
+ login_name,
|
|
|
+ login_pass,
|
|
|
+ phone,
|
|
|
+ create_at,
|
|
|
+ update_at,
|
|
|
+ sex,
|
|
|
+ email,
|
|
|
+ nick_name,
|
|
|
+ remark,
|
|
|
+ captcha,
|
|
|
+ avatar,
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ area,
|
|
|
+ place_detail,
|
|
|
+ register_ip,
|
|
|
+ register_device,
|
|
|
+ status,
|
|
|
+ is_locked,
|
|
|
+ last_login_time,
|
|
|
+ last_login_ip,
|
|
|
+ del_flag FROM user WHERE id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateUserById">
|
|
|
+ UPDATE user
|
|
|
+ <set>
|
|
|
+ <if test="loginName != null">login_name = #{loginName},</if>
|
|
|
+ <if test="loginPass != null">login_pass = #{loginPass},</if>
|
|
|
+ <if test="phone != null">phone = #{phone},</if>
|
|
|
+ <if test="updateAt != null">update_at = #{updateAt},</if>
|
|
|
+ <if test="sex != null">sex = #{sex},</if>
|
|
|
+ <if test="email != null">email = #{email},</if>
|
|
|
+ <if test="nickName != null">nick_name = #{nickName},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="captcha != null">captcha = #{captcha},</if>
|
|
|
+ <if test="avatar != null">avatar = #{avatar},</if>
|
|
|
+ <if test="province != null">province = #{province},</if>
|
|
|
+ <if test="city != null">city = #{city},</if>
|
|
|
+ <if test="area != null">area = #{area},</if>
|
|
|
+ <if test="placeDetail != null">place_detail = #{placeDetail},</if>
|
|
|
+ <if test="registerIp != null">register_ip = #{registerIp},</if>
|
|
|
+ <if test="registerDevice != null">register_device = #{registerDevice},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="isLocked != null">is_locked = #{isLocked},</if>
|
|
|
+ <if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
|
|
|
+ <if test="lastLoginIp != null">last_login_ip = #{lastLoginIp},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ </set>
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertUser" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO user
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="loginName != null">login_name,</if>
|
|
|
+ <if test="loginPass != null">login_pass,</if>
|
|
|
+ <if test="phone != null">phone,</if>
|
|
|
+ <if test="createAt != null">create_at,</if>
|
|
|
+ <if test="updateAt != null">update_at,</if>
|
|
|
+ <if test="sex != null">sex,</if>
|
|
|
+ <if test="email != null">email,</if>
|
|
|
+ <if test="nickName != null">nick_name,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="captcha != null">captcha,</if>
|
|
|
+ <if test="avatar != null">avatar,</if>
|
|
|
+ <if test="province != null">province,</if>
|
|
|
+ <if test="city != null">city,</if>
|
|
|
+ <if test="area != null">area,</if>
|
|
|
+ <if test="placeDetail != null">place_detail,</if>
|
|
|
+ <if test="registerIp != null">register_ip,</if>
|
|
|
+ <if test="registerDevice != null">register_device,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="isLocked != null">is_locked,</if>
|
|
|
+ <if test="lastLoginTime != null">last_login_time,</if>
|
|
|
+ <if test="lastLoginIp != null">last_login_ip,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ </trim>
|
|
|
+ VALUES
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="loginName != null">#{loginName},</if>
|
|
|
+ <if test="loginPass != null">#{loginPass},</if>
|
|
|
+ <if test="phone != null">#{phone},</if>
|
|
|
+ <if test="createAt != null">#{createAt},</if>
|
|
|
+ <if test="updateAt != null">#{updateAt},</if>
|
|
|
+ <if test="sex != null">#{sex},</if>
|
|
|
+ <if test="email != null">#{email},</if>
|
|
|
+ <if test="nickName != null">#{nickName},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="captcha != null">#{captcha},</if>
|
|
|
+ <if test="avatar != null">#{avatar},</if>
|
|
|
+ <if test="province != null">#{province},</if>
|
|
|
+ <if test="city != null">#{city},</if>
|
|
|
+ <if test="area != null">#{area},</if>
|
|
|
+ <if test="placeDetail != null">#{placeDetail},</if>
|
|
|
+ <if test="registerIp != null">#{registerIp},</if>
|
|
|
+ <if test="registerDevice != null">#{registerDevice},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="isLocked != null">#{isLocked},</if>
|
|
|
+ <if test="lastLoginTime != null">#{lastLoginTime},</if>
|
|
|
+ <if test="lastLoginIp != null">#{lastLoginIp},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
+ <update id="deleteByUserById">
|
|
|
+ <choose>
|
|
|
+ <!-- 如果 ids 不为空,并且每个 id > 0 -->
|
|
|
+ <when test="ids != null and ids.size() > 0">
|
|
|
+ UPDATE user
|
|
|
+ SET del_flag = 1
|
|
|
+ WHERE id IN
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ <!-- 否则不执行任何操作 -->
|
|
|
+ <otherwise>
|
|
|
+ SELECT 1 FROM DUAL WHERE 1 = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|