| package doumeemes.api.ext; | 
|   | 
| import doumeemes.api.BaseController; | 
| import doumeemes.core.annotation.excel.ExcelExporter; | 
| import doumeemes.core.annotation.pr.PreventRepeat; | 
| import doumeemes.core.model.ApiResponse; | 
| import doumeemes.core.model.PageWrap; | 
| import doumeemes.core.model.PageData; | 
| import doumeemes.dao.business.model.Department; | 
| import doumeemes.dao.ext.dto.QueryDepartmentExtDTO; | 
| import doumeemes.dao.ext.vo.DepartmentExtListVO; | 
| import doumeemes.service.business.DepartmentService; | 
| import doumeemes.service.ext.DepartmentExtService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
| import javax.servlet.http.HttpServletResponse; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * 组织信息接口 | 
|  * @author 江蹄蹄 | 
|  * @date 2022/04/20 10:59 | 
|  */ | 
| @RestController | 
| @RequestMapping("/ext/departmentExt") | 
| @Api(tags = "组织信息接口") | 
| public class DepartmentExtController extends BaseController { | 
|   | 
|     @Autowired | 
|     private DepartmentExtService departmentExtService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @RequiresPermissions("ext:departmentext:create") | 
|     public ApiResponse create(@RequestBody Department department) { | 
|         return ApiResponse.success(departmentExtService.create(department)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除") | 
|     @GetMapping("/delete/{id}") | 
|     @RequiresPermissions("ext:departmentext:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         departmentExtService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("批量删除") | 
|     @GetMapping("/delete/batch") | 
|     @RequiresPermissions("ext:departmentext:delete") | 
|     public ApiResponse deleteByIds(@RequestParam String ids) { | 
|         String [] idArray = ids.split(","); | 
|         List<Integer> idList = new ArrayList<>(); | 
|         for (String id : idArray) { | 
|             idList.add(Integer.valueOf(id)); | 
|         } | 
|         departmentExtService.deleteByIdInBatch(idList); | 
|         return ApiResponse.success(null); | 
|     } | 
|     @ApiOperation("切换当前公司级组织") | 
|     @GetMapping("/changeCom/{id}") | 
| //    @RequiresPermissions("system:user:delete") | 
|     public ApiResponse changeCom(@PathVariable Integer id) { | 
|         departmentExtService.changeCom(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|     @ApiOperation("根据ID修改") | 
|     @PostMapping("/updateById") | 
|     @RequiresPermissions("ext:departmentext:update") | 
|     public ApiResponse updateById(@RequestBody Department department) { | 
|         departmentExtService.updateById(department); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("企业部门树形列表查询") | 
|     @PostMapping("/treeComList") | 
|     @RequiresPermissions("ext:departmentext:query") | 
|     public ApiResponse<DepartmentExtListVO> treeComList (@RequestBody QueryDepartmentExtDTO pageWrap) { | 
|         return ApiResponse.success(departmentExtService.treeComList(pageWrap)); | 
|     } | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     @RequiresPermissions("ext:departmentext:query") | 
|     public ApiResponse<PageData<DepartmentExtListVO>> findPage (@RequestBody PageWrap<QueryDepartmentExtDTO> pageWrap) { | 
|         return ApiResponse.success(departmentExtService.findPage(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("导出Excel") | 
|     @PostMapping("/exportExcel") | 
|     @RequiresPermissions("ext:departmentext:exportExcel") | 
|     public void exportExcel (@RequestBody PageWrap<QueryDepartmentExtDTO> pageWrap, HttpServletResponse response) { | 
|         ExcelExporter.build(DepartmentExtListVO.class).export(departmentExtService.findPage(pageWrap).getRecords(), "组织信息", response); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     @RequiresPermissions("ext:departmentext:query") | 
|     public ApiResponse findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(departmentExtService.findById(id)); | 
|     } | 
|   | 
|   | 
|     @ApiOperation("条件查询企业全部部门") | 
|     @PostMapping("/getDepartmentListByConditon") | 
|     @RequiresPermissions("ext:departmentext:query") | 
|     public ApiResponse<List<DepartmentExtListVO>> getDepartmentListByConditon (@RequestBody QueryDepartmentExtDTO pageWrap) { | 
|         return ApiResponse.success(departmentExtService.getDepartmentListByConditon(pageWrap)); | 
|     } | 
|   | 
|   | 
|   | 
|     @ApiOperation("同步钉钉全部数据") | 
|     @GetMapping("/syncDingDingDepartment") | 
|     @RequiresPermissions("ext:departmentext:update") | 
|     public ApiResponse syncDingDingDepartment() { | 
|         departmentExtService.syncDingDingDepartment(); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|   | 
| } |