提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.api.dept; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
5 |
import com.iailab.module.system.api.dept.dto.DeptRespDTO; |
|
6 |
import com.iailab.module.system.dal.dataobject.dept.DeptDO; |
|
7 |
import com.iailab.module.system.service.dept.DeptService; |
|
8 |
import org.springframework.context.annotation.Bean; |
|
9 |
import org.springframework.validation.annotation.Validated; |
|
10 |
import org.springframework.web.bind.annotation.RestController; |
|
11 |
|
|
12 |
import javax.annotation.Resource; |
|
13 |
import java.util.Collection; |
|
14 |
import java.util.List; |
|
15 |
|
|
16 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
17 |
|
|
18 |
@RestController // 提供 RESTful API 接口,给 Feign 调用 |
|
19 |
@Validated |
|
20 |
public class DeptApiImpl implements DeptApi { |
|
21 |
|
|
22 |
@Resource |
|
23 |
private DeptService deptService; |
|
24 |
|
|
25 |
@Override |
|
26 |
public CommonResult<DeptRespDTO> getDept(Long id) { |
|
27 |
DeptDO dept = deptService.getDept(id); |
|
28 |
return success(BeanUtils.toBean(dept, DeptRespDTO.class)); |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
public CommonResult<List<DeptRespDTO>> getDeptList(Collection<Long> ids) { |
|
33 |
List<DeptDO> depts = deptService.getDeptList(ids); |
|
34 |
return success(BeanUtils.toBean(depts, DeptRespDTO.class)); |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public CommonResult<Boolean> validateDeptList(Collection<Long> ids) { |
|
39 |
deptService.validateDeptList(ids); |
|
40 |
return success(true); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public CommonResult<List<DeptRespDTO>> getChildDeptList(Long id) { |
|
45 |
List<DeptDO> depts = deptService.getChildDeptList(id); |
|
46 |
return success(BeanUtils.toBean(depts, DeptRespDTO.class)); |
|
47 |
} |
|
48 |
|
|
49 |
} |