mdf:部门页面修改
This commit is contained in:
@@ -17,13 +17,12 @@ package org.nl.sso.system.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.sso.system.domain.Dept;
|
||||
@@ -66,8 +65,18 @@ public class DeptController {
|
||||
if (criteria.getPid() == null){
|
||||
criteria.setPidIsNull(true);
|
||||
}
|
||||
Boolean hasChild = false;
|
||||
if (StringUtils.isNotEmpty(criteria.getName()) || StringUtils.isNotEmpty(criteria.getIs_used())){
|
||||
criteria.setPidIsNull(null);
|
||||
hasChild=true;
|
||||
}
|
||||
List<Dept> deptDtos = deptService.queryAll(criteria, true);
|
||||
List<DeptVo> deptVos = CopyUtil.copyList(deptDtos, DeptVo.class);
|
||||
if (hasChild){
|
||||
deptVos.forEach(a->{
|
||||
a.setHasChildren(false);
|
||||
});
|
||||
}
|
||||
return new ResponseEntity<>(PageUtil.toPage(deptVos, deptVos.size()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -101,9 +110,6 @@ public class DeptController {
|
||||
@PostMapping
|
||||
// @SaCheckPermission("dept:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Dept resources){
|
||||
if (resources.getDept_id() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
deptService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user