inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/RawMaterialController.java
@@ -12,9 +12,9 @@ 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; @@ -53,4 +53,24 @@ map.put("total", iPage.getTotal()); return Result.success(map); } @ApiOperation("原材料报检添加") @PostMapping("/add") public Result<?> insertRawMaterial(@Validated @RequestBody RawMaterial rawMaterial) { Integer integer = rawMaterialService.insertRawMaterial(rawMaterial); if (integer >= 1) { return Result.success("添加成功"); } return Result.fail("添加失败"); } @ApiOperation("原材料报检删除") @PostMapping("/delete") public Result<?> deleteRawMaterial(String deleteId) { Integer integer = rawMaterialService.deleteRawMaterial(deleteId); if (integer >= 1) { return Result.success("删除成功"); } return Result.fail("删除失败"); } } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/RawMaterial.java
@@ -27,43 +27,42 @@ private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键", hidden = true) @TableId(value = "id", type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "供应商名称") @ApiModelProperty(value = "供应商名称", required = true, example = "江苏鵷雏") private String supplierName; @ApiModelProperty(value = "材料编码") @ApiModelProperty(value = "材料编码", required = true, example = "YCL202308290000002") private String materialCoding; @ApiModelProperty(value = "材料名称") @ApiModelProperty(value = "材料名称", required = true, example = "光纤") private String materialName; @ApiModelProperty(value = "规格型号") @ApiModelProperty(value = "规格型号", required = true, example = "GGXH2023") private String specificationsModels; @ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位", required = true, example = "KB") private String unit; @ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量", example = "100", required = true) private Integer quantity; @ApiModelProperty(value = "报检日期") @ApiModelProperty(value = "报检日期", example = "2023-08-29", required = true, dataType = "date") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date inspectionDate; @ApiModelProperty(value = "检验人") @ApiModelProperty(value = "检验人", example = "李华", required = true) private String surveyor; @ApiModelProperty(value = "检验日期") @ApiModelProperty(value = "检验日期", required = true, example = "2023-08-29", dataType = "date") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date dateSurvey; @ApiModelProperty(value = "状态0:待检测;1:已检测") @ApiModelProperty(value = "状态0:待检测;1:已检测", required = true, example = "1") private Integer type; // @TableLogic(value = "1", delval = "0") @ApiModelProperty(value = "逻辑删除 正常>=1,删除<=0", hidden = true) private Integer state; inspection-server/src/main/java/com/yuanchu/limslaboratory/service/RawMaterialService.java
@@ -32,4 +32,7 @@ List<Map<String, Object>> selectRawmaAll(); Integer insertRawMaterial(RawMaterial rawMaterial); Integer deleteRawMaterial(String deleteId); } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RawMaterialServiceImpl.java
@@ -1,6 +1,7 @@ package com.yuanchu.limslaboratory.service.impl; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.limslaboratory.pojo.RawMaterial; @@ -31,7 +32,6 @@ * 分页查询 * @param materialCoding * @param materialName * @param condition * @param createTime * @param page * @return @@ -51,5 +51,18 @@ return rawMaterialMapper.selectRawmaAll(); } @Override public Integer insertRawMaterial(RawMaterial rawMaterial) { return rawMaterialMapper.insert(rawMaterial); } @Override public Integer deleteRawMaterial(String deleteId) { LambdaUpdateWrapper<RawMaterial> updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.eq(RawMaterial::getId, deleteId); updateWrapper.set(RawMaterial::getState, 0); return rawMaterialMapper.update(new RawMaterial(), updateWrapper); } } sys/src/main/resources/application-dev.yml
@@ -75,7 +75,7 @@ # redis访问密码(默认为空) password: null # redis连接超时时间(单位毫秒) timeout: 50 timeout: 500 # redis连接池配置 pool: # 最大可用连接数(默认为8,负数表示无限)