¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | 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.InoutRecord; |
| | | import com.doumee.service.business.InoutRecordService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/04/28 16:19 |
| | | */ |
| | | @Api(tags = "åºå
¥åºäººæ¬¡è½¦æ¬¡æ¯æ¥ç»è®¡è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/inoutRecord") |
| | | public class InoutRecordCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private InoutRecordService inoutRecordService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:inoutrecord:create") |
| | | public ApiResponse create(@RequestBody InoutRecord inoutRecord) { |
| | | return ApiResponse.success(inoutRecordService.create(inoutRecord)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:inoutrecord:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | inoutRecordService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:inoutrecord: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)); |
| | | } |
| | | inoutRecordService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:inoutrecord:update") |
| | | public ApiResponse updateById(@RequestBody InoutRecord inoutRecord) { |
| | | inoutRecordService.updateById(inoutRecord); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:inoutrecord:query") |
| | | public ApiResponse<PageData<InoutRecord>> findPage (@RequestBody PageWrap<InoutRecord> pageWrap) { |
| | | return ApiResponse.success(inoutRecordService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:inoutrecord:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<InoutRecord> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(InoutRecord.class).export(inoutRecordService.findPage(pageWrap).getRecords(), "åºå
¥åºäººæ¬¡è½¦æ¬¡æ¯æ¥ç»è®¡è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:inoutrecord:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(inoutRecordService.findById(id)); |
| | | } |
| | | } |