package com.gkhy.hazmat.admin.controller.web; import com.gkhy.hazmat.common.annotation.RepeatSubmit; import com.gkhy.hazmat.common.api.CommonResult; import com.gkhy.hazmat.system.domain.HzProductEntryRecord; import com.gkhy.hazmat.system.service.HzProductEntryRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** *

* 成品入库记录表 前端控制器 *

* * @author kzy * @since 2024-08-06 16:06:49 */ @Api(tags = "成品入库前端控制器") @RestController @RequestMapping("/product-entry-record") public class HzProductEntryRecordController { @Autowired private HzProductEntryRecordService entryRecordService; @ApiOperation(value = "入库记录列表(分页)") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"), @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10") }) @GetMapping("/list") public CommonResult list(HzProductEntryRecord entryRecord){ return CommonResult.success(entryRecordService.selectEntryRecordList(entryRecord)); } @ApiOperation(value = "根据入库id分页查询详情列表") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"), @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"), @ApiImplicitParam(paramType = "query", name = "entryId", dataType = "long", required = true, value = "入库id") }) @GetMapping("/productlist") public CommonResult productlist(Long entryId){ return CommonResult.success(entryRecordService.selectProductListByEntryId(entryId)); } @RepeatSubmit @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @ApiOperation(value = "新增入库记录") @PostMapping public CommonResult add(@Validated @RequestBody HzProductEntryRecord entryRecord){ return CommonResult.success(entryRecordService.insertEntryRecord(entryRecord)); } @RepeatSubmit @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @ApiOperation(value = "编辑入库记录") @PutMapping public CommonResult edit(@Validated @RequestBody HzProductEntryRecord entryRecord){ return CommonResult.success(entryRecordService.updateEntryRecord(entryRecord)); } @RepeatSubmit @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @ApiOperation(value = "入库") @PostMapping("/doEntry/{entryRecordId}") public CommonResult doEntry(@PathVariable(value = "entryRecordId", required = true) Long entryRecordId){ entryRecordService.doEntry(entryRecordId); return CommonResult.success(); } @RepeatSubmit @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @ApiOperation(value = "删除入库记录") @DeleteMapping(value = { "/{entryRecordId}" }) public CommonResult delete(@PathVariable(value = "entryRecordId", required = true) Long entryRecordId){ return CommonResult.success(entryRecordService.deleteEntryRecordById(entryRecordId)); } }