From 34f448ffe2aacb496c15ab5da44a24128e0682be Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期一, 24 二月 2025 17:30:26 +0800 Subject: [PATCH] 修改 --- hazmat-system/src/main/resources/mapper/system/HzProductMapper.xml | 6 hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarehouseController.java | 25 + hazmat-system/src/main/resources/mapper/system/HzProductBasicMapper.xml | 4 hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelDataListener.java | 16 hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzPeculiarityService.java | 19 + hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml | 4 hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java | 2 hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java | 2 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductEntryRecord.java | 9 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmat.java | 8 hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzPeculiarityController.java | 65 +++ hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelData.java | 32 + hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzSecientificMapper.java | 15 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzSecientificVo.java | 15 hazmat-system/src/main/resources/mapper/system/HzPeculiarityMapper.xml | 30 + hazmat-system/src/main/resources/mapper/system/HzSecientificMapper.xml | 50 ++ hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml | 13 hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzPeculiarityServiceImpl.java | 75 +++ hazmat-system/src/main/resources/mapper/system/HzWarehouseMapper.xml | 71 +++ hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzSecientificService.java | 20 + hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java | 16 hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml | 5 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseVo.java | 41 ++ hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java | 31 + hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzPeculiarity.java | 56 ++ hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java | 88 ++++ hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java | 9 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductWarehouseRecord.java | 8 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseRecord.java | 8 hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzSecientificController.java | 75 +++ hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductBasic.java | 8 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatBasic.java | 8 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseCupboard.java | 40 ++ hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzPeculiarityMapper.java | 21 + hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProduct.java | 9 hazmat-system/src/main/resources/mapper/system/HzWarehouseRecordMapper.xml | 9 hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzSecientific.java | 48 ++ hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java | 15 hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarehouseMapper.java | 12 hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzSecientificServiceImpl.java | 128 ++++++ hazmat-system/src/main/resources/mapper/system/HzProductEntryRecordMapper.xml | 9 41 files changed, 1,116 insertions(+), 9 deletions(-) diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzPeculiarityController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzPeculiarityController.java new file mode 100644 index 0000000..ab438f3 --- /dev/null +++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzPeculiarityController.java @@ -0,0 +1,65 @@ +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.HzPeculiarity; +import com.gkhy.hazmat.system.service.HzPeculiarityService; +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.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "危化品特性管理") +@RestController +@RequestMapping("/peculiarity") +public class HzPeculiarityController { + + @Autowired + private HzPeculiarityService hzPeculiarityService; + + + @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(HzPeculiarity hzPeculiarity){ + return CommonResult.success(hzPeculiarityService.selectPeculiarity(hzPeculiarity)); + } + + @GetMapping("/select") + public CommonResult select(){ + return CommonResult.success(hzPeculiarityService.selectList()); + } + +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @RepeatSubmit + @ApiOperation(value = "新增") + @PostMapping("/add") + public CommonResult add(@Validated @RequestBody HzPeculiarity peculiarity){ + return CommonResult.success(hzPeculiarityService.insertPeculiarity(peculiarity)); + } + +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @RepeatSubmit + @ApiOperation(value = "编辑") + @PostMapping("/update") + public CommonResult edit(@Validated @RequestBody HzPeculiarity peculiarity){ + return CommonResult.success(hzPeculiarityService.updatePeculiarity(peculiarity)); + } + + +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @RepeatSubmit + @ApiOperation(value = "删除") + @GetMapping( "deleted/{peculiarityId}") + public CommonResult delete(@PathVariable(value = "peculiarityId", required = true) Long peculiarityId){ + return CommonResult.success(hzPeculiarityService.deletePeculiarity(peculiarityId)); + } + + +} diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzSecientificController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzSecientificController.java new file mode 100644 index 0000000..2bb980e --- /dev/null +++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzSecientificController.java @@ -0,0 +1,75 @@ +package com.gkhy.hazmat.admin.controller.web; + +import com.gkhy.hazmat.common.annotation.Anonymous; +import com.gkhy.hazmat.common.annotation.RepeatSubmit; +import com.gkhy.hazmat.common.api.CommonResult; +import com.gkhy.hazmat.system.domain.HzPeculiarity; +import com.gkhy.hazmat.system.domain.HzSecientific; +import com.gkhy.hazmat.system.service.HzSecientificService; +import io.minio.messages.Upload; +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.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.sound.midi.MidiFileFormat; +import java.io.IOException; + +@Api(tags = "危化品分类信息管理") +@RestController +@RequestMapping("/secientific") +public class HzSecientificController{ + + @Autowired + private HzSecientificService hzSecientificService; + + + @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(HzSecientific hzSecientific){ + return CommonResult.success(hzSecientificService.selectSecientific(hzSecientific)); + } + +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @RepeatSubmit + @ApiOperation(value = "新增") + @PostMapping("/add") + public CommonResult add(@Validated @RequestBody HzSecientific hzSecientific){ + return CommonResult.success(hzSecientificService.insertSecientific(hzSecientific)); + } + +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @RepeatSubmit + @ApiOperation(value = "编辑") + @PostMapping("/update") + public CommonResult edit(@Validated @RequestBody HzSecientific hzSecientific){ + return CommonResult.success(hzSecientificService.updateSecientific(hzSecientific)); + } + + +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @RepeatSubmit + @ApiOperation(value = "删除") + @GetMapping( "deleted/{secientificId}") + public CommonResult delete(@PathVariable(value = "secientificId", required = true) Long secientificId){ + return CommonResult.success(hzSecientificService.deleteSecientific(secientificId)); + } + + @RepeatSubmit +// @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')") + @ApiOperation(value = "危化品分类信息Excel导入") + @PostMapping("/importExcel") + @Anonymous + public CommonResult importExcel( MultipartFile file) throws IOException { + return CommonResult.success(hzSecientificService.importExcel(file)); + } +} diff --git a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarehouseController.java b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarehouseController.java index 040d4f1..fdefc33 100644 --- a/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarehouseController.java +++ b/hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarehouseController.java @@ -4,6 +4,7 @@ import com.gkhy.hazmat.common.annotation.RepeatSubmit; import com.gkhy.hazmat.common.api.CommonResult; import com.gkhy.hazmat.system.domain.HzWarehouse; +import com.gkhy.hazmat.system.domain.HzWarehouseCupboard; import com.gkhy.hazmat.system.service.HzWarehouseService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -72,4 +73,28 @@ return CommonResult.success(warehouseService.checkNameUnique(warehouse)); } + @ApiOperation(value = "新增仓库所属存储柜") + @PostMapping("/insertCupboard") + public CommonResult insertCupboard(@RequestBody HzWarehouseCupboard hzWarehouseCupboard){ + return CommonResult.success(warehouseService.insertCupboard(hzWarehouseCupboard)); + } + + @ApiOperation(value = "修改仓库所属存储柜") + @PostMapping("/updateCupboard") + public CommonResult updateCupboard(@RequestBody HzWarehouseCupboard hzWarehouseCupboard){ + return CommonResult.success(warehouseService.updateCupboard(hzWarehouseCupboard)); + } + + @ApiOperation(value = "删除仓库所属存储柜") + @GetMapping("/deletedCupboard/{cupboardId}") + public CommonResult deletedCupboard(@PathVariable("cupboardId") Long cupboardId){ + return CommonResult.success(warehouseService.deletedCupboard(cupboardId)); + } + + @ApiOperation(value = "根据仓库id获取储柜") + @GetMapping("/listByid/{warehouseId}") + public CommonResult selectByWarehouseId(@PathVariable("warehouseId") Long warehouseId){ + return CommonResult.success(warehouseService.selectByWarehouseId(warehouseId)); + } + } diff --git a/hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelData.java b/hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelData.java new file mode 100644 index 0000000..c3796be --- /dev/null +++ b/hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelData.java @@ -0,0 +1,32 @@ +package com.gkhy.hazmat.common.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class SecientificExcelData { + + @ExcelProperty("序号") + private Integer index; + + @ExcelProperty("品名") + private String secientificName; + + @ExcelProperty("别名") + private String aliasName; + + @ExcelProperty("CAS号") + private String cas; + + @ExcelProperty("危险性类别") + private String riskType; + + @ExcelProperty("备注") + private String remark; + + @ExcelProperty("编号") + private Integer peculiarityNumber; +} diff --git a/hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelDataListener.java b/hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelDataListener.java new file mode 100644 index 0000000..3f71e86 --- /dev/null +++ b/hazmat-common/src/main/java/com/gkhy/hazmat/common/excel/SecientificExcelDataListener.java @@ -0,0 +1,16 @@ +package com.gkhy.hazmat.common.excel; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; + +public class SecientificExcelDataListener extends AnalysisEventListener<SecientificExcelData> { + @Override + public void invoke(SecientificExcelData secientificExcelData, AnalysisContext analysisContext) { + System.out.printf("invoke"); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + System.out.println("doAfterAllAnalysed"); + } +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java index a8eccb4..1aea15a 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzEntryRecord.java @@ -40,6 +40,11 @@ @TableField("warehouse_id") private Long warehouseId; + @NotNull(message = "存储柜id不能为空") + @ApiModelProperty(value = "存储柜id",required = true) + @TableField("cupboard_id") + private Long cupboardId; + @NotNull(message = "数量不能为空") @Min(value = 1,message = "数量最小值不能小于1") @Max(value = 9999,message = "数量最大值不能大于9999") @@ -93,5 +98,9 @@ @TableField(exist = false) private HzWarehouse warehouse; + @ApiModelProperty("存储柜对象") + @TableField(exist = false) + private HzWarehouseCupboard cupboard; + } diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmat.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmat.java index 91b0bbb..e3df63e 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmat.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmat.java @@ -46,6 +46,10 @@ @TableField("warehouse_id") private Long warehouseId; + @ApiModelProperty("存储柜id") + @TableField("cupboard_id") + private Long cupboardId; + @ApiModelProperty("在库容量") @TableField("remaining") private BigDecimal remaining; @@ -79,6 +83,10 @@ @TableField(exist = false) private String warehouseName; + @ApiModelProperty("存储柜名称") + @TableField(exist = false) + private String cupboardName; + @ApiModelProperty("库存数量") @TableField(exist = false) diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatBasic.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatBasic.java index 4a5e723..4ac234e 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatBasic.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzHazmatBasic.java @@ -125,6 +125,14 @@ @TableField("del_flag") private Integer delFlag; + @ApiModelProperty("危化品特性种类") + @TableField("peculiarity_type") + private String peculiarityType; + + @ApiModelProperty("危化品特性编码") + @TableField("peculiarity_number") + private Integer peculiarityNumber; + @ApiModelProperty("创建人") @TableField("create_by") private String createBy; diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzPeculiarity.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzPeculiarity.java new file mode 100644 index 0000000..b372f5a --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzPeculiarity.java @@ -0,0 +1,56 @@ +package com.gkhy.hazmat.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gkhy.hazmat.common.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; +import java.util.Date; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +@Getter +@Setter +@TableName("hz_peculiarity") +@ApiModel(value = "HzPeculiarity对象", description = "危化品特性") +@JsonInclude(NON_NULL) +public class HzPeculiarity{ + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @NotBlank(message = "危化品特性种类不能为空") + @ApiModelProperty(value = "危化品特性种类") + private String peculiarityType; + + @NotBlank(message = "危化品特性编号不能为空") + @ApiModelProperty(value = "危化品特性编号") + private String peculiarityNumber; + + @ApiModelProperty("创建者") + private String createBy; + + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; + + @ApiModelProperty("更新者") + private String updateBy; + + @ApiModelProperty("更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; + + private Integer delFlag; + +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProduct.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProduct.java index f3f14c3..4c2878e 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProduct.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProduct.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonInclude; import com.gkhy.hazmat.common.domain.BaseEntity; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -46,6 +47,10 @@ @TableField("warehouse_id") private Long warehouseId; + @ApiModelProperty("存储柜id") + @TableField("cupboard_id") + private Long cupboardId; + @ApiModelProperty("在库容量") @TableField("remaining") private BigDecimal remaining; @@ -78,5 +83,9 @@ @TableField(exist = false) private String warehouseName; + @ApiModelProperty("存储柜名称") + @TableField(exist = false) + protected String cupboardName; + } diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductBasic.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductBasic.java index dced607..23a7514 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductBasic.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductBasic.java @@ -102,6 +102,14 @@ @TableField("del_flag") private Integer delFlag; + @ApiModelProperty("危化品特性种类") + @TableField("peculiarity_type") + private String peculiarityType; + + @ApiModelProperty("危化品特性编码") + @TableField("peculiarity_number") + private Integer peculiarityNumber; + @ApiModelProperty("创建人") @TableField("create_by") private String createBy; diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductEntryRecord.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductEntryRecord.java index 7711408..8ce4de8 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductEntryRecord.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductEntryRecord.java @@ -40,6 +40,11 @@ @TableField("warehouse_id") private Long warehouseId; + @NotNull(message = "存储柜id不能为空") + @ApiModelProperty("存储柜id") + @TableField("cupboard_id") + private Long cupboardId; + @NotNull(message = "数量不能为空") @ApiModelProperty("数量") @TableField("num") @@ -86,4 +91,8 @@ @ApiModelProperty("仓库对象") @TableField(exist = false) private HzWarehouse warehouse; + + @ApiModelProperty("存储柜对象") + @TableField(exist = false) + private HzWarehouseCupboard cupboard; } diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductWarehouseRecord.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductWarehouseRecord.java index e2bcb14..67e4ae0 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductWarehouseRecord.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzProductWarehouseRecord.java @@ -42,6 +42,10 @@ @TableField("warehouse_id") private Long warehouseId; + @ApiModelProperty("存储柜id") + @TableField("cupboard_id") + private Long cupboardId; + @ApiModelProperty("变动后剩余数量") @TableField("remaining") private Integer remaining; @@ -90,6 +94,10 @@ @TableField(exist = false) private HzWarehouse warehouse; + @ApiModelProperty("存储柜对象") + @TableField(exist = false) + private HzWarehouseCupboard cupboard; + @ApiModelProperty("操作人名称") @TableField(exist = false) private String createName; diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzSecientific.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzSecientific.java new file mode 100644 index 0000000..6ade01f --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzSecientific.java @@ -0,0 +1,48 @@ +package com.gkhy.hazmat.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gkhy.hazmat.common.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +@Getter +@Setter +@TableName("hz_secientific") +@ApiModel(value = "HzSecientific对象", description = "危化品分类信息") +@JsonInclude(NON_NULL) +public class HzSecientific extends BaseEntity { + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "品名") + @NotBlank(message = "品名不能为空") + private String secientificName; + + @ApiModelProperty(value = "别名") + @NotBlank(message = "别名不能为空") + private String aliasName; + @ApiModelProperty(value = "CAS编码") + @NotBlank(message = "CAS不能为空") + private String cas; + @NotBlank(message = "危险性类别不能为空") + @ApiModelProperty(value = "危险性类别") + private String riskType; + @NotNull(message = "危化品特性编号不能为空") + @ApiModelProperty(value = "危化品特性编号") + private Integer peculiarityNumber; + private Integer delFlag; +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseCupboard.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseCupboard.java new file mode 100644 index 0000000..9447b16 --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseCupboard.java @@ -0,0 +1,40 @@ +package com.gkhy.hazmat.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gkhy.hazmat.common.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +@Getter +@Setter +@TableName("hz_warehouse_cupboard") +@ApiModel(value = "HzWarehouseCupboard对象", description = "仓库关联储柜表") +@JsonInclude(NON_NULL) +public class HzWarehouseCupboard extends BaseEntity { + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "所属仓库id") + @NotNull(message = "所属仓库id不能为空") + private Long warehouseId; + @NotBlank(message = "储柜名不能为空") + @ApiModelProperty(value = "储柜名") + private String cupboardName; + @ApiModelProperty(value = "描述") + private String mess; + private Integer delFlag; + +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseRecord.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseRecord.java index bc4ea86..95c1e38 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseRecord.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/HzWarehouseRecord.java @@ -42,6 +42,10 @@ @TableField("warehouse_id") private Long warehouseId; + @ApiModelProperty("存储柜id") + @TableField("cupboard_id") + private Long cupboardId; + @ApiModelProperty("变动后剩余数量") @TableField("remaining") private Integer remaining; @@ -95,6 +99,10 @@ @TableField(exist = false) private HzWarehouse warehouse; + @ApiModelProperty("存储柜对象") + @TableField(exist = false) + private HzWarehouseCupboard cupboard; + @ApiModelProperty("操作人姓名") @TableField(exist = false) private String createName; diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzSecientificVo.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzSecientificVo.java new file mode 100644 index 0000000..9617cf7 --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzSecientificVo.java @@ -0,0 +1,15 @@ +package com.gkhy.hazmat.system.domain.vo; + +import com.gkhy.hazmat.system.domain.HzSecientific; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class HzSecientificVo extends HzSecientific { + + private String peculiarityType; + + +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseVo.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseVo.java new file mode 100644 index 0000000..5a3ea7a --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/vo/HzWarehouseVo.java @@ -0,0 +1,41 @@ +package com.gkhy.hazmat.system.domain.vo; + +import com.gkhy.hazmat.system.domain.HzWarehouseCupboard; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; +import java.util.List; + +@Getter +@Setter +public class HzWarehouseVo { + + + private Long id; + + private String name; + + private String address; + + private Long companyId; + + private String createBy; + + private LocalDateTime createTime; + + private Integer delFlag; + + private String updateBy; + + private LocalDateTime updateTime; + + private String remark; + + private Integer version; + + private String companyName; + + private List<HzWarehouseCupboard> warehouseCupboards; + +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzPeculiarityMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzPeculiarityMapper.java new file mode 100644 index 0000000..661155a --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzPeculiarityMapper.java @@ -0,0 +1,21 @@ +package com.gkhy.hazmat.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.hazmat.common.api.CommonPage; +import com.gkhy.hazmat.system.domain.HzPeculiarity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface HzPeculiarityMapper extends BaseMapper<HzPeculiarity> { + List<HzPeculiarity> selectPeculiarityBatch(HzPeculiarity hzPeculiarity); + + HzPeculiarity selectbyPeculiarityNumber(String peculiarityNumber); + + int updatePeculiarity(Long peculiarityId); + + List<HzPeculiarity> select(); + + +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzSecientificMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzSecientificMapper.java new file mode 100644 index 0000000..9a90c2e --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzSecientificMapper.java @@ -0,0 +1,15 @@ +package com.gkhy.hazmat.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.hazmat.system.domain.HzSecientific; +import com.gkhy.hazmat.system.domain.vo.HzSecientificVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface HzSecientificMapper extends BaseMapper<HzSecientific> { + List<HzSecientificVo> selectSecientificBatch(HzSecientific hzSecientific); + + HzSecientificVo selectBySecientificName(String name); +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarehouseMapper.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarehouseMapper.java index 67b7996..0576307 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarehouseMapper.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarehouseMapper.java @@ -2,6 +2,8 @@ import com.gkhy.hazmat.system.domain.HzWarehouse; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.hazmat.system.domain.HzWarehouseCupboard; +import com.gkhy.hazmat.system.domain.vo.HzWarehouseVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -44,4 +46,14 @@ * @return */ List<HzWarehouse> selectWarehouseListByIds(List<Long> warehouseIds); + + List<HzWarehouseCupboard> selectByWarehouseIdAndCupboardName(@Param("id") Long id, @Param("cupboardName") String cupboardName); + + int insertCupboard(HzWarehouseCupboard hzWarehouseCupboard); + + int updateCupboard(HzWarehouseCupboard hzWarehouseCupboard); + + int deleteByCupboardId(Long cupboardId); + + List<HzWarehouseCupboard> selectByWarehouseId(Long id); } diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzPeculiarityService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzPeculiarityService.java new file mode 100644 index 0000000..7f6e9e5 --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzPeculiarityService.java @@ -0,0 +1,19 @@ +package com.gkhy.hazmat.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.hazmat.common.api.CommonPage; +import com.gkhy.hazmat.system.domain.HzPeculiarity; + +import java.util.List; + +public interface HzPeculiarityService extends IService<HzPeculiarity> { + CommonPage selectPeculiarity(HzPeculiarity hzPeculiarity); + + int insertPeculiarity(HzPeculiarity peculiarity); + + int updatePeculiarity(HzPeculiarity peculiarity); + + int deletePeculiarity(Long peculiarityId); + + CommonPage selectList(); +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzSecientificService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzSecientificService.java new file mode 100644 index 0000000..6ccc69b --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzSecientificService.java @@ -0,0 +1,20 @@ +package com.gkhy.hazmat.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.hazmat.common.api.CommonPage; +import com.gkhy.hazmat.system.domain.HzSecientific; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +public interface HzSecientificService extends IService<HzSecientific> { + CommonPage selectSecientific(HzSecientific hzSecientific); + + int insertSecientific(HzSecientific hzSecientific); + + int updateSecientific(HzSecientific hzSecientific); + + int deleteSecientific(Long secientificId); + + Integer importExcel(MultipartFile file) throws IOException; +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java index 11620f4..88bb848 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarehouseService.java @@ -3,6 +3,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.hazmat.common.api.CommonPage; import com.gkhy.hazmat.system.domain.HzWarehouse; +import com.gkhy.hazmat.system.domain.HzWarehouseCupboard; + +import java.util.List; /** * <p> @@ -64,4 +67,32 @@ * @return boolean */ public boolean checkNameUnique(HzWarehouse warehouse); + + /** + * 新增储柜 + * @param hzWarehouseCupboard + * @return + */ + int insertCupboard(HzWarehouseCupboard hzWarehouseCupboard); + + /** + * 修改储柜 + * @param hzWarehouseCupboard + * @return + */ + int updateCupboard(HzWarehouseCupboard hzWarehouseCupboard); + + /** + * 删除储柜 + * @param cupboardId + * @return + */ + int deletedCupboard(Long cupboardId); + + /** + * 根据仓库获取储柜 + * @param warehouseId + * @return + */ + List<HzWarehouseCupboard> selectByWarehouseId(Long warehouseId); } diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java index 1a428f6..e3218dc 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java @@ -162,6 +162,7 @@ //新增危化品变动记录 HzWarehouseRecord warehouseRecord = new HzWarehouseRecord() .setWarehouseId(entryRecord.getWarehouseId()) + .setCupboardId(entryRecord.getCupboardId()) .setBasicId(hazmatBasic.getId()) .setNum(entryRecord.getNum()) .setCompanyId(currentUser.getCompanyId()) @@ -175,6 +176,7 @@ String lastCode= StringUtils.addZeroForNum(String.valueOf(i),4); String code=String.format("%s%s",entryRecord.getCodePrex(),lastCode); hazmatList.add(new HzHazmat().setWarehouseId(entryRecord.getWarehouseId()) + .setCupboardId(entryRecord.getCupboardId()) .setBasicId(entryRecord.getBasicId()) .setEntryId(entryRecord.getId()) .setRemaining(hazmatBasic.getMetering()) diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java index 9d4e01f..5a41154 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java @@ -16,9 +16,12 @@ import com.gkhy.hazmat.common.utils.SecurityUtils; import com.gkhy.hazmat.common.utils.StringUtils; import com.gkhy.hazmat.system.domain.HzHazmatBasic; +import com.gkhy.hazmat.system.domain.vo.HzSecientificVo; import com.gkhy.hazmat.system.mapper.HzHazmatBasicMapper; +import com.gkhy.hazmat.system.mapper.HzSecientificMapper; import com.gkhy.hazmat.system.service.HzHazmatBasicService; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -39,6 +42,10 @@ */ @Service public class HzHazmatBasicServiceImpl extends ServiceImpl<HzHazmatBasicMapper, HzHazmatBasic> implements HzHazmatBasicService { + + + @Autowired + private HzSecientificMapper secientificMapper; @Override public CommonPage selectHazmatBasicList(HzHazmatBasic hazmatBasic) { @@ -72,6 +79,10 @@ throw new ApiException("产品编号已存在"); } checkUserAllowed(null,currentUser); + + HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(hazmatBasic.getName()); + hazmatBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null); + hazmatBasic.setPeculiarityNumber(hzSecientificVo!=null? hzSecientificVo.getPeculiarityNumber() : 0); int row = baseMapper.insert(hazmatBasic); if (row < 1) { @@ -155,6 +166,11 @@ if(minPackage==null){ throw new ApiException("序号"+hazmatBasicExcelData.getIndex()+"最小包装类型填写不正确"); } + + HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(hazmatBasic.getName()); + hazmatBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : ""); + hazmatBasic.setPeculiarityNumber(hzSecientificVo!=null? hzSecientificVo.getPeculiarityNumber() : 0); + hazmatBasic.setKind(kind); hazmatBasic.setMinPackage(minPackage); hazmatBasic.setCompanyId(currentUser.getCompanyId()); diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzPeculiarityServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzPeculiarityServiceImpl.java new file mode 100644 index 0000000..9fa3807 --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzPeculiarityServiceImpl.java @@ -0,0 +1,75 @@ +package com.gkhy.hazmat.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.hazmat.common.api.CommonPage; +import com.gkhy.hazmat.common.domain.entity.SysUser; +import com.gkhy.hazmat.common.domain.model.LoginUserDetails; +import com.gkhy.hazmat.common.exception.ApiException; +import com.gkhy.hazmat.common.utils.PageUtils; +import com.gkhy.hazmat.common.utils.SecurityUtils; +import com.gkhy.hazmat.system.domain.HzPeculiarity; +import com.gkhy.hazmat.system.mapper.HzPeculiarityMapper; +import com.gkhy.hazmat.system.service.HzPeculiarityService; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +@Service +public class HzPeculiarityServiceImpl extends ServiceImpl<HzPeculiarityMapper, HzPeculiarity> implements HzPeculiarityService { + @Override + public CommonPage selectPeculiarity(HzPeculiarity hzPeculiarity) { + PageUtils.startPage(); + List<HzPeculiarity> hzPeculiarities = baseMapper.selectPeculiarityBatch(hzPeculiarity); + return CommonPage.restPage(hzPeculiarities); + } + + @Override + public int insertPeculiarity(HzPeculiarity peculiarity) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + HzPeculiarity hzPeculiarity = baseMapper.selectbyPeculiarityNumber(peculiarity.getPeculiarityNumber()); + if (hzPeculiarity!=null){ + throw new ApiException("编号不可重复"); + } + peculiarity.setCreateBy(user.getUsername()); + peculiarity.setCreateTime(LocalDateTime.now()); + int insert = baseMapper.insert(peculiarity); + if (insert<0){ + throw new ApiException("新增失败,请稍后重试"); + } + return insert; + } + + @Override + public int updatePeculiarity(HzPeculiarity peculiarity) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + HzPeculiarity hzPeculiarity = baseMapper.selectbyPeculiarityNumber(peculiarity.getPeculiarityNumber()); + if (hzPeculiarity!=null && hzPeculiarity.getId() != peculiarity.getId()){ + throw new ApiException("编号不可重复"); + } + peculiarity.setUpdateBy(user.getUsername()); + peculiarity.setUpdateTime(LocalDateTime.now()); + int i = baseMapper.updateById(peculiarity); + if (i<0){ + throw new ApiException("修改失败,请稍后重试"); + } + return i; + } + + @Override + public int deletePeculiarity(Long peculiarityId) { + HzPeculiarity hzPeculiarity = baseMapper.selectById(peculiarityId); + if (hzPeculiarity==null){ + throw new ApiException("删除数据不存在"); + } + int row = baseMapper.updatePeculiarity(peculiarityId); + return row; + } + + + @Override + public CommonPage selectList() { + return CommonPage.restPage(baseMapper.select()); + } +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java index c5f0ce9..877a54f 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java @@ -16,9 +16,13 @@ import com.gkhy.hazmat.common.utils.SecurityUtils; import com.gkhy.hazmat.common.utils.StringUtils; import com.gkhy.hazmat.system.domain.HzProductBasic; +import com.gkhy.hazmat.system.domain.vo.HzSecientificVo; +import com.gkhy.hazmat.system.mapper.HzPeculiarityMapper; import com.gkhy.hazmat.system.mapper.HzProductBasicMapper; +import com.gkhy.hazmat.system.mapper.HzSecientificMapper; import com.gkhy.hazmat.system.service.HzProductBasicService; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -39,6 +43,9 @@ */ @Service public class HzProductBasicServiceImpl extends ServiceImpl<HzProductBasicMapper, HzProductBasic> implements HzProductBasicService { + + @Autowired + private HzSecientificMapper secientificMapper; @Override public CommonPage selectProductBasicList(HzProductBasic productBasic) { @@ -68,6 +75,11 @@ SysUser currentUser = SecurityUtils.getLoginUser().getUser(); productBasic.setCreateBy(currentUser.getUsername()); productBasic.setCompanyId(currentUser.getCompanyId()); + + HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(productBasic.getName()); + productBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null); + productBasic.setPeculiarityNumber(hzSecientificVo!=null ? hzSecientificVo.getPeculiarityNumber() : 0); + if (!checkProductSnUnique(productBasic)) { throw new ApiException("产品编号已存在"); } @@ -154,6 +166,9 @@ if(minPackage==null){ throw new ApiException("序号"+productBasicExcelData.getIndex()+"最小包装类型填写不正确"); } + HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(productBasic.getName()); + productBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null); + productBasic.setPeculiarityNumber(hzSecientificVo!=null ? hzSecientificVo.getPeculiarityNumber() : 0); productBasic.setKind(kind); productBasic.setMinPackage(minPackage); productBasic.setCompanyId(currentUser.getCompanyId()); diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java index ff9d8a7..17092ed 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java @@ -160,6 +160,7 @@ //新增危化品变动记录 HzProductWarehouseRecord warehouseRecord = new HzProductWarehouseRecord() .setWarehouseId(entryRecord.getWarehouseId()) + .setCupboardId(entryRecord.getCupboardId()) .setBasicId(productBasic.getId()) .setNum(entryRecord.getNum()) .setCompanyId(currentUser.getCompanyId()) @@ -173,6 +174,7 @@ String lastCode= StringUtils.addZeroForNum(String.valueOf(i),4); String code=String.format("%s%s",entryRecord.getCodePrex(),lastCode); productList.add(new HzProduct().setWarehouseId(entryRecord.getWarehouseId()) + .setCupboardId(entryRecord.getCupboardId()) .setBasicId(entryRecord.getBasicId()) .setEntryId(entryRecord.getId()) .setRemaining(productBasic.getMetering()) diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzSecientificServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzSecientificServiceImpl.java new file mode 100644 index 0000000..cbcc175 --- /dev/null +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzSecientificServiceImpl.java @@ -0,0 +1,128 @@ +package com.gkhy.hazmat.system.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.hazmat.common.api.CommonPage; +import com.gkhy.hazmat.common.domain.entity.SysUser; +import com.gkhy.hazmat.common.excel.ProductBasicExcelData; +import com.gkhy.hazmat.common.excel.ProductBasicExcelDataListener; +import com.gkhy.hazmat.common.excel.SecientificExcelData; +import com.gkhy.hazmat.common.excel.SecientificExcelDataListener; +import com.gkhy.hazmat.common.exception.ApiException; +import com.gkhy.hazmat.common.utils.PageUtils; +import com.gkhy.hazmat.common.utils.SecurityUtils; +import com.gkhy.hazmat.common.utils.StringUtils; +import com.gkhy.hazmat.system.domain.HzProductBasic; +import com.gkhy.hazmat.system.domain.HzSecientific; +import com.gkhy.hazmat.system.domain.vo.HzSecientificVo; +import com.gkhy.hazmat.system.mapper.HzSecientificMapper; +import com.gkhy.hazmat.system.service.HzSecientificService; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +public class HzSecientificServiceImpl extends ServiceImpl<HzSecientificMapper, HzSecientific> implements HzSecientificService { + + @Override + public CommonPage selectSecientific(HzSecientific hzSecientific) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + PageUtils.startPage(); + List<HzSecientificVo> hzSecientificVos = baseMapper.selectSecientificBatch(hzSecientific); + return CommonPage.restPage(hzSecientificVos); + } + + @Override + public int insertSecientific(HzSecientific hzSecientific) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + hzSecientific.setCreateBy(user.getUsername()); + hzSecientific.setCreateTime(LocalDateTime.now()); + int insert = baseMapper.insert(hzSecientific); + if (insert<0){ + throw new ApiException("新增失败"); + } + return insert; + } + + @Override + public int updateSecientific(HzSecientific hzSecientific) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + hzSecientific.setUpdateBy(user.getUsername()); + hzSecientific.setUpdateTime(LocalDateTime.now()); + int row = baseMapper.updateById(hzSecientific); + if (row<0){ + throw new ApiException("修改失败"); + } + return row; + } + + @Override + public int deleteSecientific(Long secientificId) { + int row = baseMapper.deleteById(secientificId); + if (row<0){ + throw new ApiException("删除失败"); + } + return row; + } + + @Override + public Integer importExcel(MultipartFile file) throws IOException { + if(ObjectUtil.isEmpty(file)){ + throw new ApiException("上传对象不能为空"); + } + List<SecientificExcelData> secientificExcelData = EasyExcel.read(file.getInputStream(), SecientificExcelData.class, new SecientificExcelDataListener()).sheet().doReadSync(); + List<HzSecientific> hzSecientifics = new ArrayList<>(); + + SysUser user = SecurityUtils.getLoginUser().getUser(); + + for (SecientificExcelData secientificExcelDatum : secientificExcelData) { + checkData(secientificExcelDatum); + HzSecientific hzSecientific = new HzSecientific(); + BeanUtils.copyProperties(secientificExcelDatum,hzSecientific); + hzSecientific.setCreateBy(user.getUsername()); + hzSecientific.setCreateTime(LocalDateTime.now()); + hzSecientifics.add(hzSecientific); + } + + if(!hzSecientifics.isEmpty()){ + if(hzSecientifics.size()>100){ + int pageSize=100; + while (true){ + List<HzSecientific> secientifics = hzSecientifics.subList(0, Math.min(hzSecientifics.size(), pageSize)); + saveBatch(secientifics); + if(secientifics.size()<pageSize){ + break; + } + hzSecientifics=hzSecientifics.subList(pageSize,hzSecientifics.size()); + if(hzSecientifics.isEmpty()){ + break; + } + } + }else{ + saveBatch(hzSecientifics); + } + } + return hzSecientifics.size(); + } + + private void checkData(SecientificExcelData secientificExcelDatum) { + if(StringUtils.isBlank(secientificExcelDatum.getSecientificName())){ + throw new ApiException("序号"+secientificExcelDatum.getIndex()+"品名为空"); + } + if(StringUtils.isBlank(secientificExcelDatum.getCas())){ + throw new ApiException("序号"+secientificExcelDatum.getIndex()+"CAS码为空"); + } + if(StringUtils.isBlank(secientificExcelDatum.getRiskType())){ + throw new ApiException("序号"+secientificExcelDatum.getIndex()+"危险性类别为空"); + } + if(secientificExcelDatum.getPeculiarityNumber() == null){ + throw new ApiException("序号"+secientificExcelDatum.getIndex()+"危化品特性编码为空"); + } + } +} diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java index 75e775e..6d2360c 100644 --- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java +++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarehouseServiceImpl.java @@ -9,10 +9,16 @@ import com.gkhy.hazmat.common.utils.PageUtils; import com.gkhy.hazmat.common.utils.SecurityUtils; import com.gkhy.hazmat.system.domain.HzWarehouse; +import com.gkhy.hazmat.system.domain.HzWarehouseCupboard; +import com.gkhy.hazmat.system.domain.vo.HzWarehouseVo; import com.gkhy.hazmat.system.mapper.HzWarehouseMapper; import com.gkhy.hazmat.system.service.HzWarehouseService; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -33,8 +39,16 @@ warehouse.setCompanyId(currentUser.getCompanyId()); } PageUtils.startPage(); + List<HzWarehouseVo> hzWarehouseVos = new ArrayList<>(); List<HzWarehouse> warehouseList=baseMapper.selectWarehouseList(warehouse); - return CommonPage.restPage(warehouseList); + for (HzWarehouse hzWarehouseVo : warehouseList) { + HzWarehouseVo hzWarehouseVo1 = new HzWarehouseVo(); + BeanUtils.copyProperties(hzWarehouseVo,hzWarehouseVo1); + List<HzWarehouseCupboard> hzWarehouseCupboards = baseMapper.selectByWarehouseId(hzWarehouseVo.getId()); + hzWarehouseVo1.setWarehouseCupboards(hzWarehouseCupboards); + hzWarehouseVos.add(hzWarehouseVo1); + } + return CommonPage.restPage(hzWarehouseVos); } @Override @@ -112,4 +126,76 @@ } return UserConstant.UNIQUE; } + + /** + * 新增储柜 + * @param hzWarehouseCupboard + * @return + */ + @Override + public int insertCupboard(HzWarehouseCupboard hzWarehouseCupboard) { + if (hzWarehouseCupboard.getWarehouseId()==null){ + throw new ApiException("仓库id不可为空"); + } + List<HzWarehouseCupboard> hzWarehouseCupboards = baseMapper.selectByWarehouseIdAndCupboardName(hzWarehouseCupboard.getWarehouseId(),hzWarehouseCupboard.getCupboardName()); + if (!CollectionUtils.isEmpty(hzWarehouseCupboards)){ + throw new ApiException("存储柜名不可重复"); + } + SysUser user = SecurityUtils.getLoginUser().getUser(); + hzWarehouseCupboard.setCreateBy(user.getUsername()); + hzWarehouseCupboard.setCreateTime(LocalDateTime.now()); + int i = baseMapper.insertCupboard(hzWarehouseCupboard); + if (i<0){ + throw new ApiException("添加存储柜失败"); + } + return i; + } + + /** + * 修改储柜 + * @param hzWarehouseCupboard + * @return + */ + @Override + public int updateCupboard(HzWarehouseCupboard hzWarehouseCupboard) { + if (hzWarehouseCupboard.getWarehouseId()==null){ + throw new ApiException("仓库id不可为空"); + } + List<HzWarehouseCupboard> hzWarehouseCupboards = baseMapper.selectByWarehouseIdAndCupboardName(hzWarehouseCupboard.getWarehouseId(), hzWarehouseCupboard.getCupboardName()); + if (!CollectionUtils.isEmpty(hzWarehouseCupboards) && hzWarehouseCupboard.getId()!=hzWarehouseCupboards.get(0).getId()){ + throw new ApiException("柜名不可重复"); + } + SysUser user = SecurityUtils.getLoginUser().getUser(); + hzWarehouseCupboard.setCreateBy(user.getUsername()); + hzWarehouseCupboard.setCreateTime(LocalDateTime.now()); + int i = baseMapper.updateCupboard(hzWarehouseCupboard); + if (i<0){ + throw new ApiException("修改存储柜失败"); + } + return i; + } + + /** + * 删除储柜 + * @param cupboardId + * @return + */ + @Override + public int deletedCupboard(Long cupboardId) { + int i = baseMapper.deleteByCupboardId(cupboardId); + if (i<0){ + throw new ApiException("删除存储柜失败"); + } + return i; + } + + /** + * 根据仓库获取储柜 + * @param warehouseId + * @return + */ + @Override + public List<HzWarehouseCupboard> selectByWarehouseId(Long warehouseId) { + return baseMapper.selectByWarehouseId(warehouseId); + } } diff --git a/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml index 11781d4..58c19e9 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml @@ -4,6 +4,7 @@ <resultMap type="com.gkhy.hazmat.system.domain.HzEntryRecord" id="HzEntryRecordResult"> <result property="id" column="id" /> <result property="warehouseId" column="warehouse_id" /> + <result property="cupboardId" column="cupboard_id" /> <result property="num" column="num" /> <result property="batchNo" column="batch_no" /> <result property="state" column="state" /> @@ -20,6 +21,7 @@ <result property="remark" column="remark" /> <association property="warehouse" javaType="com.gkhy.hazmat.system.domain.HzWarehouse" resultMap="wareResult" /> <association property="hazmatBasic" javaType="com.gkhy.hazmat.system.domain.HzHazmatBasic" resultMap="hazmatBasicResult" /> + <association property="cupboard" javaType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard" resultMap="cupboardResult"/> </resultMap> @@ -43,16 +45,23 @@ <result property="name" column="warehouse_name" /> </resultMap> + <resultMap id="cupboardResult" type="com.gkhy.hazmat.system.domain.HzWarehouseCupboard"> + <id property="id" column="cupboard_id"/> + <result property="cupboardName" column="cupboard_name"/> + </resultMap> + + <sql id="selectEntryRecordVo"> - select a.id, a.warehouse_id, a.num,a.batch_no,a.state,a.basic_id,a.company_id,a.start_code,a.end_code,a.code_prex,a.version, a.create_by, + select a.id, a.warehouse_id,a.cupboard_id, a.num,a.batch_no,a.state,a.basic_id,a.company_id,a.start_code,a.end_code,a.code_prex,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, b.id as basic_id,b.name as basic_name,b.cas as basic_cas,b.hazmat_type as basic_hazmat_type,b.hazmat_character as basic_hazmat_character, b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn,b.min_package as basic_min_package,b.max_entry, - c.id as warehouse_id,c.name as warehouse_name + c.id as warehouse_id,c.name as warehouse_name,d.id as cupboard_id,d.cupboard_name from hz_entry_record a left join hz_hazmat_basic b on b.id=a.basic_id left join hz_warehouse c on c.id=a.warehouse_id + left join hz_warehouse_cupboard d on a.cupboard_id = d.id </sql> <select id="selectEntryRecordList" resultMap="HzEntryRecordResult" parameterType="com.gkhy.hazmat.system.domain.HzEntryRecord"> diff --git a/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml index b598e3f..eb0373a 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzHazmatBasicMapper.xml @@ -20,6 +20,8 @@ <result property="threshold" column="threshold" /> <result property="productSn" column="product_sn" /> <result property="delFlag" column="del_flag" /> + <result property="peculiarityType" column="peculiarity_type" /> + <result property="peculiarityNumber" column="peculiarity_number" /> <result property="companyId" column="company_id" /> <result property="version" column="version" /> <result property="createBy" column="create_by" /> @@ -33,7 +35,7 @@ <sql id="selectHazmatBasicVo"> select a.id, a.name, a.cas, a.hazmat_type,a.min_package, a.kind,a.hazmat_character,a.supplier,a.manufacturer,a.hazmat_format,a.metering, - a.unit,a.price,a.per_box,a.safe_num,a.threshold,a.product_sn,a.company_id,a.version, a.create_by, a.create_time, + a.unit,a.price,a.per_box,a.safe_num,a.threshold,a.product_sn,a.company_id,a.version,a.peculiarity_type,a.peculiarity_number, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,a.max_entry,b.name as company_name from hz_hazmat_basic a left join sys_company b on b.id=a.company_id diff --git a/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml index 1f28eb0..ab87626 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml @@ -17,6 +17,7 @@ <result property="updateTime" column="update_time" /> <result property="remark" column="remark" /> <result property="warehouseName" column="warehouse_name" /> + <result property="cupboardName" column="cupboard_name" /> <association property="hazmatBasic" javaType="com.gkhy.hazmat.system.domain.HzHazmatBasic" resultMap="hazmatBasicResult" /> </resultMap> @@ -38,10 +39,12 @@ <sql id="selectHazmatVo"> select a.id, a.basic_id, a.warehouse_id, a.code,a.remaining, a.state,a.company_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, b.id as basic_id,b.name as basic_name,b.cas as basic_cas,b.hazmat_type as basic_hazmat_type,b.hazmat_character as basic_hazmat_character, - b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn,b.min_package as basic_min_package,c.name as warehouse_name + b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn, + b.min_package as basic_min_package,c.name as warehouse_name,d.cupboard_name from hz_hazmat a left join hz_hazmat_basic b on b.id=a.basic_id left join hz_warehouse c on c.id=a.warehouse_id + left join hz_warehouse_cupboard d on d.id=a.cupboard_id </sql> <update id="deleteHazmatById" parameterType="com.gkhy.hazmat.system.domain.HzHazmat"> diff --git a/hazmat-system/src/main/resources/mapper/system/HzPeculiarityMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzPeculiarityMapper.xml new file mode 100644 index 0000000..6a066a6 --- /dev/null +++ b/hazmat-system/src/main/resources/mapper/system/HzPeculiarityMapper.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.hazmat.system.mapper.HzPeculiarityMapper"> + <update id="updatePeculiarity"> + update hz_peculiarity set del_flag = 2 where id = #{peculiarityId} + </update> + + <select id="selectPeculiarityBatch" resultType="com.gkhy.hazmat.system.domain.HzPeculiarity"> + select id , peculiarity_type,peculiarity_number,create_time,create_by,update_time,update_by,del_flag from hz_peculiarity + <where> + <if test="peculiarityType!=null and peculiarityType!=''"> + and peculiarity_type =#{peculiarityType} + </if> + <if test="peculiarityNumber!=null"> + and peculiarity_number = #{peculiarityNumber} + </if> + and del_flag = 0 + </where> + </select> + <select id="selectbyPeculiarityNumber" resultType="com.gkhy.hazmat.system.domain.HzPeculiarity"> + select id , peculiarity_type,peculiarity_number,create_time,create_by,update_time,update_by,del_flag from hz_peculiarity + where + peculiarity_number = #{peculiarityNumber} + and del_flag = 0 + </select> + <select id="select" resultType="com.gkhy.hazmat.system.domain.HzPeculiarity"> + select id , peculiarity_type,peculiarity_number,create_time,create_by,update_time,update_by,del_flag from hz_peculiarity + where del_flag = 0 + </select> +</mapper> diff --git a/hazmat-system/src/main/resources/mapper/system/HzProductBasicMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzProductBasicMapper.xml index c1493ec..45150fd 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzProductBasicMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzProductBasicMapper.xml @@ -20,6 +20,8 @@ <result property="delFlag" column="del_flag" /> <result property="companyId" column="company_id" /> <result property="version" column="version" /> + <result property="peculiarityType" column="peculiarity_type" /> + <result property="peculiarityNumber" column="peculiarity_number" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> @@ -31,7 +33,7 @@ <sql id="selectProductBasicVo"> select a.id, a.name, a.cas, a.product_type, a.min_package,a.kind,a.product_character,a.supplier,a.manufacturer,a.product_format,a.metering, - a.unit,a.price,a.per_box,a.product_sn,a.company_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,a.max_entry,b.name as company_name + a.unit,a.price,a.per_box,a.product_sn,a.company_id,a.version,a.peculiarity_type,a.peculiarity_number, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,a.max_entry,b.name as company_name from hz_product_basic a left join sys_company b on b.id=a.company_id </sql> diff --git a/hazmat-system/src/main/resources/mapper/system/HzProductEntryRecordMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzProductEntryRecordMapper.xml index 5675b3e..5a3048b 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzProductEntryRecordMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzProductEntryRecordMapper.xml @@ -20,6 +20,7 @@ <result property="remark" column="remark" /> <association property="productBasic" javaType="com.gkhy.hazmat.system.domain.HzProductBasic" resultMap="productBasicResult" /> <association property="warehouse" javaType="com.gkhy.hazmat.system.domain.HzWarehouse" resultMap="wareResult" /> + <association property="cupboard" javaType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard" resultMap="cupboardResult"/> </resultMap> <resultMap type="com.gkhy.hazmat.system.domain.HzProductBasic" id="productBasicResult"> @@ -42,16 +43,22 @@ <result property="name" column="warehouse_name" /> </resultMap> + <resultMap id="cupboardResult" type="com.gkhy.hazmat.system.domain.HzWarehouseCupboard"> + <id property="id" column="cupboard_id"/> + <id property="cupboardName" column="cupboard_name"/> + </resultMap> + <sql id="selectProductEntryRecordVo"> select a.id, a.warehouse_id, a.num,a.batch_no,a.state,a.basic_id,a.company_id,a.start_code,a.end_code,a.code_prex,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, b.id as basic_id,b.name as basic_name,b.cas as basic_cas,b.product_type as basic_product_type,b.product_character as basic_product_character, b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn,b.min_package as basic_min_package,b.max_entry, - c.id as warehouse_id,c.name as warehouse_name + c.id as warehouse_id,c.name as warehouse_name,d.id as cupboard_id,d.cupboard_name from hz_product_entry_record a left join hz_product_basic b on b.id=a.basic_id left join hz_warehouse c on c.id=a.warehouse_id + left join hz_warehouse_cupboard d on d.id = a.cupboard_id </sql> <select id="selectEntryRecordList" resultMap="HzProductEntryRecordResult" parameterType="com.gkhy.hazmat.system.domain.HzProductEntryRecord"> diff --git a/hazmat-system/src/main/resources/mapper/system/HzProductMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzProductMapper.xml index 9667570..816e1d1 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzProductMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzProductMapper.xml @@ -5,6 +5,7 @@ <result property="id" column="id" /> <result property="basicId" column="basic_id" /> <result property="warehouseId" column="warehouse_id" /> + <result property="cupboardId" column="cupboard_id" /> <result property="remaining" column="remaining" /> <result property="state" column="state" /> <result property="code" column="code" /> @@ -17,6 +18,7 @@ <result property="updateTime" column="update_time" /> <result property="remark" column="remark" /> <result property="warehouseName" column="warehouse_name" /> + <result property="cupboardName" column="cupboard_name"/> <association property="productBasic" javaType="com.gkhy.hazmat.system.domain.HzProductBasic" resultMap="productBasicResult" /> </resultMap> @@ -37,10 +39,12 @@ <sql id="selectProductVo"> select a.id, a.basic_id,a.code, a.warehouse_id, a.remaining, a.state,a.company_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, b.id as basic_id,b.name as basic_name,b.cas as basic_cas,b.product_type as basic_product_type,b.product_character as basic_product_character, - b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn,b.min_package as basic_min_package,c.name as warehouse_name + b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn, + b.min_package as basic_min_package,c.name as warehouse_name,d.cupboard_name from hz_product a left join hz_product_basic b on b.id=a.basic_id left join hz_warehouse c on c.id=a.warehouse_id + left join hz_warehouse_cupboard d on d.id = a.cupboard_id </sql> <update id="deleteProductById" parameterType="java.lang.Long"> diff --git a/hazmat-system/src/main/resources/mapper/system/HzSecientificMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzSecientificMapper.xml new file mode 100644 index 0000000..893e518 --- /dev/null +++ b/hazmat-system/src/main/resources/mapper/system/HzSecientificMapper.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.hazmat.system.mapper.HzSecientificMapper"> + + <select id="selectSecientificBatch" resultType="com.gkhy.hazmat.system.domain.vo.HzSecientificVo"> + SELECT + hs.id, + hs.secientific_name, + hs.alias_name, + hs.cas, + hs.risk_type, + hs.remark, + hs.peculiarity_number, + hs.create_by, + hs.create_time, + hs.update_by, + hs.update_time, + hs.del_flag, + hp.peculiarity_type + FROM + hz_secientific hs + LEFT JOIN hz_peculiarity hp ON hs.peculiarity_number = hp.peculiarity_number + <where> + <if test="secientificName!=null and secientificName!=''"> + and secientific_name =#{secientificName} + </if> + and hs.del_flag = 0 + </where> + </select> + <select id="selectBySecientificName" resultType="com.gkhy.hazmat.system.domain.vo.HzSecientificVo"> + SELECT + hs.id, + hs.secientific_name, + hs.alias_name, + hs.cas, + hs.risk_type, + hs.remark, + hs.peculiarity_number, + hs.create_by, + hs.create_time, + hs.update_by, + hs.update_time, + hs.del_flag, + hp.peculiarity_type + FROM + hz_secientific hs + LEFT JOIN hz_peculiarity hp ON hs.peculiarity_number = hp.peculiarity_number + where secientific_name = #{name} and hs.del_flag = 0 + </select> +</mapper> diff --git a/hazmat-system/src/main/resources/mapper/system/HzWarehouseMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzWarehouseMapper.xml index c22f98e..5f213fe 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzWarehouseMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzWarehouseMapper.xml @@ -22,9 +22,46 @@ from hz_warehouse a left join sys_company b on b.id=a.company_id </sql> + <insert id="insertCupboard"> + insert into hz_warehouse_cupboard + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="warehouseId != null">warehouse_id,</if> + <if test="cupboardName != null and cupboardName != ''">cupboard_name,</if> + <if test="mess != null and mess != ''">mess,</if> + <if test="createBy != null">create_by,</if> + <if test="createTime != null">create_time,</if> + <if test="updateBy != null and updateBy != ''">update_by,</if> + <if test="updateTime != null">update_time,</if> + <if test="delFlag != null">del_flag,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="warehouseId != null">#{warehouseId},</if> + <if test="cupboardName != null and cupboardName != ''">#{cupboardName},</if> + <if test="mess != null and mess != ''">#{mess},</if> + <if test="createBy != null">#{createBy},</if> + <if test="createTime != null">#{createTime},</if> + <if test="updateBy != null and updateBy != ''">#{updateBy},</if> + <if test="updateTime != null">#{updateTime},</if> + <if test="delFlag != null">#{delFlag},</if> + </trim> + </insert> <update id="deleteWarehouseById" parameterType="java.lang.Long"> update hz_warehouse set del_flag=1 where id=#{warehouseId} </update> + <update id="updateCupboard"> + update hz_warehouse_cupboard + <trim prefix="SET" suffixOverrides=","> + <if test="cupboardName != null">cupboard_name = #{cupboardName},</if> + <if test="mess != null and mess != ''">mess = #{mess},</if> + <if test="updateBy != null">update_by = #{updateBy},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> + <if test="delFlag != null">del_flag = #{delFlag},</if> + </trim> + where id = #{id} + </update> + <delete id="deleteByCupboardId"> + delete from hz_warehouse_cupboard where id = #{cupboardId} + </delete> <select id="checkNameUnique" resultType="com.gkhy.hazmat.system.domain.HzWarehouse"> select id,name from hz_warehouse where name=#{name} and company_id=#{companyId} and del_flag=0 limit 1 @@ -51,4 +88,38 @@ #{warehouse} </foreach> </select> + <select id="selectByWarehouseIdAndCupboardName" resultType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard"> + SELECT + id, + warehouse_id, + cupboard_name, + mess, + create_by, + create_time, + update_by, + update_time, + del_flag + FROM + hz_warehouse_cupboard + WHERE + warehouse_id = #{id} and cupboard_name =#{cupboardName} + AND del_flag = 0 + </select> + <select id="selectByWarehouseId" resultType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard"> + SELECT + id, + warehouse_id, + cupboard_name, + mess, + create_by, + create_time, + update_by, + update_time, + del_flag + FROM + hz_warehouse_cupboard + WHERE + warehouse_id = #{id} + AND del_flag = 0 + </select> </mapper> diff --git a/hazmat-system/src/main/resources/mapper/system/HzWarehouseRecordMapper.xml b/hazmat-system/src/main/resources/mapper/system/HzWarehouseRecordMapper.xml index 1d375c5..aa92cb7 100644 --- a/hazmat-system/src/main/resources/mapper/system/HzWarehouseRecordMapper.xml +++ b/hazmat-system/src/main/resources/mapper/system/HzWarehouseRecordMapper.xml @@ -19,6 +19,7 @@ <result property="createName" column="create_name" /> <association property="hazmatBasic" javaType="com.gkhy.hazmat.system.domain.HzHazmatBasic" resultMap="hazmatBasicResult" /> <association property="warehouse" javaType="com.gkhy.hazmat.system.domain.HzWarehouse" resultMap="wareResult" /> + <association property="cupboard" javaType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard" resultMap="cupboardResult"/> </resultMap> <resultMap id="hazmatBasicResult" type="com.gkhy.hazmat.system.domain.HzHazmatBasic"> @@ -40,14 +41,20 @@ <result property="name" column="warehouse_name" /> </resultMap> + <resultMap id="cupboardResult" type="com.gkhy.hazmat.system.domain.HzWarehouseCupboard"> + <id property="id" column="cupboard_id"/> + <result property="cupboardName" column="cupboard_name"/> + </resultMap> + <sql id="selectWarehouseRecordVo"> select a.id, a.basic_id, a.warehouse_id,a.remaining,a.num,a.state,a.company_id,a.create_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, b.id as hazmat_id,b.name as hazmat_name,b.cas as hazmat_cas,b.hazmat_type ,b.hazmat_character,b.supplier as hazmat_supplier,b.manufacturer as hazmat_manufacturer, b.hazmat_format,b.metering as hazmat_metering,b.unit as hazmat_unit,b.product_sn as hazmat_product_sn, - c.id as warehouse_id,c.name as warehouse_name,d.name as create_name + c.id as warehouse_id,c.name as warehouse_name,e.id as cupboard_id,e.cupboard_name,d.name as create_name from hz_warehouse_record a left join hz_hazmat_basic b on b.id=a.basic_id left join hz_warehouse c on c.id=a.warehouse_id + left join hz_warehouse_cupboard e on e.id = a.cupboard_id left join sys_user d on d.id =a.create_id </sql> -- Gitblit v1.9.2