2025-12-02 13:21:18 +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="org.xyzh.system.mapper.user.TbSysUserInfoMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 结果映射 -->
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.sys.TbSysUserInfoDTO">
|
|
|
|
|
|
<!-- 用户信息字段 -->
|
|
|
|
|
|
<id column="user_id" property="userId" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="avatar" property="avatar" jdbcType="VARCHAR"/>
|
2025-12-02 16:13:28 +08:00
|
|
|
|
<result column="gender" property="gender" jdbcType="Integer"/>
|
2025-12-02 13:21:18 +08:00
|
|
|
|
<result column="family_name" property="familyName" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="given_name" property="givenName" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="full_name" property="fullName" jdbcType="VARCHAR"/>
|
2025-12-02 16:13:28 +08:00
|
|
|
|
<result column="level" property="level" jdbcType="Integer"/>
|
2025-12-02 13:21:18 +08:00
|
|
|
|
<result column="id_card" property="idCard" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="address" property="address" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<!-- 基础字段 -->
|
|
|
|
|
|
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="dept_path" property="deptPath" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="create_time" property="createTime" jdbcType="DATE"/>
|
|
|
|
|
|
<result column="update_time" property="updateTime" jdbcType="DATE"/>
|
|
|
|
|
|
<result column="delete_time" property="deleteTime" jdbcType="DATE"/>
|
2025-12-02 16:13:28 +08:00
|
|
|
|
<result column="deleted" property="deleted" jdbcType="Boolean"/>
|
2025-12-02 13:21:18 +08:00
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 基础列 -->
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
|
user_id, avatar, gender, family_name, given_name, full_name, level, id_card, address,
|
|
|
|
|
|
optsn, creator, updater, dept_path, remark, create_time, update_time, delete_time, deleted
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 插入系统用户信息(按表字段 + 默认值动态列,仅修改 insert) -->
|
|
|
|
|
|
<insert id="insertUserInfo" parameterType="org.xyzh.common.dto.sys.TbSysUserInfoDTO">
|
|
|
|
|
|
INSERT INTO sys.tb_sys_user_info
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<!-- 必填字段(NOT NULL 且无默认值):optsn, user_id -->
|
|
|
|
|
|
optsn,
|
|
|
|
|
|
user_id,
|
|
|
|
|
|
<!-- 可空/有默认值字段:按是否有入参动态拼接 -->
|
|
|
|
|
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
|
|
|
|
|
<if test="gender != null">gender,</if>
|
|
|
|
|
|
<if test="familyName != null and familyName != ''">family_name,</if>
|
|
|
|
|
|
<if test="givenName != null and givenName != ''">given_name,</if>
|
|
|
|
|
|
<if test="fullName != null and fullName != ''">full_name,</if>
|
|
|
|
|
|
<if test="level != null">level,</if>
|
|
|
|
|
|
<if test="idCard != null and idCard != ''">id_card,</if>
|
|
|
|
|
|
<if test="address != null and address != ''">address,</if>
|
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
|
<if test="deleteTime != null">delete_time,</if>
|
|
|
|
|
|
<if test="deleted != null">deleted,</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
VALUES
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<!-- 必填字段对应的值 -->
|
|
|
|
|
|
#{optsn},
|
|
|
|
|
|
#{userId},
|
|
|
|
|
|
<!-- 可空/有默认值字段对应的值 -->
|
|
|
|
|
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
|
|
|
|
|
<if test="gender != null">#{gender},</if>
|
|
|
|
|
|
<if test="familyName != null and familyName != ''">#{familyName},</if>
|
|
|
|
|
|
<if test="givenName != null and givenName != ''">#{givenName},</if>
|
|
|
|
|
|
<if test="fullName != null and fullName != ''">#{fullName},</if>
|
|
|
|
|
|
<if test="level != null">#{level},</if>
|
|
|
|
|
|
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
|
|
|
|
|
<if test="address != null and address != ''">#{address},</if>
|
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
|
<if test="deleteTime != null">#{deleteTime},</if>
|
|
|
|
|
|
<if test="deleted != null">#{deleted},</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 更新系统用户信息 -->
|
|
|
|
|
|
<update id="updateUserInfo" parameterType="org.xyzh.common.dto.sys.TbSysUserInfoDTO">
|
|
|
|
|
|
UPDATE sys.tb_sys_user_info
|
|
|
|
|
|
<set>
|
|
|
|
|
|
<if test="avatar != null">
|
|
|
|
|
|
avatar = #{avatar},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="gender != null">
|
|
|
|
|
|
gender = #{gender},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="familyName != null">
|
|
|
|
|
|
family_name = #{familyName},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="givenName != null">
|
|
|
|
|
|
given_name = #{givenName},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="fullName != null">
|
|
|
|
|
|
full_name = #{fullName},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="level != null">
|
|
|
|
|
|
level = #{level},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="idCard != null">
|
|
|
|
|
|
id_card = #{idCard},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="address != null">
|
|
|
|
|
|
address = #{address},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updater != null and updater != ''">
|
|
|
|
|
|
updater = #{updater},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="deptPath != null and deptPath != ''">
|
|
|
|
|
|
dept_path = #{deptPath},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="remark != null">
|
|
|
|
|
|
remark = #{remark},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
|
update_time = #{updateTime},
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</set>
|
|
|
|
|
|
WHERE user_id = #{userId}
|
|
|
|
|
|
<if test="deleted != null">
|
|
|
|
|
|
AND deleted = #{deleted}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 删除系统用户信息 -->
|
|
|
|
|
|
<update id="deleteUserInfo" parameterType="org.xyzh.common.dto.sys.TbSysUserInfoDTO">
|
|
|
|
|
|
UPDATE sys.tb_sys_user_info
|
|
|
|
|
|
SET deleted = true,
|
|
|
|
|
|
delete_time = NOW()
|
|
|
|
|
|
WHERE user_id = #{userId}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据用户ID查询系统用户信息 -->
|
|
|
|
|
|
<select id="getUserInfoById" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
|
FROM sys.tb_sys_user_info
|
|
|
|
|
|
WHERE user_id = #{userId}
|
|
|
|
|
|
AND (deleted IS NULL OR deleted = false)
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据条件查询系统用户信息列表 -->
|
|
|
|
|
|
<select id="getUserInfoByFilter" resultMap="BaseResultMap" parameterType="org.xyzh.common.dto.sys.TbSysUserInfoDTO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
|
FROM sys.tb_sys_user_info
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="filter.userId != null and filter.userId != ''">
|
|
|
|
|
|
AND user_id = #{filter.userId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.fullName != null and filter.fullName != ''">
|
|
|
|
|
|
AND full_name LIKE CONCAT('%', #{filter.fullName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.familyName != null and filter.familyName != ''">
|
|
|
|
|
|
AND family_name LIKE CONCAT('%', #{filter.familyName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.givenName != null and filter.givenName != ''">
|
|
|
|
|
|
AND given_name LIKE CONCAT('%', #{filter.givenName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.idCard != null and filter.idCard != ''">
|
|
|
|
|
|
AND id_card = #{filter.idCard}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.gender != null">
|
|
|
|
|
|
AND gender = #{filter.gender}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.deptPath != null and filter.deptPath != ''">
|
|
|
|
|
|
AND dept_path LIKE CONCAT(#{filter.deptPath}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
AND (deleted IS NULL OR deleted = false)
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据条件查询系统用户信息分页列表 -->
|
|
|
|
|
|
<select id="getUserInfoPageByFilter" resultMap="BaseResultMap">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
|
FROM sys.tb_sys_user_info
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="filter.userId != null and filter.userId != ''">
|
|
|
|
|
|
AND user_id = #{filter.userId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.fullName != null and filter.fullName != ''">
|
|
|
|
|
|
AND full_name LIKE CONCAT('%', #{filter.fullName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.familyName != null and filter.familyName != ''">
|
|
|
|
|
|
AND family_name LIKE CONCAT('%', #{filter.familyName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.givenName != null and filter.givenName != ''">
|
|
|
|
|
|
AND given_name LIKE CONCAT('%', #{filter.givenName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.idCard != null and filter.idCard != ''">
|
|
|
|
|
|
AND id_card = #{filter.idCard}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.gender != null">
|
|
|
|
|
|
AND gender = #{filter.gender}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.deptPath != null and filter.deptPath != ''">
|
|
|
|
|
|
AND dept_path LIKE CONCAT(#{filter.deptPath}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
AND (deleted IS NULL OR deleted = false)
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
|
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据条件查询系统用户信息数量 -->
|
2025-12-02 16:13:28 +08:00
|
|
|
|
<select id="getUserInfoCount" resultType="java.lang.Integer" parameterType="org.xyzh.common.dto.sys.TbSysUserInfoDTO">
|
2025-12-02 13:21:18 +08:00
|
|
|
|
SELECT COUNT(1)
|
|
|
|
|
|
FROM sys.tb_sys_user_info
|
|
|
|
|
|
<where>
|
|
|
|
|
|
<if test="filter.userId != null and filter.userId != ''">
|
|
|
|
|
|
AND user_id = #{filter.userId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.fullName != null and filter.fullName != ''">
|
|
|
|
|
|
AND full_name LIKE CONCAT('%', #{filter.fullName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.familyName != null and filter.familyName != ''">
|
|
|
|
|
|
AND family_name LIKE CONCAT('%', #{filter.familyName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.givenName != null and filter.givenName != ''">
|
|
|
|
|
|
AND given_name LIKE CONCAT('%', #{filter.givenName}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.idCard != null and filter.idCard != ''">
|
|
|
|
|
|
AND id_card = #{filter.idCard}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.gender != null">
|
|
|
|
|
|
AND gender = #{filter.gender}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="filter.deptPath != null and filter.deptPath != ''">
|
|
|
|
|
|
AND dept_path LIKE CONCAT(#{filter.deptPath}, '%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
AND (deleted IS NULL OR deleted = false)
|
|
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|
|
|