92 lines
4.5 KiB
XML
92 lines
4.5 KiB
XML
<?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.securitycontrol.system.base.mapper.IUserMapper">
|
|
<!--新增/修改用户-->
|
|
<insert id="addOrUpdateUser">
|
|
<if test="type == 1">
|
|
INSERT INTO sys_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userName != null and userName != ''">user_name,</if>
|
|
<if test="loginName != null and loginName!=''">login_name,</if>
|
|
<if test="password != null and password !=''">password,</if>
|
|
<if test="orgId != null and orgId!=''">org_id,</if>
|
|
<if test="deptName != null and deptName != ''">dept_name,</if>
|
|
<if test="orgName != null and orgName != ''">org_name,</if>
|
|
<if test="createTime != null and createTime != ''">create_time,</if>
|
|
<if test="phone != null and phone != ''">phone,</if>
|
|
<if test="loginType != null and loginType != ''">login_type,</if>
|
|
<if test="userType != null">user_type,</if>
|
|
<if test="isAdmin != null and isAdmin != ''">is_admin,</if>
|
|
<if test="roleId != null and roleId != ''">role_id,</if>
|
|
<if test="accountStatus != null">status,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userName != null and userName != ''">#{userName},</if>
|
|
<if test="loginName != null and loginName!=''">#{loginName},</if>
|
|
<if test="password != null and password !=''">#{password},</if>
|
|
<if test="orgId != null and orgId!=''">#{orgId},</if>
|
|
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
|
<if test="orgName != null and orgName != ''">#{orgName},</if>
|
|
<if test="createTime != null and createTime != ''">#{createTime},</if>
|
|
<if test="phone != null and phone != ''">#{phone},</if>
|
|
<if test="loginType != null and loginType != ''">#{loginType},</if>
|
|
<if test="userType != null">#{userType},</if>
|
|
<if test="isAdmin != null and isAdmin != ''">#{isAdmin},</if>
|
|
<if test="roleId != null and roleId != ''">#{roleId},</if>
|
|
<if test="accountStatus != null">#{accountStatus},</if>
|
|
</trim>
|
|
</if>
|
|
<if test="type == 2">
|
|
UPDATE sys_user
|
|
<set>
|
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
<if test="orgId != null and orgId != ''">org_id = #{orgId},</if>
|
|
<if test="orgName != null and orgName != ''">org_name = #{orgName},</if>
|
|
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
|
</set>
|
|
WHERE user_id = #{userId}
|
|
</if>
|
|
</insert>
|
|
<!--删除用户-->
|
|
<update id="delUser">
|
|
UPDATE sys_user SET del_flag = '1' WHERE user_id = #{userId}
|
|
</update>
|
|
|
|
<!--获取用户列表-->
|
|
<select id="getUserLists" resultType="com.securitycontrol.entity.system.vo.UserVo">
|
|
SELECT su.user_id AS userId,
|
|
su.user_name AS userName,
|
|
su.login_name AS loginName,
|
|
su.del_flag AS delFlag,
|
|
su.phone,
|
|
su.del_flag AS delFlag
|
|
FROM sys_user su
|
|
<where>
|
|
<if test="userName!=null and userName!=''">
|
|
INSTR(su.user_name,#{userName}) > 0
|
|
</if>
|
|
<if test="loginName!=null and loginName!=''">
|
|
AND INSTR(su.login_name,#{loginName}) > 0
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
AND INSTR(su.phone,#{phone}) > 0
|
|
</if>
|
|
</where>
|
|
ORDER BY su.update_time ASC,su.del_flag ASC
|
|
</select>
|
|
<!--用户详情-->
|
|
<select id="getUserById" resultType="com.securitycontrol.entity.system.vo.UserVo">
|
|
SELECT su.user_id AS userId,
|
|
su.user_name AS userName,
|
|
su.login_name AS loginName,
|
|
su.del_flag AS delFlag,
|
|
su.phone,
|
|
su.org_id AS orgId,
|
|
su.login_type AS loginType,
|
|
su.user_type AS userType,
|
|
su.role_id AS roleId,
|
|
su.status AS accountStatus
|
|
FROM sys_user su
|
|
WHERE user_id = #{userId}
|
|
</select>
|
|
</mapper> |