|  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Company; | 
|---|
|  |  |  | import com.doumee.service.business.CompanyService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("business:company:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody Company company) { | 
|---|
|  |  |  | return ApiResponse.success(companyService.create(company)); | 
|---|
|  |  |  | companyService.create(company); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequiresPermissions("business:company:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Company company) { | 
|---|
|  |  |  | companyService.updateById(company); | 
|---|
|  |  |  | companyService.startSignAuth(company.getId()); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询") | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @RequiresPermissions("business:company:query") | 
|---|
|  |  |  | public ApiResponse<PageData<Company>> findPage (@RequestBody PageWrap<Company> pageWrap) { | 
|---|
|  |  |  | //权限范围内 | 
|---|
|  |  |  | return ApiResponse.success(companyService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @RequiresPermissions("business:company:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id) { | 
|---|
|  |  |  | public ApiResponse<Company> findById(@PathVariable Integer id) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ApiResponse.success(companyService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("企业证件下载") | 
|---|
|  |  |  | @PostMapping("/exportFiles") | 
|---|
|  |  |  | @RequiresPermissions("business:company:exportExcel") | 
|---|
|  |  |  | public void exportFiles(@RequestBody Company company,HttpServletResponse response) { | 
|---|
|  |  |  | if(company.getId() == null){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | companyService.exportFiles(company.getId(),response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|