| | |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:cars:create") |
| | | public ApiResponse create(@RequestBody Cars cars) { |
| | | public ApiResponse create(@RequestBody Cars cars,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(carsService.create(cars)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:cars:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | carsService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:cars: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:cars:update") |
| | | public ApiResponse updateById(@RequestBody Cars cars) { |
| | | public ApiResponse updateById(@RequestBody Cars cars,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | carsService.updateById(cars); |
| | | return ApiResponse.success(null); |
| | | } |
| | | @ApiOperation("全量同步车辆信息") |
| | | @PostMapping("/sync") |
| | | @CloudRequiredPermission("business:cars:sync") |
| | | public ApiResponse sync(@RequestBody Cars cars) { |
| | | public ApiResponse sync(@RequestBody Cars cars,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | hkSyncVehicleFromHKService.syncVehicleData(); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:cars:query") |
| | | public ApiResponse<PageData<Cars>> findPage (@RequestBody PageWrap<Cars> pageWrap) { |
| | | public ApiResponse<PageData<Cars>> findPage (@RequestBody PageWrap<Cars> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(carsService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:cars:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Cars> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<Cars> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ExcelExporter.build(Cars.class).export(carsService.findPage(pageWrap).getRecords(), "车辆信息表", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:cars:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(carsService.findById(id)); |
| | | } |
| | | } |