|  |  |  | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.JkCabinetGrid; | 
|---|
|  |  |  | import com.doumee.dao.business.model.JkIccard; | 
|---|
|  |  |  | import com.doumee.service.business.JkCabinetGridService; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Api(tags = "钥匙柜柜格基本信息表") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/jkCabinetGrid") | 
|---|
|  |  |  | public class JkCabinetGridCloudController extends BaseController { | 
|---|
|  |  |  | public class    JkCabinetGridCloudController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private JkCabinetGridService jkCabinetGridService; | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody JkCabinetGrid jkCabinetGrid) { | 
|---|
|  |  |  | public ApiResponse create(@RequestBody JkCabinetGrid jkCabinetGrid,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetGridService.create(jkCabinetGrid)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinetGridService.deleteById(id); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("批量删除") | 
|---|
|  |  |  | @GetMapping("/delete/batch") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:delete") | 
|---|
|  |  |  | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
|---|
|  |  |  | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | for (String id : idArray) { | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改") | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody JkCabinetGrid jkCabinetGrid) { | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody JkCabinetGrid jkCabinetGrid,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinetGrid.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | jkCabinetGridService.updateById(jkCabinetGrid); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改状态") | 
|---|
|  |  |  | @PostMapping("/updateStatusById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:update") | 
|---|
|  |  |  | public ApiResponse updateStatusById(@RequestBody JkCabinetGrid jkCabinetGrid, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinetGrid.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | jkCabinetGridService.updateStatusById(jkCabinetGrid); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("解绑钥匙") | 
|---|
|  |  |  | @PostMapping("/unBindKeys") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:update") | 
|---|
|  |  |  | public ApiResponse unBindKeys(@RequestBody List<Integer> idList, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jkCabinetGridService.unBindKeys(idList); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询") | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:query") | 
|---|
|  |  |  | public ApiResponse<PageData<JkCabinetGrid>> findPage (@RequestBody PageWrap<JkCabinetGrid> pageWrap) { | 
|---|
|  |  |  | public ApiResponse<PageData<JkCabinetGrid>> findPage (@RequestBody PageWrap<JkCabinetGrid> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetGridService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<JkCabinetGrid> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<JkCabinetGrid> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ExcelExporter.build(JkCabinetGrid.class).export(jkCabinetGridService.findPage(pageWrap).getRecords(), "钥匙柜柜格基本信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:jkcabinetgrid:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id) { | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(jkCabinetGridService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|