|  |  | 
 |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
 |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
 |  |  | import com.doumee.core.model.ApiResponse; | 
 |  |  | import com.doumee.core.model.LoginUserInfo; | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.dao.business.dto.DispatchUnitQueryDTO; | 
 |  |  | import com.doumee.dao.business.dto.SaveDispatchUnitDTO; | 
 |  |  | import com.doumee.dao.business.model.DispatchUnit; | 
 |  |  | import com.doumee.service.business.DispatchUnitService; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
 |  |  | import org.apache.shiro.SecurityUtils; | 
 |  |  | 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; | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreventRepeat | 
 |  |  |     @ApiOperation("添加工种") | 
 |  |  |     @ApiOperation("添加方案工种") | 
 |  |  |     @PostMapping("/createSolution") | 
 |  |  |     @RequiresPermissions("business:dispatchunit:create") | 
 |  |  |     public ApiResponse createSolution(@RequestBody SaveDispatchUnitDTO saveDispatchUnitDTO) { | 
 |  |  | 
 |  |  |     @PostMapping("/page") | 
 |  |  |     @RequiresPermissions("business:dispatchunit:query") | 
 |  |  |     public ApiResponse<PageData<DispatchUnit>> findPage (@RequestBody PageWrap<DispatchUnit> pageWrap) { | 
 |  |  |         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
 |  |  |         pageWrap.getModel().setCompanyId(user.getCompanyId()); | 
 |  |  |         return ApiResponse.success(dispatchUnitService.findPage(pageWrap)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @PostMapping("/exportExcel") | 
 |  |  |     @RequiresPermissions("business:dispatchunit:exportExcel") | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<DispatchUnit> pageWrap, HttpServletResponse response) { | 
 |  |  |  | 
 |  |  |         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
 |  |  |         pageWrap.getModel().setCompanyId(user.getCompanyId()); | 
 |  |  |         ExcelExporter.build(DispatchUnit.class).export(dispatchUnitService.findPage(pageWrap).getRecords(), "派遣单位信息表", response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID查询") | 
 |  |  |     @GetMapping("/{id}") | 
 |  |  |     @RequiresPermissions("business:dispatchunit:query") | 
 |  |  |     public ApiResponse findById(@PathVariable Integer id) { | 
 |  |  |     public ApiResponse<DispatchUnit> findById(@PathVariable Integer id) { | 
 |  |  |         return ApiResponse.success(dispatchUnitService.detailById(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("数据列表") | 
 |  |  |     @PostMapping("/findListByDTO") | 
 |  |  |     @RequiresPermissions("business:dispatchunit:query") | 
 |  |  |     public ApiResponse<List<DispatchUnit>> findListByDTO (@RequestBody DispatchUnitQueryDTO dispatchUnitQueryDTO) { | 
 |  |  |         return ApiResponse.success(dispatchUnitService.findByDTO(dispatchUnitQueryDTO)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |