组织人员树修改

This commit is contained in:
mashuai 2024-10-24 15:31:46 +08:00
parent daa8776312
commit b555eb2773
3 changed files with 35 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.system.mapper;
import java.util.List; import java.util.List;
import com.bonus.system.api.domain.SysDept;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.bonus.system.api.domain.SysUser; import com.bonus.system.api.domain.SysUser;
@ -135,4 +136,11 @@ public interface SysUserMapper {
public SysUser checkEmailUnique(String email); public SysUser checkEmailUnique(String email);
Integer approvalStatus(Long userId); Integer approvalStatus(Long userId);
/**
* 组织人员树
* @param dept
* @return
*/
List<SysDept> getTree(SysDept dept);
} }

View File

@ -84,6 +84,10 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override @Override
public List<TreeSelect> selectDeptUserTreeList(SysDept dept) public List<TreeSelect> selectDeptUserTreeList(SysDept dept)
{ {
if (dept != null && dept.getDeptId() != null && dept.getDeptId() == 0L) {
List<SysDept> userList = userMapper.getTree(dept);
return buildDeptTreeSelect(userList);
}
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept); List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
for (SysDept sysDept : depts) { for (SysDept sysDept : depts) {
SysUser paramUser = new SysUser(); SysUser paramUser = new SysUser();

View File

@ -206,6 +206,29 @@
and del_flag = '0' limit 1 and del_flag = '0' limit 1
</select> </select>
<select id="getTree" resultType="com.bonus.system.api.domain.SysDept">
SELECT
*
FROM
(
SELECT
d.dept_id AS deptId,
d.parent_id AS parentId,
d.dept_name AS deptName
FROM sys_dept d
WHERE d.del_flag = '0'
AND d.STATUS = '0'
UNION
SELECT
su.user_id AS deptId,
su.dept_id AS parentId,
su.nick_name AS deptName
FROM sys_user su
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
WHERE su.del_flag = '0'
) AS combined_results
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user( insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if> <if test="userId != null and userId != 0">user_id,</if>