|  |  |  | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.JkCabinet; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.CabinetConfigDataVO; | 
|---|
|  |  |  | import com.doumee.service.business.JkCabinetService; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody JkCabinet jkCabinet) { | 
|---|
|  |  |  | public ApiResponse create(@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinet.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetService.create(jkCabinet)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinetService.deleteById(id); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量删除") | 
|---|
|  |  |  | @GetMapping("/delete/batch") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:delete") | 
|---|
|  |  |  | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | for (String id : idArray) { | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | jkCabinetService.deleteByIdInBatch(idList); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改") | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody JkCabinet jkCabinet) { | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinet.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | jkCabinetService.updateById(jkCabinet); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改状态") | 
|---|
|  |  |  | @PostMapping("/updateStatusById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:update") | 
|---|
|  |  |  | public ApiResponse updateStatusById(@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinet.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | jkCabinetService.updateStatusById(jkCabinet); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询") | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:query") | 
|---|
|  |  |  | public ApiResponse<PageData<JkCabinet>> findPage (@RequestBody PageWrap<JkCabinet> pageWrap) { | 
|---|
|  |  |  | public ApiResponse<PageData<JkCabinet>> findPage (@RequestBody PageWrap<JkCabinet> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("列表查询") | 
|---|
|  |  |  | @PostMapping("/list") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:query") | 
|---|
|  |  |  | public ApiResponse<List<JkCabinet>> findList (@RequestBody JkCabinet jkCabinet,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetService.findList(jkCabinet)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<JkCabinet> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<JkCabinet> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ExcelExporter.build(JkCabinet.class).export(jkCabinetService.findPage(pageWrap).getRecords(), "钥匙柜基本信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetService.findById(id)); | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetService.getDetail(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("更新酒精检测配置") | 
|---|
|  |  |  | @PostMapping("/updateCabinetConfig") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:update") | 
|---|
|  |  |  | public ApiResponse updateCabinetConfig(@RequestBody CabinetConfigDataVO cabinetConfigDataVO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinetService.updCabinetConfig(cabinetConfigDataVO); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("获取酒精检测配置") | 
|---|
|  |  |  | @GetMapping("/getCabinetConfig") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinet:query") | 
|---|
|  |  |  | public ApiResponse<CabinetConfigDataVO> getCabinetConfig( @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetService.getCabinetConfigDataVO()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|