|  |  |  | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Warning; | 
|---|
|  |  |  | import com.doumee.service.business.WarningService; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody Warning warning) { | 
|---|
|  |  |  | public ApiResponse create(@RequestBody Warning warning, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | warning.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(warningService.create(warning)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | warningService.deleteById(id); | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | warningService.deleteById(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID 禁启用  ") | 
|---|
|  |  |  | @PostMapping("/updateStatus") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:update") | 
|---|
|  |  |  | public ApiResponse updateStatus(@RequestBody Warning param, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | param.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | warningService.updateStatus(param); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量删除") | 
|---|
|  |  |  | @GetMapping("/delete/batch") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning: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) { | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | warningService.deleteByIdInBatch(idList); | 
|---|
|  |  |  | warningService.deleteByIdInBatch(idList,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改") | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Warning warning) { | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Warning warning, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | warning.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | warningService.updateById(warning); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询") | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:query") | 
|---|
|  |  |  | public ApiResponse<PageData<Warning>> findPage (@RequestBody PageWrap<Warning> pageWrap) { | 
|---|
|  |  |  | public ApiResponse<PageData<Warning>> findPage (@RequestBody PageWrap<Warning> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(warningService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("查询全部") | 
|---|
|  |  |  | @PostMapping("/allList") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:query") | 
|---|
|  |  |  | public ApiResponse<List<Warning>> findPage (@RequestBody Warning pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(warningService.findList(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<Warning> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<Warning> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ExcelExporter.build(Warning.class).export(warningService.findPage(pageWrap).getRecords(), "报警记录信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:warning:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id) { | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(warningService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|