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.HzEntryRecord; import com.gkhy.hazmat.system.service.HzEntryRecordService; 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 10:33:05 */ @Api(tags = "原材料入库前端控制器") @RestController @RequestMapping("/entry-record") public class HzEntryRecordController { @Autowired private HzEntryRecordService 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(HzEntryRecord 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("/hazmatlist") public CommonResult hazmatlist(Long entryId){ return CommonResult.success(entryRecordService.selectHazmatListByEntryId(entryId)); } @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @RepeatSubmit @ApiOperation(value = "新增入库记录") @PostMapping public CommonResult add(@Validated @RequestBody HzEntryRecord entryRecord){ return CommonResult.success(entryRecordService.insertEntryRecord(entryRecord)); } @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @RepeatSubmit @ApiOperation(value = "编辑入库记录") @PutMapping public CommonResult edit(@Validated @RequestBody HzEntryRecord entryRecord){ return CommonResult.success(entryRecordService.updateEntryRecord(entryRecord)); } @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @RepeatSubmit @ApiOperation(value = "入库") @PostMapping("/doEntry/{entryRecordId}") public CommonResult doEntry(@PathVariable(value = "entryRecordId", required = true) Long entryRecordId){ entryRecordService.doEntry(entryRecordId); return CommonResult.success(); } @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") @RepeatSubmit @ApiOperation(value = "删除入库记录") @DeleteMapping(value = { "/{entryRecordId}" }) public CommonResult delete(@PathVariable(value = "entryRecordId", required = true) Long entryRecordId){ return CommonResult.success(entryRecordService.deleteEntryRecordById(entryRecordId)); } }