| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.annotation.AuthHandler; |
| | | import com.yuanchu.limslaboratory.enums.InterfaceType; |
| | | import com.yuanchu.limslaboratory.enums.MenuEnums; |
| | | import com.yuanchu.limslaboratory.pojo.RawMaterial; |
| | | import com.yuanchu.limslaboratory.service.RawMaterialService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | @ApiImplicitParam(name = "pageSize", value = "每一页数量", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "materialCoding", value = "材料编码", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "materialName", value = "材料名称", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "condition", value = "状态", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "type", value = "状态", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "createTime", value = "来料日期", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/selectAll") |
| | | public Result<?> selectRawMaterial(Integer pageSize, Integer pageNo, String materialCoding, String materialName, Integer condition, String createTime) { |
| | | IPage<RawMaterial> iPage = rawMaterialService.selectRawMaterial(materialCoding, materialName, condition, createTime, new Page<Objects>(pageNo, pageSize)); |
| | | @AuthHandler |
| | | public Result<?> selectRawMaterial(Integer pageSize, Integer pageNo, String materialCoding, String materialName, Integer type, String createTime) { |
| | | IPage<RawMaterial> iPage = rawMaterialService.selectRawMaterial(materialCoding, materialName, type, createTime, new Page<Objects>(pageNo, pageSize)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("row", iPage.getRecords()); |
| | | map.put("total", iPage.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("原材料报检添加") |
| | | @PostMapping("/add") |
| | | @AuthHandler(type = InterfaceType.ADD,menuId = MenuEnums.reportForInspection,isAdd = true) |
| | | public Result<?> insertRawMaterial(@Validated @RequestBody RawMaterial rawMaterial) { |
| | | Integer integer = rawMaterialService.insertRawMaterial(rawMaterial); |
| | | if (integer >= 1) { |
| | | return Result.success("添加成功"); |
| | | } |
| | | return Result.fail("添加失败"); |
| | | } |
| | | |
| | | @ApiOperation("原材料报检删除") |
| | | @PostMapping("/delete") |
| | | @AuthHandler(type = InterfaceType.DELETE,menuId = MenuEnums.reportForInspection,isAdd = true) |
| | | public Result<?> deleteRawMaterial(String deleteId) { |
| | | Integer integer = rawMaterialService.deleteRawMaterial(deleteId); |
| | | if (integer >= 1) { |
| | | return Result.success("删除成功"); |
| | | } |
| | | return Result.fail("删除失败"); |
| | | } |
| | | } |