|
|
@@ -302,11 +302,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<select id="selectName" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
|
|
- select user_id userId, user_name userName,nick_name nickName
|
|
|
- from sys_user
|
|
|
- where user_id >1 and nick_name like concat('%',#{name},'%')
|
|
|
+ select a.user_id userId, a.user_name userName,a.nick_name nickName
|
|
|
+ from sys_user a
|
|
|
+ where a.user_id >1 and a.nick_name like concat('%',#{name},'%')
|
|
|
<if test="roleId!=null">
|
|
|
- and user_id in (select user_id from sys_user_role where role_id = #{roleId})
|
|
|
+ and a.user_id in (select user_id from sys_user_role where role_id = #{roleId})
|
|
|
+ </if>
|
|
|
+ <if test="companyId !=null and companyId != 0">
|
|
|
+ AND (a.dept_id = #{companyId} OR a.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{companyId}, ancestors) ))
|
|
|
</if>
|
|
|
</select>
|
|
|
|