263 lines
10 KiB
XML
Raw Normal View History

2021-07-19 18:38:42 +08:00
<?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.xhpc.user.mapper.XhpcUserMapper">
<resultMap type="com.ruoyi.system.api.domain.SysUser" id="XhpcUserResult">
<result column="user_id" property="userId"/>
<result column="dept_id" property="deptId"/>
<result column="user_name" property="userName"/>
<result column="nick_name" property="nickName"/>
<result column="email" property="email"/>
<result column="phonenumber" property="phonenumber"/>
<result column="operator_id" property="operatorId"/>
<result column="sex" property="sex"/>
<result column="avatar" property="avatar"/>
<result column="password" property="password"/>
<result column="data_power_type" property="dataPowerType"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="login_ip" property="loginIp"/>
<result column="login_date" property="loginDate"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
</resultMap>
<insert id="insert" parameterType="com.ruoyi.system.api.domain.SysUser">
insert into sys_user(
<if test="null != userId and '' != userId">
user_id,
</if>
<if test="null != deptId and '' != deptId">
dept_id,
</if>
<if test="null != userName and '' != userName">
user_name,
</if>
<if test="null != nickName and '' != nickName">
nick_name,
</if>
<if test="null != userType and '' != userType">
user_type,
</if>
<if test="null != email and '' != email">
email,
</if>
<if test="null != phonenumber and '' != phonenumber">
phonenumber,
</if>
<if test="null != operatorId and '' != operatorId">
operator_id,
</if>
<if test="null != sex and '' != sex">
sex,
</if>
<if test="null != avatar and '' != avatar">
avatar,
</if>
<if test="null != password and '' != password">
password,
</if>
<if test="null != dataPowerType and '' != dataPowerType">
data_power_type,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != loginIp and '' != loginIp">
login_ip,
</if>
<if test="null != loginDate and '' != loginDate">
login_date,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != createTime and '' != createTime">
create_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != updateTime and '' != updateTime">
update_time,
</if>
<if test="null != remark and '' != remark">
remark
</if>
)values(
<if test="null != userId and '' != userId">
#{userId},
</if>
<if test="null != deptId and '' != deptId">
#{deptId},
</if>
<if test="null != userName and '' != userName">
#{userName},
</if>
<if test="null != nickName and '' != nickName">
#{nickName},
</if>
<if test="null != userType and '' != userType">
#{userType},
</if>
<if test="null != email and '' != email">
#{email},
</if>
<if test="null != phonenumber and '' != phonenumber">
#{phonenumber},
</if>
<if test="null != operatorId and '' != operatorId">
#{operatorId},
</if>
<if test="null != sex and '' != sex">
#{sex},
</if>
<if test="null != avatar and '' != avatar">
#{avatar},
</if>
<if test="null != password and '' != password">
#{password},
</if>
<if test="null != dataPowerType and '' != dataPowerType">
#{dataPowerType},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != loginIp and '' != loginIp">
#{loginIp},
</if>
<if test="null != loginDate and '' != loginDate">
#{loginDate},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != createTime and '' != createTime">
#{createTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != updateTime and '' != updateTime">
#{updateTime},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</insert>
<update id="update" parameterType="com.ruoyi.system.api.domain.SysUser">
UPDATE sys_user
<set>
<if test="null != deptId and '' != deptId">dept_id = #{deptId},</if>
<if test="null != userName and '' != userName">user_name = #{userName},</if>
<if test="null != nickName and '' != nickName">nick_name = #{nickName},</if>
<if test="null != userType and '' != userType">user_type = #{userType},</if>
<if test="null != email and '' != email">email = #{email},</if>
<if test="null != phonenumber and '' != phonenumber">phonenumber = #{phonenumber},</if>
<if test="null != operatorId and '' != operatorId">operator_id = #{operatorId},</if>
<if test="null != sex and '' != sex">sex = #{sex},</if>
<if test="null != avatar and '' != avatar">avatar = #{avatar},</if>
<if test="null != password and '' != password">password = #{password},</if>
<if test="null != dataPowerType and '' != dataPowerType">data_power_type = #{dataPowerType},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != loginIp and '' != loginIp">login_ip = #{loginIp},</if>
<if test="null != loginDate and '' != loginDate">login_date = #{loginDate},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE user_id = #{userId}
</update>
<delete id="deleteByIds" parameterType="java.lang.Long">
delete from sys_user where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<select id="selectUserByUserId" parameterType="java.lang.Long" resultType="com.ruoyi.system.api.domain.SysUser">
select *
from sys_user
where user_id = #{userId}
</select>
<select id="selectPcUserList" parameterType="java.lang.String" resultType="java.util.Map">
select user_id userId,user_name userName,
nick_name nickName, email,
create_by createBy ,create_time createTime
from sys_user
WHERE del_flag = 0
<if test="userName != null and userName != ''">
and user_name like concat(concat('%', #{userName}), '%')
</if>
<if test="nickName != null and nickName != ''">
and nick_name like concat(concat('%', #{nickName}), '%')
</if>
</select>
<select id="pcInfo" parameterType="java.lang.Long" resultType="java.util.Map">
select su.user_id userId,su.user_name userName,
su.nick_name nickName, su.email,
su.create_by createBy ,su.create_time createTime,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName,
sdd.dict_label sexName
from sys_user su
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex
WHERE su.del_flag = 0 and user_id = #{userId}
</select>
<select id="selectOperatorUserList" parameterType="java.lang.String" resultType="java.util.Map">
select su.user_id userId,su.user_name userName,
su.nick_name nickName, su.email,
su.create_by createBy ,su.create_time createTime,
xo.`name` operatorName,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName
from sys_user su
LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id
WHERE del_flag = 0
<if test="userName != null and userName != ''">
and user_name like concat(concat('%', #{userName}), '%')
</if>
<if test="nickName != null and nickName != ''">
and nick_name like concat(concat('%', #{nickName}), '%')
</if>
<if test="operatorId != null and operatorId != ''">
and operator_id = #{operatorId}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
</select>
<select id="operatorInfo" parameterType="java.lang.Long" resultType="java.util.Map">
select su.user_id userId,su.user_name userName,
su.nick_name nickName, su.email,
su.create_by createBy ,su.create_time createTime,
xo.`name` operatorName,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName,
sdd.dict_label sexName
from sys_user su
LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex
WHERE su.del_flag = 0 and user_id = #{userId}
</select>
</mapper>