2024-12-19 15:10:29 +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.bonus.material.user.mapper.UserMapper">
|
|
|
|
|
<update id="editUser">
|
|
|
|
|
update sys_user
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="phoneNumber != null and phoneNumber != ''">phonenumber = #{phoneNumber},</if>
|
|
|
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where user_id = #{userId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getUserById" resultType="com.bonus.material.user.entity.UserDto">
|
2025-02-14 09:24:40 +08:00
|
|
|
SELECT
|
|
|
|
|
su.*,
|
|
|
|
|
SUM(
|
|
|
|
|
IF
|
|
|
|
|
( is_read = 0, 1, 0 )) AS msgNum
|
|
|
|
|
FROM
|
|
|
|
|
sys_user su
|
|
|
|
|
LEFT JOIN bm_message bm ON su.user_id = bm.to_user
|
|
|
|
|
WHERE
|
|
|
|
|
su.user_id =#{userId}
|
2024-12-19 15:10:29 +08:00
|
|
|
</select>
|
2025-03-17 18:12:21 +08:00
|
|
|
<select id="selectDeptList" resultType="com.bonus.common.biz.domain.SysDept">
|
|
|
|
|
select d.dept_id,
|
|
|
|
|
d.parent_id,
|
|
|
|
|
d.ancestors,
|
|
|
|
|
d.dept_name,
|
|
|
|
|
d.order_num,
|
|
|
|
|
d.leader,
|
|
|
|
|
d.phone,
|
|
|
|
|
d.status,
|
|
|
|
|
d.del_flag,
|
|
|
|
|
d.create_by,
|
|
|
|
|
d.create_time
|
|
|
|
|
from sys_dept d
|
|
|
|
|
where d.del_flag = '0'
|
|
|
|
|
<if test="companyId != null and companyId != 0">
|
|
|
|
|
AND (find_in_set(#{companyId}, ancestors) or dept_id = #{companyId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deptId != null and deptId != 0">
|
|
|
|
|
AND dept_id = #{deptId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentId != null and parentId != 0">
|
|
|
|
|
AND parent_id = #{parentId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
|
|
AND dept_name like concat('%', #{deptName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
AND status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
order by d.parent_id, d.order_num
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectRoleList" resultType="com.bonus.system.api.domain.SysRole">
|
|
|
|
|
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
|
|
|
|
r.company_id, r.status, r.del_flag, r.create_time, r.remark, r.is_built_in
|
|
|
|
|
from sys_role r
|
|
|
|
|
left join sys_user_role ur on ur.role_id = r.role_id
|
|
|
|
|
left join sys_user u on u.user_id = ur.user_id
|
|
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
|
|
where r.del_flag = '0'
|
|
|
|
|
<if test="roleId != null and roleId != 0">
|
|
|
|
|
AND r.role_id = #{roleId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="roleName != null and roleName != ''">
|
|
|
|
|
AND r.role_name like concat('%', #{roleName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
AND r.company_id = #{companyId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
AND r.status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="roleKey != null and roleKey != ''">
|
|
|
|
|
AND r.role_key like concat('%', #{roleKey}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
|
and date_format(r.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
|
and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
|
|
|
</if>
|
|
|
|
|
order by r.role_sort
|
|
|
|
|
</select>
|
2025-02-14 09:24:40 +08:00
|
|
|
</mapper>
|