From e6ffa9fcebef022be1e8e8162c65f52754f9081e Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期六, 19 八月 2023 15:11:22 +0800
Subject: [PATCH] 基础数据
---
standard-server/src/main/resources/mapper/SpecificationsMapper.xml | 11
inspection-server/src/main/resources/mapper/RawMaterialMapper.xml | 12
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductModelController.java | 106 +++++++
standard-server/src/main/resources/mapper/MaterialMapper.xml | 17
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java | 28 -
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java | 28 +
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java | 22 +
inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/LinkBasicInformationMapper.java | 8
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/LinkBasicInformationServiceImpl.java | 8
standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductModelMapper.java | 32 ++
standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java | 2
standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java | 8
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java | 57 ++
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/LinkBasicInformationService.java | 8
inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/RawMaterialMapper.java | 2
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java | 2
standard-server/src/main/resources/mapper/ProductModelMapper.xml | 43 ++
standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/ProductModelDto.java | 33 ++
standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductModelService.java | 77 +++++
standard-server/src/main/resources/mapper/ProductMapper.xml | 36 +-
inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java | 25 -
sys/src/main/resources/application-dev.yml | 2
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java | 40 -
standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java | 1
standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/MaterialMapper.java | 7
standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java | 7
standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/ProductModel.java | 69 ++++
standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java | 4
inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml | 45 +-
standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java | 14
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/RawMaterialService.java | 8
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java | 8
standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java | 9
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java | 2
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RawMaterialServiceImpl.java | 16 -
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductModelServiceImpl.java | 95 ++++++
36 files changed, 669 insertions(+), 223 deletions(-)
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java
index 027e223..ff18b98 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java
@@ -82,31 +82,6 @@
}
- @ApiOperation(value = "閫夋嫨鍘熸潗鏂欐姤妫�")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(name = "id", value = "鍘熸潗鏂欐姤妫�鍗昳d", dataTypeClass = Integer.class, required = true),
- @ApiImplicitParam(name = "startTime", value = "妫�楠屽紑濮嬫棩鏈�", dataTypeClass = String.class, required = true),
- @ApiImplicitParam(name = "endTime", value = "妫�楠岀粨鏉熸棩鏈�", dataTypeClass = String.class, required = true)
- })
- @GetMapping("/selectRawmaById")
- public Result selectRawmaById(Integer id, String startTime, String endTime) throws ParseException {
- return Result.success(rawMaterialService.selectRawmaById(id, startTime, endTime));
- }
-
-
- @ApiOperation(value = "閫夋嫨濮旀墭鎶ユ鍜屾牱鍝�")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(name = "bid", value = "濮旀墭鎶ユ鍗昳d", dataTypeClass = Integer.class, required = true),
- @ApiImplicitParam(name = "did", value = "濮旀墭鎶ユ鏍峰搧id", dataTypeClass = Integer.class, required = true)
- })
-
-
- @GetMapping("/selectLinkByid")
- public Result selectLinkByid(Integer bid, Integer did) {
- return Result.success(linkBasicInformationService.selectLinkByid(bid, did));
- }
-
-
@ApiOperation(value = "鏂板妫�楠屽崟")
@PostMapping("/addInspect")
public Result addInspect(@RequestHeader("token") String token, @RequestBody InspectionVo inspectionVo) throws Exception {
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/LinkBasicInformationMapper.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/LinkBasicInformationMapper.java
index 95e0c2a..dfb1e46 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/LinkBasicInformationMapper.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/LinkBasicInformationMapper.java
@@ -27,11 +27,5 @@
*/
List<Map<String, Object>> selectLinkAll();
- /**
- * 閫夋嫨濮旀墭鐢宠鍜屾牱鍝�
- * @param bid
- * @param did
- * @return
- */
- InspectionVo selectLinkByid(Integer bid, Integer did);
+
}
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/RawMaterialMapper.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/RawMaterialMapper.java
index 567cf9f..f728459 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/RawMaterialMapper.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/RawMaterialMapper.java
@@ -26,5 +26,5 @@
List<RawMaterial> selectRawmaAll();
- InspectionVo selectRawmaById(Integer id);
+
}
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/LinkBasicInformationService.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/LinkBasicInformationService.java
index 02b7207..c347bca 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/LinkBasicInformationService.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/LinkBasicInformationService.java
@@ -31,11 +31,5 @@
*/
List<Map<String, Object>> selectLinkAll();
- /**
- * 鏍规嵁濮旀墭妫�楠宨d鍜屾牱鍝乮d鏌ヨ濮旀墭妫�楠屽拰鏍峰搧
- * @param bid
- * @param did
- * @return
- */
- InspectionVo selectLinkByid(Integer bid, Integer did);
+
}
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/RawMaterialService.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/RawMaterialService.java
index 143225f..fbe9206 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/RawMaterialService.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/RawMaterialService.java
@@ -31,11 +31,5 @@
*/
List<RawMaterial> selectRawmaAll();
- /**
- * 閫夋嫨鍘熸潗鏂欐姤妫�
- *
- * @param id
- * @return
- */
- InspectionVo selectRawmaById(Integer id, String startTime, String endTime) throws ParseException;
+
}
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/LinkBasicInformationServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/LinkBasicInformationServiceImpl.java
index 5090428..b14dab9 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/LinkBasicInformationServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/LinkBasicInformationServiceImpl.java
@@ -56,11 +56,5 @@
return linkBasicInformationMapper.selectLinkAll();
}
- //鏍规嵁濮旀墭妫�楠宨d鍜屾牱鍝乮d鏌ヨ濮旀墭妫�楠屽拰鏍峰搧
- @Override
- public InspectionVo selectLinkByid(Integer bid, Integer did) {
- InspectionVo inspectionVo = linkBasicInformationMapper.selectLinkByid(bid, did);
- inspectionVo.setType(1);
- return inspectionVo;
- }
+
}
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RawMaterialServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RawMaterialServiceImpl.java
index 2722a1a..7b93cf3 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RawMaterialServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/RawMaterialServiceImpl.java
@@ -60,19 +60,5 @@
return rawMaterialMapper.selectRawmaAll();
}
- /**
- * 閫夋嫨鍘熸潗鏂欐姤妫�
- *
- * @param id
- * @return
- */
- @Override
- public InspectionVo selectRawmaById(Integer id, String startTime, String endTime) throws ParseException {
- InspectionVo inspectionVo = rawMaterialMapper.selectRawmaById(id);
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
- inspectionVo.setStartTime(formatter.parse(startTime));
- inspectionVo.setEndTime(formatter.parse(endTime));
- inspectionVo.setType(0);
- return inspectionVo;
- }
+
}
diff --git a/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml b/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml
index ab4c4eb..456ca9e 100644
--- a/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml
+++ b/inspection-server/src/main/resources/mapper/LinkBasicInformationMapper.xml
@@ -1,11 +1,12 @@
<?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.yuanchu.limslaboratory.mapper.LinkBasicInformationMapper">
-
<select id="getLinkBasicPage" resultType="map">
- SELECT l.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`, d.`specifications_models`,
- DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, DATE_FORMAT(l.`completion_deadline`,'%Y-%m-%d') completionDeadline, l.`contacts`,
- DATE_FORMAT(d.`date_survey`,'%Y-%m-%d') dateSurvey, d.`inspection_status`
+ SELECT l.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`,
+ d.`specifications_models`,
+ DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, DATE_FORMAT(l.`completion_deadline`,'%Y-%m-%d')
+ completionDeadline, l.`contacts`,
+ DATE_FORMAT(d.`date_survey`,'%Y-%m-%d') dateSurvey, d.`inspection_status`
FROM link_basic_information l, link_detection d
WHERE l.`id` = d.`link_basic_id`
AND l.`state` = 1
@@ -24,31 +25,19 @@
</select>
<select id="selectLinkAll" resultType="java.util.Map">
- SELECT l.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`, d.`specifications_models`,
- DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, l.`completion_deadline`, l.`contacts`, d.`date_survey`, d.`inspection_status`
- FROM lims_laboratory.link_basic_information l, lims_laboratory.link_detection d
- WHERE l.`id` = d.`link_basic_id`
- AND l.`state` = 1
- </select>
-
- <select id="selectLinkByid" resultType="com.yuanchu.limslaboratory.pojo.vo.InspectionVo">
- SELECT l.`inspection_time` formTime,
- l.`entrusted` supplier,
- d.`sample_number` mcode,
- d.`sample_name` name,
- d.`specifications_models` specifications,
- d.`unit`,
- d.`samples_number` num,
- d.date_survey startTime,
- l.completion_deadline endTime
- FROM lims_laboratory.link_basic_information l, lims_laboratory.link_detection d
+ SELECT DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') formTime,
+ l.`entrusted` supplier,
+ d.`sample_number` mcode,
+ d.`sample_name` name,
+ d.`specifications_models` specifications,
+ d.`unit`,
+ d.`samples_number` num,
+ DATE_FORMAT(date_survey,'%Y-%m-%d') startTime,
+ DATE_FORMAT(completion_deadline,'%Y-%m-%d') endTime
+ FROM lims_laboratory.link_basic_information l,
+ lims_laboratory.link_detection d
WHERE l.`id` = d.`link_basic_id`
AND l.`state` = 1
- <if test="bid!=null">
- and l.id=#{bid}
- </if>
- <if test="did!=null">
- and d.id=#{did}
- </if>
</select>
+
</mapper>
diff --git a/inspection-server/src/main/resources/mapper/RawMaterialMapper.xml b/inspection-server/src/main/resources/mapper/RawMaterialMapper.xml
index 5cffc9a..6dc7c1a 100644
--- a/inspection-server/src/main/resources/mapper/RawMaterialMapper.xml
+++ b/inspection-server/src/main/resources/mapper/RawMaterialMapper.xml
@@ -23,15 +23,5 @@
select * from lims_laboratory.raw_material where state=1
</select>
- <select id="selectRawmaById" resultType="com.yuanchu.limslaboratory.pojo.vo.InspectionVo">
- select create_time formTime,
- supplier_name supplier,
- material_coding mcode,
- material_name name,
- specifications_models specifications,
- unit ,
- quantity num
- from lims_laboratory.raw_material
- where id=#{id}
- </select>
+
</mapper>
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java
index 8a89867..fc0c456 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java
@@ -30,7 +30,13 @@
@Autowired
private MaterialService materialService;
- @ApiOperation("娣诲姞鐗╂枡")
+ @ApiOperation(value = "娣诲姞鎸囨爣-->閫夋嫨鏍峰搧鍚嶇О")
+ @GetMapping("/selectmater")
+ public Result selectmater() {
+ return Result.success(materialService.selectmater());
+ }
+
+ @ApiOperation("娣诲姞鎸囨爣")
@PostMapping("/add")
public Result<?> addMaterialInformation(@Validated @RequestBody AddMaterialDto addMaterialDto) {
Integer isMaterialSuccess = materialService.addMaterialInformation(addMaterialDto);
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java
index 5853e6a..cc804a8 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java
@@ -15,7 +15,7 @@
/**
* <p>
- * 鍓嶇鎺у埗鍣�
+ * 鍓嶇鎺у埗鍣�
* </p>
*
* @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
@@ -29,29 +29,15 @@
@Autowired
private ProductService productService;
- @ApiOperation("1銆佸垎椤垫煡璇㈤」鐩�")
+ @ApiOperation("鏌ヨ璇ュ瀷鍙蜂笅鐨勯」鐩�")
@ApiImplicitParams(value = {
- @ApiImplicitParam(name = "pageNo", value = "璧峰椤�", dataTypeClass = Integer.class, required = true),
- @ApiImplicitParam(name = "pageSize", value = "姣忎竴椤垫暟閲�", dataTypeClass = Integer.class, required = true),
- @ApiImplicitParam(name = "specificationsId", value = "瑙勬牸鍨嬪彿ID", dataTypeClass = Integer.class, required = true),
- @ApiImplicitParam(value = "鍘熸潗鏂欑紪鐮�/鍘熸潗鏂欏悕绉�", name = "productCodeOrName", dataTypeClass = String.class)
+ @ApiImplicitParam(name = "specificationsId", value = "鍨嬪彿ID", dataTypeClass = Integer.class, required = true)
})
@GetMapping("/page")
- public Result<?> pageProductInformation(Integer pageNo, Integer pageSize, Integer specificationsId, String productCodeOrName) {
- IPage<Map<String, Object>> maps = productService.pageProductInformation(productCodeOrName, specificationsId, new Page<Objects>(pageNo, pageSize));
- Map<String, Object> map = new HashMap<>();
- map.put("row", maps.getRecords());
- map.put("total", maps.getTotal());
- return Result.success(map);
+ public Result<?> pageProductInformation(Integer specificationsId) {
+ return Result.success(productService.pageProductInformation(specificationsId));
}
- @ApiOperation("2銆佹牴鎹埗绫绘煡瀛愮被")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(value = "鐖剁被鍚嶇О", name = "fatherName", dataTypeClass = String.class)
- })
- @GetMapping("/father")
- public Result<?> pageFatherNameProductInformation(String fatherName) {
- List<Map<String, Object>> maps = productService.pageFatherNameProductInformation(fatherName);
- return Result.success(maps);
- }
+ //@ApiOperation("濉啓鏍囧噯鍊间笌鍐呮帶鍊�,榧犳爣绉诲紑淇濆瓨")
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductModelController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductModelController.java
new file mode 100644
index 0000000..15fa65e
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductModelController.java
@@ -0,0 +1,106 @@
+package com.yuanchu.limslaboratory.controller;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto;
+import com.yuanchu.limslaboratory.pojo.dto.ProductModelDto;
+import com.yuanchu.limslaboratory.vo.Result;
+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.*;
+import com.yuanchu.limslaboratory.service.ProductModelService;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * 鍩虹椤圭洰妯$増琛�(ProductModel)琛ㄦ帶鍒跺眰
+ *
+ * @author zss
+ * @since 2023-08-19 11:00:39
+ */
+@Api(tags = "鍩虹鏁版嵁-->鏍囧噯缁存姢")
+@RestController
+@RequestMapping("/productModel")
+public class ProductModelController {
+
+ @Autowired
+ private ProductModelService productModelService;
+
+ @ApiOperation(value = "閫夋嫨鏍峰搧鍚嶇О")
+ @GetMapping("/selectmater")
+ public Result selectmater() {
+ return Result.success(productModelService.selectmater());
+ }
+
+ @ApiOperation(value = "娣诲姞鏍囧噯-->閫夋嫨椤圭洰鍒嗙粍")
+ @GetMapping("/selectfather")
+ public Result selectfather() {
+ return Result.success(productModelService.selectfather());
+ }
+
+ @ApiOperation("娣诲姞鏍囧噯")
+ @PostMapping("/addproductModel")
+ public Result<?> addproductModel(@Validated @RequestBody ProductModelDto productModelDto) {
+ productModelService.addproductModel(productModelDto);
+ return Result.success("娣诲姞鏍囧噯椤圭洰銆�" + productModelDto.getName() + "銆戞垚鍔燂紒");
+ }
+
+ @ApiOperation(value = "鏌ヨ鏍囧噯妯$増鍒楄〃")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "name", value = "椤圭洰鍚嶇О", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "father", value = "椤圭洰鍒嗙粍", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "material", value = "鏍峰搧鍚嶇О", dataTypeClass = String.class, required = true)
+ })
+ @GetMapping("/selectproductModel")
+ public Result selectproductModel(String name, String father, String material) {
+ return Result.success(productModelService.selectproductModel(name, father, material));
+ }
+
+ @ApiOperation(value = "鏍规嵁id鏌ヨ")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鏍囧噯妯$増id", dataTypeClass = Integer.class, required = true)
+ })
+ @GetMapping("/selectproductModelById")
+ public Result selectproductModelById(Integer id) {
+ return Result.success(productModelService.selectproductModelById(id));
+ }
+
+ @ApiOperation("缂栬緫")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鏍囧噯妯$増id", dataTypeClass = Integer.class, required = true)
+ })
+ @PostMapping("/writeproductModel")
+ public Result<?> writeproductModel(Integer id, @Validated @RequestBody ProductModelDto productModelDto) {
+ productModelService.writeproductModel(id,productModelDto);
+ return Result.success("淇敼鏍囧噯椤圭洰銆�" + productModelDto.getName() + "銆戞垚鍔燂紒");
+ }
+
+ @ApiOperation("鍒犻櫎")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "鏍囧噯妯$増id", dataTypeClass = Integer.class, required = true)
+ })
+ @PostMapping("/delproductModel")
+ public Result<?> delproductModel(Integer id) {
+ productModelService.delproductModel(id);
+ return Result.success("鍒犻櫎鏍囧噯椤圭洰鎴愬姛锛�");
+ }
+
+ @ApiOperation("鎵归噺鍒犻櫎")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "ids", value = "鏍囧噯妯$増id", dataTypeClass = String.class, required = true)
+ })
+ @PostMapping("/delAllproductModel")
+ public Result<?> delAllproductModel(String ids) {
+ productModelService.delAllproductModel(ids);
+ return Result.success("鎵归噺鍒犻櫎鏍囧噯椤圭洰鎴愬姛锛�");
+ }
+
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java
index 4be696a..17d1426 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java
@@ -39,7 +39,7 @@
return Result.fail("娣诲姞鐗╂枡銆�"+ addSpecifications.getSpecificationsName() +"銆戝け璐ワ紒");
}
- @ApiOperation("鍒犻櫎浜у搧瑙勬牸")
+ @ApiOperation("鍒犻櫎浜у搧鍨嬪彿")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "specificationsId", value = "瑙勬牸Id", dataTypeClass = Integer.class, required = true)
})
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java
index 665f006..98ac612 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java
@@ -35,7 +35,7 @@
return Result.fail("娣诲姞鐗╂枡銆�"+ addStandardDto.getStandardName() +"銆戝け璐ワ紒");
}
- @ApiOperation("鏍规嵁ID鍒犻櫎鏁版嵁")
+ @ApiOperation("鏍规嵁ID鍒犺鏍�")
@DeleteMapping("/delete")
public Result<?> deleteStandardsInformation(Integer standardsId) {
Integer isDeleteMaterialSuccess = standardService.deleteStandardInformation(standardsId);
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/MaterialMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/MaterialMapper.java
index 0408808..08b370e 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/MaterialMapper.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/MaterialMapper.java
@@ -16,6 +16,7 @@
*/
public interface MaterialMapper extends BaseMapper<Material> {
+
//鏌ヨ鐗╂枡淇℃伅
List<Map> selectMaterialLimit(int num1,int num2, int type);
@@ -24,4 +25,10 @@
// 鍥涚骇鏍�
List<Map<String, Object>> FourTree(String specificationsName);
+
+ //閫夋嫨鏍峰搧鍚嶇О
+ List<String> selectmater();
+
+
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java
index cbf5b02..ff4ec4e 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java
@@ -23,12 +23,9 @@
//鏍规嵁鐗╂枡id鏌ヨ妫�楠岄」鐩�
List<Map> selectProductByMaterialId(int materialId);
- IPage<Map<String, Object>> pageProductInformation(String productCodeOrName, Integer specificationsId, Page<Objects> page);
+ //灞曠ず璇ュ瀷鍙蜂笅鐨勬楠岄」鐩姹�
+ List<Map<String, Object>> pageProductInformation(Integer specificationsId);
- Map<String, Object> selectOneChildren(Object father);
- Map<String, Object> getProductInformation(Integer productId);
- //閫氳繃椤圭洰鍚嶆煡璇㈤」鐩殑璇曢獙鏂规硶
- List<Map> selectInstrumentByProname(String name);
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductModelMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductModelMapper.java
new file mode 100644
index 0000000..659a0c3
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductModelMapper.java
@@ -0,0 +1,32 @@
+package com.yuanchu.limslaboratory.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yuanchu.limslaboratory.pojo.ProductModel;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍩虹椤圭洰妯$増琛�(ProductModel)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author zss
+ * @since 2023-08-19 11:00:39
+ */
+public interface ProductModelMapper extends BaseMapper<ProductModel> {
+
+ //鏌ヨ鏍囧噯妯$増鍒楄〃
+ List<Map<String, Object>> selectproductModel(String name, String father, String material);
+
+ //鎵归噺鍒犻櫎
+ void delAllproductModel(String ids);
+
+ //娣诲姞鏍囧噯-->閫夋嫨椤圭洰鍒嗙粍
+ List<String> selectfather();
+
+
+
+
+ //鏌ヨ椤圭洰妯$増鏍规嵁鏍峰搧鍚�
+ List<Map<String, Object>> seleMode(String name);
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java
index 3db0724..27a06a0 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java
@@ -21,4 +21,8 @@
Map<String, Object> selectSNameSNName(int materialId);
IPage<Map<String, Objects>> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page);
+
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鐗╂枡鍚嶇О
+ String selMateName(Integer standardId);
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java
index f76bc42..e3f3a1d 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java
@@ -39,7 +39,7 @@
@ApiModelProperty(value = "鐗╂枡鍚嶇О", example = "鐭冲ご", required = true)
private String name;
- @ApiModelProperty(value = "0锛氬師鏉愭枡锛�1锛氭垚鍝侊紱2锛氬崐鎴愬搧", example = "1", required = true)
+ @ApiModelProperty(value = "0锛氬師鏉愭枡锛�1锛氭垚鍝侊紱2锛氬崐鎴愬搧", example = "1")
private Integer type;
@TableLogic(value = "1", delval = "0")
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java
index 707d80e..14a985e 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java
@@ -31,22 +31,22 @@
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
- @ApiModelProperty(value = "椤圭洰鍚嶇О", example = "鍗曚綅闀垮害璐ㄩ噺", required = true)
+ @ApiModelProperty(value = "椤圭洰鍚嶇О", example = "閾濆寘閽㈣姱閾濈粸绾�", required = true)
private String name;
- @ApiModelProperty(value = "椤圭洰鐖剁被", example = "閾濆寘閽㈣姱閾濈粸绾�")
+ @ApiModelProperty(value = "椤圭洰鐖剁被", example = "鍗曚綅闀垮害璐ㄩ噺")
private String father;
- @ApiModelProperty(value = "鍗曚綅", example = "km", required = true)
+ @ApiModelProperty(value = "鍗曚綅", example = "km")
private String unit;
- @ApiModelProperty(value = "鏍囧噯鍊�", example = "<=0.3458", required = true)
+ @ApiModelProperty(value = "鏍囧噯鍊�", example = "<=0.3458")
private String required;
- @ApiModelProperty(value = "鍐呮帶鍊�", example = "<=0.3458", required = true)
+ @ApiModelProperty(value = "鍐呮帶鍊�", example = "<=0.3458")
private String internal;
- @TableLogic(value = "1", delval = "0")
+
@ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true)
private Integer state;
@@ -63,7 +63,7 @@
@ApiModelProperty(value = "涔愯閿�", hidden = true)
private Integer version;
- @ApiModelProperty(value = "鍏宠仈 鐗╂枡id", example = "1", hidden = true)
+ @ApiModelProperty(value = "鍏宠仈 鍨嬪彿id", example = "1", hidden = true)
private Integer specifications_id;
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/ProductModel.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/ProductModel.java
new file mode 100644
index 0000000..8972287
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/ProductModel.java
@@ -0,0 +1,69 @@
+package com.yuanchu.limslaboratory.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.io.Serializable;
+
+/**
+ * 鍩虹椤圭洰妯$増琛�(ProductModel)琛ㄥ疄浣撶被
+ *
+ * @author zss
+ * @since 2023-08-19 11:00:40
+ */
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+@TableName("product_model")
+public class ProductModel implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ **/
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 椤圭洰鍚嶇О
+ **/
+ private String name;
+
+ /**
+ * 椤圭洰鐖剁被
+ **/
+ private String father;
+
+ /**
+ * 鍗曚綅
+ **/
+ private String unit;
+
+ @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true)
+ private Integer state;
+
+ @TableField(fill = FieldFill.INSERT)
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿", hidden = true)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @ApiModelProperty(value = "鏇存柊鏃堕棿", hidden = true)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date updateTime;
+
+ /**
+ * 鏍峰搧鍚嶇О
+ **/
+ private String material;
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/ProductModelDto.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/ProductModelDto.java
new file mode 100644
index 0000000..8b76910
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/ProductModelDto.java
@@ -0,0 +1,33 @@
+package com.yuanchu.limslaboratory.pojo.dto;
+
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+//娣诲姞鏍囧噯鍙傛暟
+public class ProductModelDto {
+
+ /**
+ * 椤圭洰鍚嶇О
+ **/
+ @NotBlank(message = "椤圭洰鍚嶇О涓嶈兘涓虹┖")
+ private String name;
+
+ /**
+ * 椤圭洰鐖剁被
+ **/
+ private String father;
+
+ /**
+ * 鍗曚綅
+ **/
+ private String unit;
+
+ /**
+ * 鏍峰搧鍚嶇О
+ **/
+ @NotBlank(message = "鏍峰搧鍚嶇О涓嶈兘涓虹┖")
+ private String material;
+}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java
index 56e5501..f6b8b81 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java
@@ -39,4 +39,12 @@
* 鍥涚骇鍒嗗眰鏄剧ず
*/
List<Map<String, Object>> getFourLevelInformation(String specificationName);
+
+
+ /**
+ * 娣诲姞鎸囨爣-->閫夋嫨鏍峰搧鍚嶇О
+ * @return
+ */
+ List<String> selectmater();
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductModelService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductModelService.java
new file mode 100644
index 0000000..144d1bf
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductModelService.java
@@ -0,0 +1,77 @@
+package com.yuanchu.limslaboratory.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.limslaboratory.pojo.ProductModel;
+import com.yuanchu.limslaboratory.pojo.dto.ProductModelDto;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍩虹椤圭洰妯$増琛�(ProductModel)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author zss
+ * @since 2023-08-19 11:00:39
+ */
+public interface ProductModelService extends IService<ProductModel> {
+
+ /**
+ * 閫夋嫨鏍峰搧鍚嶇О
+ * @return
+ */
+ List<String> selectmater();
+
+ /**
+ * 娣诲姞鏍囧噯-->閫夋嫨椤圭洰鍒嗙粍
+ * @return
+ */
+ List<String> selectfather();
+
+ /**
+ * 娣诲姞鏍囧噯
+ * @param productModelDto
+ */
+ void addproductModel(ProductModelDto productModelDto);
+
+
+ /**
+ * 鏌ヨ鏍囧噯妯$増鍒楄〃
+ * @param name
+ * @param father
+ * @param material
+ * @return
+ */
+ List<Map<String,Object>> selectproductModel(String name, String father, String material);
+
+ /**
+ * 鏍规嵁id鏌ヨ
+ * @param id
+ * @return
+ */
+ ProductModelDto selectproductModelById(Integer id);
+
+ /**
+ * 缂栬緫
+ * @param id
+ * @param productModelDto
+ */
+ void writeproductModel(Integer id, ProductModelDto productModelDto);
+
+ /**
+ * 鍒犻櫎
+ * @param id
+ */
+ void delproductModel(Integer id);
+
+ /**
+ * 鎵归噺鍒犻櫎
+ * @param ids
+ */
+ void delAllproductModel(String ids);
+
+
+
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java
index 8fbb6af..cb7502c 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java
@@ -21,14 +21,11 @@
public interface ProductService extends IService<Product> {
void deleteProductInformation(List<Integer> SpecificationsId);
- IPage<Map<String, Object>> pageProductInformation(String productCodeOrName, Integer specificationsId, Page<Objects> page);
-
- List<Map<String, Object>> pageFatherNameProductInformation(String fatherName);
/**
- * 閫氳繃椤圭洰鍚嶆煡璇㈤」鐩殑璇曢獙鏂规硶
- * @param name
+ * 灞曠ず璇ュ瀷鍙蜂笅鐨勬楠岄」鐩姹�
+ * @param specificationsId
* @return
*/
- List<Map> selectInstrumentByProname(String name);
+ List<Map<String,Object>> pageProductInformation(Integer specificationsId);
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java
index 6e68274..d851e08 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java
@@ -29,6 +29,7 @@
@Transactional(rollbackFor = Exception.class)
Integer deleteStandardInformation(Integer standardsId);
+ //浜岀骇鏂板
Integer addStandardInformation(AddStandardDto addStandardDto);
List<Map<String, Object>> getSpecificationIdAndName(String materialId);
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java
index 4b75748..4e3721e 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java
@@ -4,8 +4,11 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.yuanchu.limslaboratory.mapper.ProductModelMapper;
import com.yuanchu.limslaboratory.pojo.Material;
import com.yuanchu.limslaboratory.mapper.MaterialMapper;
+import com.yuanchu.limslaboratory.pojo.Product;
import com.yuanchu.limslaboratory.pojo.Specifications;
import com.yuanchu.limslaboratory.pojo.Standard;
import com.yuanchu.limslaboratory.pojo.dto.AddMaterialDto;
@@ -15,16 +18,20 @@
import com.yuanchu.limslaboratory.service.SpecificationsService;
import com.yuanchu.limslaboratory.service.StandardService;
import com.yuanchu.limslaboratory.utils.MyUtil;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* <p>
- * 鏈嶅姟瀹炵幇绫�
+ * 鏈嶅姟瀹炵幇绫�
* </p>
*
* @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
@@ -45,12 +52,14 @@
@Autowired
private ProductService productService;
+ @Resource
+ ProductModelMapper productModelMapper;
+
//鏌ヨ鐗╂枡淇℃伅
@Override
public List<Map> selectMaterialLimit(int pageSize, int countSize, int type) {
- return materialMapper.selectMaterialLimit((pageSize - 1) * countSize,pageSize * countSize, type);
+ return materialMapper.selectMaterialLimit((pageSize - 1) * countSize, pageSize * countSize, type);
}
-
@Override
@@ -59,11 +68,11 @@
updateWrapper.eq(Material::getId, materialId);
updateWrapper.set(Material::getState, 0);
int isDeleteSuccess = materialMapper.update(new Material(), updateWrapper);
- if (isDeleteSuccess == 1){
+ if (isDeleteSuccess == 1) {
List<Integer> isDeleteStandard = standardService.deleteStandardsInformation(materialId);
- if (!ObjectUtils.isEmpty(isDeleteStandard)){
+ if (!ObjectUtils.isEmpty(isDeleteStandard)) {
List<Integer> idDeleteSpecifications = specificationsService.StandardIdDeleteSpecifications(isDeleteStandard);
- if (!ObjectUtils.isEmpty(idDeleteSpecifications)){
+ if (!ObjectUtils.isEmpty(idDeleteSpecifications)) {
productService.deleteProductInformation(idDeleteSpecifications);
}
}
@@ -72,25 +81,37 @@
return 0;
}
+ //涓夌骇鏂板
@Override
+ @Transactional(rollbackFor = Exception.class)
public Integer addMaterialInformation(AddMaterialDto addMaterialDto) {
- Material material = new Material()
- .setCode("BZ" + IdWorker.getIdStr())
- .setName(addMaterialDto.getMaterialName())
- .setType(addMaterialDto.getType());
- int isInsertSuccess = materialMapper.insert(material);
- if (isInsertSuccess > 0){
+ Material material = materialMapper.selectOne(Wrappers.<Material>query().eq("name", addMaterialDto.getMaterialName()));
+ material.setType(addMaterialDto.getType());
+ int isInsertSuccess = materialMapper.updateById(material);
+ if (isInsertSuccess > 0) {
Standard standard = new Standard()
.setMaterialId(material.getId())
.setName(addMaterialDto.getStandardName());
boolean save = standardService.save(standard);
- if (save){
+ if (save) {
Specifications specifications = new Specifications()
.setName(addMaterialDto.getSpecificationsName())
.setStandardId(standard.getId());
boolean save1 = specificationsService.save(specifications);
- if (save1)
+ if (save1) {
+ //娣诲姞鍨嬪彿涔嬪悗娣诲姞椤圭洰
+ List<Map<String, Object>> productModel = productModelMapper.seleMode(addMaterialDto.getMaterialName());
+ List<Product> productList = productModel.stream().map(stringObjectMap -> {
+ Product product = new Product();
+ product.setName(stringObjectMap.get("name").toString());
+ product.setFather(stringObjectMap.get("father").toString());
+ product.setUnit(stringObjectMap.get("unit").toString());
+ product.setSpecifications_id(specifications.getId());
+ return product;
+ }).collect(Collectors.toList());
+ productService.saveBatch(productList);
return 1;
+ }
}
}
return 0;
@@ -100,4 +121,12 @@
public List<Map<String, Object>> getFourLevelInformation(String specificationName) {
return materialMapper.FourTree(specificationName);
}
+
+ //娣诲姞鎸囨爣-->閫夋嫨鏍峰搧鍚嶇О
+ @Override
+ public List<String> selectmater() {
+ return materialMapper.selectmater();
+ }
+
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductModelServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductModelServiceImpl.java
new file mode 100644
index 0000000..98351a8
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductModelServiceImpl.java
@@ -0,0 +1,95 @@
+package com.yuanchu.limslaboratory.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.limslaboratory.mapper.MaterialMapper;
+import com.yuanchu.limslaboratory.mapper.ProductModelMapper;
+import com.yuanchu.limslaboratory.pojo.Material;
+import com.yuanchu.limslaboratory.pojo.ProductModel;
+import com.yuanchu.limslaboratory.pojo.dto.ProductModelDto;
+import com.yuanchu.limslaboratory.service.ProductModelService;
+import com.yuanchu.limslaboratory.utils.MyUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鍩虹椤圭洰妯$増琛�(ProductModel)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author zss
+ * @since 2023-08-19 11:00:40
+ */
+@Service
+public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, ProductModel> implements ProductModelService {
+
+ @Resource
+ ProductModelMapper productModelMapper;
+
+ @Resource
+ MaterialMapper materialMapper;
+
+ //閫夋嫨鏍峰搧
+ @Override
+ public List<String> selectmater() {
+ return materialMapper.selectmater();
+ }
+
+ //娣诲姞鏍囧噯-->閫夋嫨椤圭洰鍒嗙粍
+ @Override
+ public List<String> selectfather() {
+ return productModelMapper.selectfather();
+ }
+
+ //娣诲姞鏍囧噯
+ @Override
+ public void addproductModel(ProductModelDto productModelDto) {
+ ProductModel productModel = new ProductModel();
+ BeanUtils.copyProperties(productModelDto,productModel);
+ productModelMapper.insert(productModel);
+ //娣诲姞鐗╂枡浜у搧搴�
+ Material material = new Material();
+ material.setName(productModelDto.getName()).setCode(MyUtil.getTimeSixNumberCode("CP","CP"));
+ materialMapper.insert(material);
+ }
+
+ //鏌ヨ鏍囧噯妯$増鍒楄〃
+ @Override
+ public List<Map<String, Object>> selectproductModel(String name, String father, String material) {
+ return productModelMapper.selectproductModel(name,father,material);
+ }
+
+ //鏍规嵁id鏌ヨ璇︽儏
+ @Override
+ public ProductModelDto selectproductModelById(Integer id) {
+ ProductModel productModel = productModelMapper.selectById(id);
+ ProductModelDto productModelDto = new ProductModelDto();
+ BeanUtils.copyProperties(productModel,productModelDto);
+ return productModelDto;
+ }
+
+ //缂栬緫
+ @Override
+ public void writeproductModel(Integer id, ProductModelDto productModelDto) {
+ ProductModel productModel = new ProductModel();
+ BeanUtils.copyProperties(productModelDto,productModel);
+ productModel.setId(id);
+ productModelMapper.updateById(productModel);
+ }
+
+ //鍒犻櫎
+ @Override
+ public void delproductModel(Integer id) {
+ ProductModel productModel = new ProductModel();
+ productModel.setId(id).setState(0);
+ productModelMapper.updateById(productModel);
+ }
+
+ //鎵归噺鍒犻櫎
+ @Override
+ public void delAllproductModel(String ids) {
+ productModelMapper.delAllproductModel(ids);
+ }
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java
index b82da28..c27c343 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java
@@ -4,14 +4,18 @@
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.mapper.ProductModelMapper;
+import com.yuanchu.limslaboratory.mapper.SpecificationsMapper;
import com.yuanchu.limslaboratory.pojo.Product;
import com.yuanchu.limslaboratory.mapper.ProductMapper;
+import com.yuanchu.limslaboratory.pojo.ProductModel;
import com.yuanchu.limslaboratory.service.ProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.limslaboratory.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import com.yuanchu.limslaboratory.service.UserService;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
@@ -34,6 +38,10 @@
@Resource
private ProductMapper productMapper;
+ @Resource
+ ProductModelMapper productModelMapper;
+
+
@Override
public void deleteProductInformation(List<Integer> SpecificationsId) {
for (Integer materialId : SpecificationsId){
@@ -44,36 +52,12 @@
}
}
+ //灞曠ず璇ュ瀷鍙蜂笅鐨勬楠岄」鐩姹�
@Override
- public IPage<Map<String, Object>> pageProductInformation(String productCodeOrName, Integer specificationsId, Page<Objects> page) {
- IPage<Map<String, Object>> iPage = productMapper.pageProductInformation(productCodeOrName, specificationsId, page);
- List<Map<String, Object>> maps = iPage.getRecords();
- maps.forEach(map -> {
- int num = Integer.parseInt(map.get("num").toString());
- boolean children = false;
- if (num > 1){
- children = true;
- } else {
- Map<String, Object> product = productMapper.selectOneChildren(map.get("father"));
- map.putAll(product);
- }
- map.put("children", children);
- map.remove("num");
- });
- return iPage;
+ @Transactional(rollbackFor = Exception.class)
+ public List<Map<String, Object>> pageProductInformation(Integer specificationsId) {
+ return productMapper.pageProductInformation(specificationsId);
}
- @Override
- public List<Map<String, Object>> pageFatherNameProductInformation(String fatherName) {
- LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(Product::getFather, fatherName);
- wrapper.select(Product::getId, Product::getName, Product::getUnit, Product::getRequired, Product::getInternal);
- return productMapper.selectMaps(wrapper);
- }
- //閫氳繃椤圭洰鍚嶆煡璇㈤」鐩殑璇曢獙鏂规硶
- @Override
- public List<Map> selectInstrumentByProname(String name) {
- return productMapper.selectInstrumentByProname(name);
- }
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java
index 93be8b1..d318960 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java
@@ -2,12 +2,15 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.yuanchu.limslaboratory.mapper.ProductModelMapper;
+import com.yuanchu.limslaboratory.pojo.Product;
import com.yuanchu.limslaboratory.pojo.Specifications;
import com.yuanchu.limslaboratory.mapper.SpecificationsMapper;
import com.yuanchu.limslaboratory.pojo.dto.AddSpecifications;
import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto;
import com.yuanchu.limslaboratory.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -16,6 +19,8 @@
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
/**
* <p>
@@ -33,6 +38,9 @@
@Autowired
private ProductService productService;
+
+ @Resource
+ ProductModelMapper productModelMapper;
@Override
public Integer deleteSpecifications(Integer specificationsId) {
@@ -73,6 +81,18 @@
Specifications specifications = new Specifications()
.setName(addStandardDto.getSpecificationsName())
.setStandardId(addStandardDto.getStandardId());
- return specificationsMapper.insert(specifications);
+ specificationsMapper.insert(specifications);
+ //娣诲姞鍨嬪彿涔嬪悗娣诲姞椤圭洰
+ List<Map<String, Object>> productModel=productModelMapper.seleMode(specificationsMapper.selMateName(addStandardDto.getStandardId()));
+ List<Product> productList = productModel.stream().map(stringObjectMap -> {
+ Product product = new Product();
+ product.setName(stringObjectMap.get("name").toString());
+ product.setFather(stringObjectMap.get("father").toString());
+ product.setUnit(stringObjectMap.get("unit").toString());
+ product.setSpecifications_id(specifications.getId());
+ return product;
+ }).collect(Collectors.toList());
+ productService.saveBatch(productList);
+ return 1;
}
}
diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java
index 7b13059..9c7ab92 100644
--- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java
@@ -3,21 +3,27 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.yuanchu.limslaboratory.mapper.MaterialMapper;
+import com.yuanchu.limslaboratory.mapper.ProductModelMapper;
import com.yuanchu.limslaboratory.mapper.StandardMapper;
import com.yuanchu.limslaboratory.pojo.Material;
+import com.yuanchu.limslaboratory.pojo.Product;
import com.yuanchu.limslaboratory.pojo.Specifications;
import com.yuanchu.limslaboratory.pojo.Standard;
import com.yuanchu.limslaboratory.pojo.dto.AddStandardDto;
import com.yuanchu.limslaboratory.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* <p>
@@ -39,6 +45,12 @@
@Autowired
private ProductService productService;
+
+ @Resource
+ ProductModelMapper productModelMapper;
+
+ @Resource
+ MaterialMapper materialMapper;
@Override
@@ -76,7 +88,9 @@
return 0;
}
+ //浜岀骇鏂板
@Override
+ @Transactional(rollbackFor = Exception.class)
public Integer addStandardInformation(AddStandardDto addStandardDto) {
Standard standard = new Standard()
.setMaterialId(addStandardDto.getMaterialId())
@@ -87,8 +101,20 @@
.setName(addStandardDto.getSpecificationsName())
.setStandardId(standard.getId());
boolean save1 = specificationsService.save(specifications);
- if (save1)
+ if (save1){
+ //娣诲姞鍨嬪彿涔嬪悗娣诲姞椤圭洰
+ List<Map<String, Object>> productModel=productModelMapper.seleMode(materialMapper.selectById(addStandardDto.getMaterialId()).getName());
+ List<Product> productList = productModel.stream().map(stringObjectMap -> {
+ Product product = new Product();
+ product.setName(stringObjectMap.get("name").toString());
+ product.setFather(stringObjectMap.get("father").toString());
+ product.setUnit(stringObjectMap.get("unit").toString());
+ product.setSpecifications_id(specifications.getId());
+ return product;
+ }).collect(Collectors.toList());
+ productService.saveBatch(productList);
return 1;
+ }
}
return 0;
}
diff --git a/standard-server/src/main/resources/mapper/MaterialMapper.xml b/standard-server/src/main/resources/mapper/MaterialMapper.xml
index 8ff48cb..bb41247 100644
--- a/standard-server/src/main/resources/mapper/MaterialMapper.xml
+++ b/standard-server/src/main/resources/mapper/MaterialMapper.xml
@@ -1,14 +1,13 @@
<?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.yuanchu.limslaboratory.mapper.MaterialMapper">
-
<select id="selectMaterialLimit" resultType="Map">
select id, code, name
from lims_laboratory.material
where state = 1
and type = #{type}
order by create_time desc
- limit #{num1}, #{num2}
+ limit #{num1}, #{num2}
</select>
<select id="selectMaterialById" resultType="Map">
select m.id,
@@ -57,16 +56,22 @@
<select id="FourTree" resultMap="OneLevelTreeMap">
SELECT m.`id` materialId, m.`name` materialName, s.`id` standardId, s.`name` standardName,
f.`id` specificationsId, f.`name` specificationsName, p.`id` productId, p.`name` productName
- FROM material m
- LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM standard s WHERE s.`state` = 1) s ON m.id =
+ FROM lims_laboratory.material m
+ LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM lims_laboratory.standard s WHERE s.`state` = 1) s ON m.id =
s.`material_id`
- LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1
+ LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM lims_laboratory.specifications f WHERE f.`state` = 1
<if test="specificationsName != null and specificationsName != ''">
AND f.`name` = #{specificationsName}
</if>
) f ON s.`id` = f.`standard_id`
- LEFT JOIN (SELECT p.`id`, p.`name`, p.`specifications_id` FROM product p WHERE p.`state` = 1) p ON f.`id` =
+ LEFT JOIN (SELECT p.`id`, p.`name`, p.`specifications_id` FROM lims_laboratory.product p WHERE p.`state` = 1) p ON f.`id` =
p.`specifications_id`
WHERE m.`state` = 1
</select>
+ <!--娣诲姞鏍囧噯閫夋嫨鏍峰搧鍚嶇О-->
+ <select id="selectmater" resultType="java.lang.String">
+ select name
+ from lims_laboratory.material
+ where state = 1
+ </select>
</mapper>
diff --git a/standard-server/src/main/resources/mapper/ProductMapper.xml b/standard-server/src/main/resources/mapper/ProductMapper.xml
index e7d4c70..29b90c5 100644
--- a/standard-server/src/main/resources/mapper/ProductMapper.xml
+++ b/standard-server/src/main/resources/mapper/ProductMapper.xml
@@ -1,29 +1,25 @@
<?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.yuanchu.limslaboratory.mapper.ProductMapper">
-
- <select id="pageProductInformation" resultType="map">
- SELECT COUNT(1) num, p.`father`
- FROM product p
- WHERE p.`specifications_id` = #{specificationsId}
- <if test="productCodeOrName != null and productCodeOrName != ''">
- AND p.`father` = #{productCodeOrName}
- </if>
- GROUP BY p.`father`
- </select>
-
- <select id="selectOneChildren" resultType="map">
- SELECT p.`id`, p.`name`, p.`unit`, p.`required`, p.`internal`
- FROM product p
- WHERE p.`father` = #{father}
- </select>
<select id="selectProductByMaterialId" resultType="Map">
- select p.name,unit,required,internal
+ select p.name, unit, required, internal
from lims_laboratory.product p,
lims_laboratory.specifications sp,
lims_laboratory.standard st
- where specifications_id=sp.id
- and standard=st.id
- and material_id=#{materialId}
+ where specifications_id = sp.id
+ and standard_id = st.id
+ and material_id = #{materialId}
+ </select>
+
+ <!--灞曠ず璇ュ瀷鍙蜂笅鐨勬楠岄」鐩姹�-->
+ <select id="pageProductInformation" resultType="java.util.Map">
+ select name,
+ father,
+ unit,
+ required,
+ internal
+ from lims_laboratory.product
+ where state=1
+ and specifications_id=#{specificationsId}
</select>
</mapper>
diff --git a/standard-server/src/main/resources/mapper/ProductModelMapper.xml b/standard-server/src/main/resources/mapper/ProductModelMapper.xml
new file mode 100644
index 0000000..bc6f8cd
--- /dev/null
+++ b/standard-server/src/main/resources/mapper/ProductModelMapper.xml
@@ -0,0 +1,43 @@
+<?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.yuanchu.limslaboratory.mapper.ProductModelMapper">
+ <!--鏌ヨ鏍囧噯妯$増鍒楄〃-->
+ <select id="selectproductModel" resultType="java.util.Map">
+ select id,
+ father,
+ name,
+ unit
+ from lims_laboratory.product_model
+ where state=1
+ and material=#{material}
+ <if test="name!=null and name!=''">
+ and name like concat('%',#{name},'%')
+ </if>
+ <if test="father!=null and father!=''">
+ and father like concat('%',#{father},'%')
+ </if>
+ order by father
+ </select>
+
+ <update id="delAllproductModel">
+ update lims_laboratory.product_model
+ set state=0
+ where id in (${ids})
+ </update>
+ <!--娣诲姞鏍囧噯閫夋嫨椤圭洰鍒嗙粍-->
+ <select id="selectfather" resultType="java.lang.String">
+ select distinct father
+ from lims_laboratory.product_model
+ where state = 1
+ </select>
+
+ <!--鏌ヨ椤圭洰妯$増鏍规嵁鏍峰搧鍚�-->
+ <select id="seleMode" resultType="java.util.Map">
+ select name,
+ father,
+ unit
+ from lims_laboratory.product_model
+ where state = 1
+ and material =#{name}
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/standard-server/src/main/resources/mapper/SpecificationsMapper.xml b/standard-server/src/main/resources/mapper/SpecificationsMapper.xml
index 4daa5c5..1a6d408 100644
--- a/standard-server/src/main/resources/mapper/SpecificationsMapper.xml
+++ b/standard-server/src/main/resources/mapper/SpecificationsMapper.xml
@@ -1,5 +1,14 @@
<?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.yuanchu.limslaboratory.mapper.SpecificationsMapper">
-
+ <!--鏍规嵁瑙勬牸id鏌ヨ鐗╂枡鍚嶇О-->
+ <select id="selMateName" resultType="java.lang.String">
+ select name
+ from lims_laboratory.material
+ where state = 1
+ and id = (select material_id
+ from lims_laboratory.standard
+ where standard.state = 1
+ and standard.id=#{standardId});
+ </select>
</mapper>
diff --git a/sys/src/main/resources/application-dev.yml b/sys/src/main/resources/application-dev.yml
index 6cef4e4..46a07a9 100644
--- a/sys/src/main/resources/application-dev.yml
+++ b/sys/src/main/resources/application-dev.yml
@@ -67,7 +67,7 @@
# redis鏈嶅姟鍣ㄥ湴鍧�锛堥粯璁や负localhost锛�
host: 192.168.110.209
# redis绔彛锛堥粯璁や负6379锛�
- port: 6379
+ port: 6380
# redis璁块棶瀵嗙爜锛堥粯璁や负绌猴級
password: null
# redis杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶆绉掞級
--
Gitblit v1.9.3