This commit is contained in:
ls
2024-10-16 15:30:27 +08:00
parent 35e48104b9
commit 7bb433234f
5 changed files with 827 additions and 786 deletions

View File

@@ -76,7 +76,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param username 用户登录账户 * @param username 用户登录账户
* @return * @return
*/ */
IPage<SysUser> getUserByRoleId(Page page, @Param("roleId") String roleId, @Param("username") String username); IPage<SysUser> getUserByRoleId(Page page, @Param("roleId") String roleId, @Param("username") String username, @Param("roleCode") String roleCode);
/** /**
* 根据用户名设置部门ID * 根据用户名设置部门ID

View File

@@ -14,7 +14,8 @@
<!-- 根据部门Id查询 --> <!-- 根据部门Id查询 -->
<select id="getUserByDepId" resultType="org.jeecg.modules.system.entity.SysUser"> <select id="getUserByDepId" resultType="org.jeecg.modules.system.entity.SysUser">
select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_depart where dep_id=#{departId}) select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_depart where
dep_id=#{departId})
<if test="username!=null and username!=''"> <if test="username!=null and username!=''">
and username = #{username} and username = #{username}
</if> </if>
@@ -25,7 +26,8 @@
<if test="orgCode != null"> <if test="orgCode != null">
<bind name="bindOrgCode" value="orgCode+'%'"/> <bind name="bindOrgCode" value="orgCode+'%'"/>
</if> </if>
select username from sys_user where del_flag = 0 and id in (select user_id from sys_user_depart where dep_id in (select id from sys_depart where org_code LIKE #{bindOrgCode})) select username from sys_user where del_flag = 0 and id in (select user_id from sys_user_depart where dep_id in
(select id from sys_depart where org_code LIKE #{bindOrgCode}))
</select> </select>
<!-- 查询用户的所属部门名称信息 --> <!-- 查询用户的所属部门名称信息 -->
@@ -53,10 +55,18 @@
<!-- 根据角色Id查询 --> <!-- 根据角色Id查询 -->
<select id="getUserByRoleId" resultType="org.jeecg.modules.system.entity.SysUser"> <select id="getUserByRoleId" resultType="org.jeecg.modules.system.entity.SysUser">
select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_role where role_id=#{roleId}) select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_role where 1=1
<if test="username!=null and username!=''"> <if test="roleId!=null and roleId!=''">
and username = #{username} and role_id = #{roleId}
</if> </if>
<if test="roleCode!=null and roleCode!=''">
and role_code = #{roleCode}
</if>
)
<if test="username!=null and username!=''">
and username = #{roleCode}
</if>
</select> </select>
<!-- 修改用户部门code --> <!-- 修改用户部门code -->
@@ -131,7 +141,8 @@
<!-- 查询 getUserByOrgCode 的总数--> <!-- 查询 getUserByOrgCode 的总数-->
<select id="getUserByOrgCodeTotal" resultType="java.lang.Integer"> <select id="getUserByOrgCodeTotal" resultType="java.lang.Integer">
SELECT COUNT(1) <include refid="getUserByOrgCodeFromSql"/> SELECT COUNT(1)
<include refid="getUserByOrgCodeFromSql"/>
</select> </select>
<!-- 批量删除角色的与用户关系--> <!-- 批量删除角色的与用户关系-->
@@ -167,7 +178,7 @@
WHERE WHERE
del_flag = 1 del_flag = 1
AND id IN AND id IN
<foreach collection="userIds" item="userId" open="(" close=")" separator="," > <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId} #{userId}
</foreach> </foreach>
</update> </update>
@@ -175,7 +186,7 @@
<!-- 彻底删除被逻辑删除的用户 --> <!-- 彻底删除被逻辑删除的用户 -->
<delete id="deleteLogicDeleted"> <delete id="deleteLogicDeleted">
DELETE FROM sys_user WHERE del_flag = 1 AND id IN DELETE FROM sys_user WHERE del_flag = 1 AND id IN
<foreach collection="userIds" item="userId" open="(" close=")" separator="," > <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId} #{userId}
</foreach> </foreach>
</delete> </delete>
@@ -277,7 +288,7 @@
WHERE WHERE
del_flag = 1 del_flag = 1
AND id IN AND id IN
<foreach collection="userIds" item="userId" open="(" close=")" separator="," > <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId} #{userId}
</foreach> </foreach>
</update> </update>

View File

@@ -177,7 +177,7 @@ public interface ISysUserService extends IService<SysUser> {
* @param username 用户账户名称 * @param username 用户账户名称
* @return * @return
*/ */
public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username); public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username,String roleCode);
/** /**
* 通过用户名获取用户角色集合 * 通过用户名获取用户角色集合

View File

@@ -551,9 +551,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
* @return * @return
*/ */
@Override @Override
public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username) { public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username,String roleCode) {
//update-begin---author:wangshuai ---date:20230220 for[QQYUN-3980]组织管理中 职位功能 职位表加租户id 加职位-用户关联表------------ //update-begin---author:wangshuai ---date:20230220 for[QQYUN-3980]组织管理中 职位功能 职位表加租户id 加职位-用户关联表------------
IPage<SysUser> userRoleList = userMapper.getUserByRoleId(page, roleId, username); IPage<SysUser> userRoleList = userMapper.getUserByRoleId(page, roleId, username,roleCode);
List<SysUser> records = userRoleList.getRecords(); List<SysUser> records = userRoleList.getRecords();
if (null != records && records.size() > 0) { if (null != records && records.size() > 0) {
List<String> userIds = records.stream().map(SysUser::getId).collect(Collectors.toList()); List<String> userIds = records.stream().map(SysUser::getId).collect(Collectors.toList());