|
@@ -26,7 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.xml.transform.Result;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -96,7 +98,17 @@ public class SysDeptController extends BaseLogController{
|
|
|
public ResultData list(){
|
|
|
Integer id = JwtUtil.getId(getToken());
|
|
|
User user = userService.getById(id);
|
|
|
- return ResultData.ok(deptService.getDeptList(null));
|
|
|
+ if(user == null){
|
|
|
+ return ResultData.ok(new ArrayList<>());
|
|
|
+ }
|
|
|
+ Dept dept = deptService.getById(user.getDeptId());
|
|
|
+ if(dept == null){
|
|
|
+ return ResultData.ok(new ArrayList<>());
|
|
|
+ }
|
|
|
+ DeptVo vo = new DeptVo();
|
|
|
+ BeanUtils.copyProperties(dept,vo);
|
|
|
+ vo.setChildren(deptService.getDeptList(user.getDeptId()));
|
|
|
+ return ResultData.ok(Arrays.asList(vo));
|
|
|
}
|
|
|
|
|
|
|