|
@@ -0,0 +1,157 @@
|
|
|
+<?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.ruoyi.system.mapper.PoUserMapper">
|
|
|
+
|
|
|
+ <resultMap type="PoUser" id="PoUserResult">
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="deptId" column="dept_id" />
|
|
|
+ <result property="userName" column="user_name" />
|
|
|
+ <result property="nickName" column="nick_name" />
|
|
|
+ <result property="userType" column="user_type" />
|
|
|
+ <result property="email" column="email" />
|
|
|
+ <result property="phonenumber" column="phonenumber" />
|
|
|
+ <result property="sex" column="sex" />
|
|
|
+ <result property="avatar" column="avatar" />
|
|
|
+ <result property="password" column="password" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="loginIp" column="login_ip" />
|
|
|
+ <result property="loginDate" column="login_date" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectPoUserVo">
|
|
|
+ select user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark from po_user
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectPoUserList" parameterType="PoUser" resultMap="PoUserResult">
|
|
|
+ <include refid="selectPoUserVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
|
+ <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
+ <if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
|
|
|
+ <if test="userType != null and userType != ''"> and user_type = #{userType}</if>
|
|
|
+ <if test="email != null and email != ''"> and email = #{email}</if>
|
|
|
+ <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
|
|
|
+ <if test="sex != null and sex != ''"> and sex = #{sex}</if>
|
|
|
+ <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
|
|
|
+ <if test="password != null and password != ''"> and password = #{password}</if>
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
+ <if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
|
|
|
+ <if test="loginDate != null "> and login_date = #{loginDate}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- 通过Id查询-->
|
|
|
+ <select id="selectPoUserByUserId" parameterType="String" resultMap="PoUserResult">
|
|
|
+ <include refid="selectPoUserVo"/>
|
|
|
+ where user_id = #{userId}
|
|
|
+ </select>
|
|
|
+<!-- 校验用户名-->
|
|
|
+ <select id="checkUserNameUnique" parameterType="String" resultMap="PoUserResult">
|
|
|
+ select user_id, user_name from po_user where user_name = #{userName} and del_flag = '0' limit 1
|
|
|
+ </select>
|
|
|
+<!--校验手机号-->
|
|
|
+ <select id="checkPhoneUnique" parameterType="String" resultMap="PoUserResult">
|
|
|
+ select user_id, phonenumber from po_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
|
|
+ </select>
|
|
|
+<!--校验email-->
|
|
|
+ <select id="checkEmailUnique" parameterType="String" resultMap="PoUserResult">
|
|
|
+ select user_id, email from po_user where email = #{email} and del_flag = '0' limit 1
|
|
|
+ </select>
|
|
|
+<!-- 通过手机号查询-->
|
|
|
+ <select id="selectUserByUserPhoneNumber" parameterType="String" resultMap="PoUserResult">
|
|
|
+ <include refid="selectPoUserVo"></include>
|
|
|
+ where phonenumber = #{phonenumber} and del_flag = '0'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertPoUser" parameterType="PoUser">
|
|
|
+ insert into po_user
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="deptId != null">dept_id,</if>
|
|
|
+ <if test="userName != null and userName != ''">user_name,</if>
|
|
|
+ <if test="nickName != null and nickName != ''">nick_name,</if>
|
|
|
+ <if test="userType != null">user_type,</if>
|
|
|
+ <if test="email != null">email,</if>
|
|
|
+ <if test="phonenumber != null">phonenumber,</if>
|
|
|
+ <if test="sex != null">sex,</if>
|
|
|
+ <if test="avatar != null">avatar,</if>
|
|
|
+ <if test="password != null">password,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="loginIp != null">login_ip,</if>
|
|
|
+ <if test="loginDate != null">login_date,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="deptId != null">#{deptId},</if>
|
|
|
+ <if test="userName != null and userName != ''">#{userName},</if>
|
|
|
+ <if test="nickName != null and nickName != ''">#{nickName},</if>
|
|
|
+ <if test="userType != null">#{userType},</if>
|
|
|
+ <if test="email != null">#{email},</if>
|
|
|
+ <if test="phonenumber != null">#{phonenumber},</if>
|
|
|
+ <if test="sex != null">#{sex},</if>
|
|
|
+ <if test="avatar != null">#{avatar},</if>
|
|
|
+ <if test="password != null">#{password},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="loginIp != null">#{loginIp},</if>
|
|
|
+ <if test="loginDate != null">#{loginDate},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updatePoUser" parameterType="PoUser">
|
|
|
+ update po_user
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
+ <if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
|
+ <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
|
|
+ <if test="userType != null">user_type = #{userType},</if>
|
|
|
+ <if test="email != null">email = #{email},</if>
|
|
|
+ <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
|
|
|
+ <if test="sex != null">sex = #{sex},</if>
|
|
|
+ <if test="avatar != null">avatar = #{avatar},</if>
|
|
|
+ <if test="password != null">password = #{password},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ <if test="loginIp != null">login_ip = #{loginIp},</if>
|
|
|
+ <if test="loginDate != null">login_date = #{loginDate},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where user_id = #{userId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deletePoUserByUserId" parameterType="String">
|
|
|
+ delete from po_user where user_id = #{userId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deletePoUserByUserIds" parameterType="String">
|
|
|
+ delete from po_user where user_id in
|
|
|
+ <foreach item="userId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|
|
|
+
|