| | |
| | | package com.doumee.api.business; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.EncryptionReq; |
| | | import com.doumee.config.annotation.EncryptionResp; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.service.business.CompanyService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:create") |
| | | public ApiResponse create(@RequestBody Company company) { |
| | | return ApiResponse.success(companyService.create(company)); |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("同步部门信息") |
| | | @PostMapping("/syncAll") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:create") |
| | | public ApiResponse syncAll(@RequestBody Company company) { |
| | | return ApiResponse.success(companyService.syncAll(company)); |
| | |
| | | |
| | | @ApiOperation("组织树查询") |
| | | @PostMapping("/tree") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<List<Company>> tree (@RequestBody Company company){ |
| | | return ApiResponse.success(companyService.companyTree()); |
| | | } |
| | | @ApiOperation("根据父级查询集合") |
| | | @PostMapping("/list") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<List<Company>> list (@RequestBody Company company){ |
| | | return ApiResponse.success(companyService.findList(company)); |
| | | } |
| | | @ApiOperation("组织树查询") |
| | | @PostMapping("/treeWithMember") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<List<Company>> treeWithMember (@RequestBody Company company){ |
| | | return ApiResponse.success(companyService.companyTreeWithMember ()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | companyService.deleteById(id); |
| | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("business:company:delete") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | companyService.deleteByIdInBatch(this.getIdList(ids)); |
| | | return ApiResponse.success(null); |
| | |
| | | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<PageData<Company>> findPage (@RequestBody PageWrap<Company> pageWrap) { |
| | | return ApiResponse.success(companyService.findPage(pageWrap)); |
| | |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Company> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(Company.class).exportData(companyService.findPage(pageWrap).getRecords(), "组织信息表", response); |
| | | ExcelExporter.build(Company.class).export(companyService.findPage(pageWrap).getRecords(), "组织信息表", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(companyService.findById(id)); |