|
|
@ -3,6 +3,7 @@ package com.wayn.admin.api.controller.system;
|
|
|
|
import com.wayn.common.constant.SysConstants;
|
|
|
|
import com.wayn.common.constant.SysConstants;
|
|
|
|
import com.wayn.common.core.domain.system.Dept;
|
|
|
|
import com.wayn.common.core.domain.system.Dept;
|
|
|
|
import com.wayn.common.core.service.system.IDeptService;
|
|
|
|
import com.wayn.common.core.service.system.IDeptService;
|
|
|
|
|
|
|
|
import com.wayn.common.core.service.system.IUserService;
|
|
|
|
import com.wayn.common.enums.ReturnCodeEnum;
|
|
|
|
import com.wayn.common.enums.ReturnCodeEnum;
|
|
|
|
import com.wayn.common.util.R;
|
|
|
|
import com.wayn.common.util.R;
|
|
|
|
import com.wayn.common.util.security.SecurityUtils;
|
|
|
|
import com.wayn.common.util.security.SecurityUtils;
|
|
|
@ -27,6 +28,9 @@ public class DeptController {
|
|
|
|
|
|
|
|
|
|
|
|
private IDeptService iDeptService;
|
|
|
|
private IDeptService iDeptService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IUserService iUserService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
|
|
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
|
|
|
@GetMapping("/list")
|
|
|
|
@GetMapping("/list")
|
|
|
|
public R list(Dept dept) {
|
|
|
|
public R list(Dept dept) {
|
|
|
@ -89,7 +93,7 @@ public class DeptController {
|
|
|
|
if (iDeptService.hasChildByDeptId(deptId)) {
|
|
|
|
if (iDeptService.hasChildByDeptId(deptId)) {
|
|
|
|
return R.error(ReturnCodeEnum.DEPT_HAS_SUB_DEPT_ERROR);
|
|
|
|
return R.error(ReturnCodeEnum.DEPT_HAS_SUB_DEPT_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (iDeptService.checkDeptExistUser(deptId)) {
|
|
|
|
if (iUserService.checkDeptExistUser(deptId)) {
|
|
|
|
return R.error(ReturnCodeEnum.DEPT_HAS_USER_ERROR);
|
|
|
|
return R.error(ReturnCodeEnum.DEPT_HAS_USER_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return R.result(iDeptService.removeById(deptId));
|
|
|
|
return R.result(iDeptService.removeById(deptId));
|
|
|
|