添加校验部门包含未停用的子部门

This commit is contained in:
RuoYi
2020-05-07 12:15:04 +08:00
parent 2c8365b605
commit 8a9d298ffc
6 changed files with 42 additions and 2 deletions

View File

@ -101,8 +101,17 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门
*
* @param deptId 部门ID
* @return 部门列表
*/
public List<SysDept> selectChildrenDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
}

View File

@ -84,6 +84,14 @@ public interface ISysDeptService
*/
public SysDept selectDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 校验部门名称是否唯一
*

View File

@ -251,6 +251,17 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.selectDeptById(deptId);
}
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId)
{
return deptMapper.selectNormalChildrenDeptById(deptId);
}
/**
* 校验部门名称是否唯一
*

View File

@ -79,6 +79,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>