修复部分bug
This commit is contained in:
parent
5908381c31
commit
07942c6d90
|
|
@ -201,4 +201,30 @@ public class SysDeptController extends BaseController
|
|||
|
||||
return toAjax(deptService.auditDept(deptId, auditStatus, auditOpinion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门状态(禁用/启用)
|
||||
*/
|
||||
@Operation(summary = "修改部门状态", description = "修改部门状态,0 正常,1 停用")
|
||||
@RequiresPermissions("system:dept:edit")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/status/{deptId}")
|
||||
public AjaxResult changeStatus(@PathVariable Long deptId, @RequestBody Map<String, String> params)
|
||||
{
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
String status = params.get("status");
|
||||
|
||||
if (StringUtils.isEmpty(status))
|
||||
{
|
||||
return error("部门状态不能为空");
|
||||
}
|
||||
|
||||
// 校验停用部门是否有未停用的子部门
|
||||
if (UserConstants.DEPT_DISABLE.equals(status) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||
{
|
||||
return error("该部门包含未停用的子部门,不允许停用!");
|
||||
}
|
||||
|
||||
return toAjax(deptService.changeDeptStatus(deptId, status));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,4 +139,13 @@ public interface ISysDeptService
|
|||
* @return 结果
|
||||
*/
|
||||
public int auditDept(Long deptId, String auditStatus, String auditOpinion);
|
||||
|
||||
/**
|
||||
* 修改部门状态(禁用/启用)
|
||||
*
|
||||
* @param deptId 部门 ID
|
||||
* @param status 部门状态(0 正常,1 停用)
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeDeptStatus(Long deptId, String status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,6 +405,27 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
return deptMapper.updateDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门状态(禁用/启用)
|
||||
*
|
||||
* @param deptId 部门 ID
|
||||
* @param status 部门状态(0 正常,1 停用)
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int changeDeptStatus(Long deptId, String status)
|
||||
{
|
||||
// 校验部门是否有数据权限
|
||||
checkDeptDataScope(deptId);
|
||||
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(deptId);
|
||||
dept.setStatus(status);
|
||||
dept.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
||||
return deptMapper.updateDept(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptType != null and deptType != ''">
|
||||
AND d.dept_type = #{deptType}
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
AND d.address like concat('%', #{address}, '%')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by d.parent_id, d.order_num
|
||||
|
|
|
|||
Loading…
Reference in New Issue