From fa40e09b66af9d17b6d2dda1a3d4687ad72bf668 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 31 八月 2023 17:31:34 +0800
Subject: [PATCH] 标准BOM(展示+添加)
---
standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java | 12
standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java | 8
standard-server/src/main/resources/mapper/TechnologyMapper.xml | 33 +
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java | 15
standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java | 22
standard-server/src/main/resources/mapper/MbomMapper.xml | 49 +
standard-server/src/main/resources/mapper/MaterialMapper.xml | 36
standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java | 12
standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java | 84 +++
standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java | 37 +
standard-server/src/main/java/com/yuanchu/mom/mapper/TechniqueMapper.java | 23
standard-server/src/main/java/com/yuanchu/mom/pojo/Mbom.java | 89 +++
standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java | 9
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/MaterialDto.java | 33 +
standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java | 123 ++++
standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java | 13
standard-server/src/main/resources/mapper/TechniqueMapper.xml | 49 +
standard-server/src/main/java/com/yuanchu/mom/controller/StandardController.java | 37 +
standard-server/src/main/java/com/yuanchu/mom/mapper/MbomMapper.java | 23
standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java | 132 +++++
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java | 19
standard-server/src/main/resources/mapper/ProductMapper.xml | 93 ++-
standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java | 25 +
standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java | 8
standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java | 32 +
standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java | 3
standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java | 9
standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java | 140 +++++
standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java | 12
standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java | 32 +
standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java | 23
standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java | 19
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java | 37 +
standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java | 6
standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java | 14
standard-server/src/main/java/com/yuanchu/mom/controller/SpecificationsController.java | 37 +
standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java | 25 +
standard-server/src/main/java/com/yuanchu/mom/pojo/Technique.java | 79 +++
38 files changed, 1,320 insertions(+), 132 deletions(-)
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java
index 943da54..1d833ab 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java
@@ -1,15 +1,19 @@
package com.yuanchu.mom.controller;
-import com.yuanchu.mom.service.MaterialService;
+import com.yuanchu.mom.pojo.dto.MaterialDto;
+import com.yuanchu.mom.service.*;
import com.yuanchu.mom.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.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
-@Api(tags = "鎶�鏈鐞�-->鏍囧噯MOM-->宸︿晶浜旂骇鏍戝睍绀�")
+import javax.annotation.Resource;
+
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM")
@RestController
@RequestMapping("/material")
public class MaterialController {
@@ -17,10 +21,78 @@
@Autowired
private MaterialService materialService;
+ @Resource
+ TechnologyService technologyService;
+
+ @Resource
+ ProductService productService;
+
+ @Resource
+ MbomService mbomService;
+
+ @Resource
+ TechniqueService techniqueService;
+
@ApiOperation(value = "宸︿晶浜旂骇鏍戝睍绀�")
@GetMapping("/selectTreeByMaterial")
- public Result selectTreeByMaterial(){
+ public Result selectTreeByMaterial() {
return Result.success(materialService.selectTreeByMaterial());
}
+ @ApiOperation("(1,2绾�)鏂板-->鐗╂枡,鏍囧噯,鍨嬪彿")
+ @PostMapping("/add")
+ public Result<?> addMaterial(@Validated @RequestBody MaterialDto materialDto) {
+ materialService.addMaterial(materialDto);
+ return Result.success("娣诲姞鐗╂枡銆�" + materialDto.getName() + "銆戞垚鍔�");
+ }
+
+ @ApiOperation(value = "鍙充晶鏁版嵁灞曠ず-->閫夋嫨鐗堟湰")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "specificationsId", value = "鍨嬪彿id", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "type", value = "绫诲瀷(0:宸ヨ壓璺嚎;1:鎶�鏈寚鏍�;2:鐗╂枡娓呭崟;3:鐢熶骇宸ヨ壓)", dataTypeClass = Integer.class, required = true)
+ })
+ @GetMapping("/selectVersion")
+ public Result selectVersion(Integer type, Integer specificationsId) {
+ switch (type) {
+ case 0:
+ //宸ヨ壓璺嚎
+ return Result.success(technologyService.selectVerByTec(specificationsId));
+ case 1:
+ //鎶�鏈寚鏍�
+ return Result.success(productService.selectVerByPro(specificationsId));
+ case 2:
+ //鐗╂枡娓呭崟
+ return Result.success(mbomService.selectVerByMbom(specificationsId));
+ case 3:
+ //鐢熶骇宸ヨ壓
+ return Result.success(techniqueService.selectVerByTeq(specificationsId));
+ }
+ return Result.fail("娌℃湁璇ョ被鍨�!");
+ }
+
+ @ApiOperation(value = "鍙充晶鏁版嵁灞曠ず")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "specificationsId", value = "鍨嬪彿id", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "type", value = "绫诲瀷(0:宸ヨ壓璺嚎;1:鎶�鏈寚鏍�;2:鐗╂枡娓呭崟;3:鐢熶骇宸ヨ壓)", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "version", value = "鐗堟湰(榛樿鏈�鏂�)", dataTypeClass = Integer.class, required = true),
+ @ApiImplicitParam(name = "message", value = "鎼滅储鍐呭", dataTypeClass = String.class)
+ })
+ @GetMapping("/selectAll")
+ public Result selectAll(Integer specificationsId, Integer type, Integer version,String message) {
+ switch (type) {
+ case 0:
+ //宸ヨ壓璺嚎
+ return Result.success(technologyService.selectAllTec(specificationsId, version,message));
+ case 1:
+ //鎶�鏈寚鏍�
+ return Result.success(productService.selectAllPro(specificationsId, version,message));
+ case 2:
+ //鐗╂枡娓呭崟
+ return Result.success(mbomService.selectAllMbom(specificationsId, version,message));
+ case 3:
+ //鐢熶骇宸ヨ壓
+ return Result.success(techniqueService.selectAllTeq(specificationsId, version,message));
+ }
+ return Result.fail("娌℃湁璇ョ被鍨�!");
+ }
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java
new file mode 100644
index 0000000..9449ea8
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java
@@ -0,0 +1,25 @@
+package com.yuanchu.mom.controller;
+
+
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.yuanchu.mom.service.MbomService;
+
+
+/**
+ * 鏍囧噯BOM-鐗╂枡娓呭崟琛�(Mbom)琛ㄦ帶鍒跺眰
+ *
+ * @author zss
+ * @since 2023-08-31 11:58:23
+ */
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM-->鐗╂枡娓呭崟")
+@RestController
+@RequestMapping("/mbom")
+public class MbomController {
+
+ @Autowired
+ private MbomService mbomService;
+
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java
index f1870a8..404440d 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java
@@ -14,7 +14,7 @@
import java.util.List;
-@Api(tags = "鎶�鏈鐞�-->鏍囧噯MOM-->椤圭洰妯″潡")
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM-->鎶�鏈寚鏍�(妫�楠岄」鐩�)")
@RestController
@RequestMapping("/product")
public class ProductController {
@@ -22,14 +22,4 @@
@Autowired
private ProductService productService;
- @ApiOperation(value = "椤圭洰琛ㄦ牸浜岀骇鏍�")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(name = "project", value = "椤圭洰", dataTypeClass = String.class),
- @ApiImplicitParam(name = "specifications", value = "鍨嬪彿ID", dataTypeClass = String.class, required = true)
- })
- @GetMapping("/selectTreeByMaterial")
- public Result<?> selectTreeProduct(String specifications, String project){
- List<ProductDto> map = productService.selectTreeProduct(specifications, project);
- return Result.success(map);
- }
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/SpecificationsController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/SpecificationsController.java
new file mode 100644
index 0000000..e9f2a46
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/SpecificationsController.java
@@ -0,0 +1,37 @@
+package com.yuanchu.mom.controller;
+
+
+import com.yuanchu.mom.pojo.dto.SpecificationsDto;
+import com.yuanchu.mom.pojo.dto.StandardDto;
+import com.yuanchu.mom.vo.Result;
+import io.swagger.annotations.Api;
+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.mom.service.SpecificationsService;
+
+
+/**
+ * 鍨嬪彿琛�(Specifications)琛ㄦ帶鍒跺眰
+ *
+ * @author zss
+ * @since 2023-08-31 09:35:56
+ */
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM")
+@RestController
+@RequestMapping("/specifications")
+public class SpecificationsController {
+
+ @Autowired
+ private SpecificationsService specificationsService;
+
+ @ApiOperation("(4绾�)鏂板-->鍨嬪彿")
+ @PostMapping("/add")
+ public Result<?> addSpecifications(@Validated @RequestBody SpecificationsDto specificationsDto) {
+ specificationsService.addSpecifications(specificationsDto);
+ return Result.fail("娣诲姞鍨嬪彿銆�"+ specificationsDto.getSpecifications() +"銆戞垚鍔燂紒");
+ }
+
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/StandardController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/StandardController.java
new file mode 100644
index 0000000..cb39b4c
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/StandardController.java
@@ -0,0 +1,37 @@
+package com.yuanchu.mom.controller;
+
+
+import com.yuanchu.mom.pojo.dto.MaterialDto;
+import com.yuanchu.mom.pojo.dto.StandardDto;
+import com.yuanchu.mom.vo.Result;
+import io.swagger.annotations.Api;
+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.mom.service.StandardService;
+
+
+/**
+ * 鏍囧噯琛�(Standard)琛ㄦ帶鍒跺眰
+ *
+ * @author zss
+ * @since 2023-08-31 09:35:38
+ */
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM")
+@RestController
+@RequestMapping("/standard")
+public class StandardController {
+
+ @Autowired
+ private StandardService standardService;
+
+ @ApiOperation("(3绾�)鏂板-->鏍囧噯,鍨嬪彿")
+ @PostMapping("/add")
+ public Result<?> addStandard(@Validated @RequestBody StandardDto standardDto) {
+ standardService.addStandard(standardDto);
+ return Result.fail("娣诲姞鏍囧噯銆�"+ standardDto.getStandard() +"銆戞垚鍔燂紒");
+ }
+
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java
new file mode 100644
index 0000000..24831fd
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java
@@ -0,0 +1,25 @@
+package com.yuanchu.mom.controller;
+
+
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.yuanchu.mom.service.TechniqueService;
+
+
+/**
+ * 鏍囧噯BOM-鐢熶骇宸ヨ壓琛�(Technique)琛ㄦ帶鍒跺眰
+ *
+ * @author zss
+ * @since 2023-08-31 11:57:52
+ */
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM-->鐢熶骇宸ヨ壓")
+@RestController
+@RequestMapping("/technique")
+public class TechniqueController {
+
+ @Autowired
+ private TechniqueService techniqueService;
+
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java b/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
index d9f788f..b56b93d 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
@@ -24,7 +24,7 @@
* @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
* @since 2023-07-31
*/
-@Api(tags = "鎶�鏈鐞�-->鏍囧噯MOM-->宸ヨ壓璺嚎")
+@Api(tags = "鎶�鏈鐞�-->鏍囧噯BOM-->宸ヨ壓璺嚎")
@RestController
@RequestMapping("/technology")
public class TechnologyController {
@@ -32,14 +32,5 @@
@Autowired
private TechnologyService technologyService;
- @ApiOperation(value = "閫夋嫨宸ヨ壓璺嚎鍑虹幇鐨勮〃鏍兼煡璇�")
- @ApiImplicitParams(value = {
- @ApiImplicitParam(name = "technologyName", value = "宸ヨ壓鍚嶇О", dataTypeClass = String.class),
- @ApiImplicitParam(name = "specificationId", value = "瑙勬牸ID", dataTypeClass = String.class,required = true)
- })
- @GetMapping("/select")
- public Result<?> selectTechnology(String technologyName, String specificationId){
- List<Map<String, Object>> map = technologyService.selectTechnology(technologyName);
- return Result.success(map);
- }
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java b/standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java
index cda121a..47d4ae2 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/mapper/MaterialMapper.java
@@ -24,6 +24,9 @@
//鏍规嵁鐗╂枡鍚嶇О鍜岀墿鏂欑紪鐮佹煡璇㈢墿鏂檌d,瑙勬牸淇℃伅鍜屽瀷鍙蜂俊鎭�
List<Map> selectIdByCoNa(String name, String code);
+
+ //鏍规嵁鏍囧噯id鏌ヨ鐗╂枡
+ Material selFath(Integer id);
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/mapper/MbomMapper.java b/standard-server/src/main/java/com/yuanchu/mom/mapper/MbomMapper.java
new file mode 100644
index 0000000..babe5a2
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/mapper/MbomMapper.java
@@ -0,0 +1,23 @@
+package com.yuanchu.mom.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yuanchu.mom.pojo.Mbom;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏍囧噯BOM-鐗╂枡娓呭崟琛�(Mbom)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author zss
+ * @since 2023-08-31 11:58:23
+ */
+public interface MbomMapper extends BaseMapper<Mbom> {
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ List<Integer> selectVerByMbom(Integer specificationsId);
+
+ //鍙充晶鏁版嵁灞曠ず-->鐗╂枡娓呭崟
+ List<Map<String, Object>> selectAllMbom(Integer specificationsId, Integer version,String message);
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java b/standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java
index 55edfae..d78d10a 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java
@@ -15,7 +15,14 @@
*/
public interface ProductMapper extends BaseMapper<Product> {
- List<ProductDto> selectTreeProduct(String specifications, String project);
+ //鏍规嵁鍨嬪彿id鏌ヨ椤圭洰(鎶�鏈寚鏍�)
+ List<Map<String, Object>> selectProductList(Integer specificationsId);
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ List<Integer> selectVerByPro(Integer specificationsId);
+
+ //鍙充晶鏁版嵁灞曠ず-->鎶�鏈寚鏍�(妫�楠岄」鐩�)
+ List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version,String message);
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/mapper/TechniqueMapper.java b/standard-server/src/main/java/com/yuanchu/mom/mapper/TechniqueMapper.java
new file mode 100644
index 0000000..bde10e3
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/mapper/TechniqueMapper.java
@@ -0,0 +1,23 @@
+package com.yuanchu.mom.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yuanchu.mom.pojo.Technique;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏍囧噯BOM-鐢熶骇宸ヨ壓琛�(Technique)琛ㄦ暟鎹簱璁块棶灞�
+ *
+ * @author zss
+ * @since 2023-08-31 11:57:52
+ */
+public interface TechniqueMapper extends BaseMapper<Technique> {
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ List<Integer> selectVerByTeq(Integer specificationsId);
+
+ //鍙充晶鏁版嵁灞曠ず-->鐢熶骇宸ヨ壓
+ List<Map<String, Object>> selectAllTeq(Integer specificationsId, Integer version,String message);
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java b/standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java
index 719f2fb..db1af29 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/mapper/TechnologyMapper.java
@@ -3,6 +3,9 @@
import com.yuanchu.mom.pojo.Technology;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import java.util.List;
+import java.util.Map;
+
/**
* <p>
* Mapper 鎺ュ彛
@@ -13,4 +16,9 @@
*/
public interface TechnologyMapper extends BaseMapper<Technology> {
+ //鏍规嵁鍨嬪彿id鏌ヨ鐗堟湰
+ List<Integer> selectVerByTec(Integer specificationsId);
+
+ //鍙充晶鏁版嵁灞曠ず-->宸ヨ壓璺嚎
+ List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version,String message);
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java
index 0a54ed3..6656d43 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/Material.java
@@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
+import lombok.Builder;
import lombok.Data;
/**
@@ -42,21 +43,21 @@
**/
private Integer father;
+
@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")
+ @JsonFormat(pattern = "yyyy-MM-dd", 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")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date updateTime;
- @ApiModelProperty(value = "涔愯閿�", hidden = true)
- @Version
+ //鐗堟湰
private Integer version;
@TableField(exist = false)
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/Mbom.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/Mbom.java
new file mode 100644
index 0000000..be586bb
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/Mbom.java
@@ -0,0 +1,89 @@
+package com.yuanchu.mom.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;
+
+/**
+ * 鏍囧噯BOM-鐗╂枡娓呭崟琛�(Mbom)琛ㄥ疄浣撶被
+ *
+ * @author zss
+ * @since 2023-08-31 11:58:24
+ */
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+@TableName("mbom")
+public class Mbom implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ **/
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈 宸ヨ壓璺嚎id
+ **/
+ private Integer technologyId;
+
+ /**
+ * 鍘熸潗鏂欏悕绉�
+ **/
+ private String name;
+
+ /**
+ * 鍗曚綅
+ **/
+ private String unit;
+
+ /**
+ * 鏁伴噺
+ **/
+ private Integer num;
+
+ /**
+ * 渚涘簲鍟�
+ **/
+ private String supplier;
+
+ /**
+ * 璐ㄩ噺杩芥函鍙�
+ **/
+ private String qualityTraceability;
+
+ /**
+ * (鍘熸潗鏂欑殑)瑙勬牸鍨嬪彿
+ **/
+ private String specifications;
+
+ /**
+ * 鐗堟湰
+ **/
+ private Integer version;
+
+ @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true)
+ private Integer state;
+
+ @TableField(fill = FieldFill.INSERT)
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿", hidden = true)
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @ApiModelProperty(value = "鏇存柊鏃堕棿", hidden = true)
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date updateTime;
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java
index 85018af..09940bd 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/Product.java
@@ -48,27 +48,25 @@
private String internal;
@ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true)
- @TableLogic(value = "1", delval = "0")
private Integer state;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "鍒涘缓鏃堕棿", hidden = true)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @JsonFormat(pattern = "yyyy-MM-dd", 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")
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date updateTime;
- @ApiModelProperty(value = "涔愯閿�", hidden = true)
- @Version
+ //鐗堟湰
private Integer version;
/**
- * 鍏宠仈 鍨嬪彿id
+ * 鍏宠仈 宸ヨ壓璺嚎id
*/
- private Integer specificationsId;
+ private Integer technologyId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/Technique.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/Technique.java
new file mode 100644
index 0000000..d77d3d2
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/Technique.java
@@ -0,0 +1,79 @@
+package com.yuanchu.mom.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;
+
+/**
+ * 鏍囧噯BOM-鐢熶骇宸ヨ壓琛�(Technique)琛ㄥ疄浣撶被
+ *
+ * @author zss
+ * @since 2023-08-31 11:57:53
+ */
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+@TableName("technique")
+public class Technique implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ **/
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈 宸ヨ壓璺嚎id
+ **/
+ private Integer technologyId;
+
+ /**
+ * 璁惧鍚嶇О
+ **/
+ private String device;
+
+ /**
+ * 妫�楠岄」鐩�(鐖剁被)
+ **/
+ private String productFather;
+
+ /**
+ * 鍗曚綅
+ **/
+ private String unit;
+
+ /**
+ * 鎸囨爣(瀛愮被椤圭洰)
+ **/
+ private String product;
+
+ /**
+ * 鐗堟湰
+ **/
+ private Integer version;
+
+ @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true)
+ private Integer state;
+
+ @TableField(fill = FieldFill.INSERT)
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿", hidden = true)
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date createTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @ApiModelProperty(value = "鏇存柊鏃堕棿", hidden = true)
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date updateTime;
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/MaterialDto.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/MaterialDto.java
new file mode 100644
index 0000000..6d43cad
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/MaterialDto.java
@@ -0,0 +1,33 @@
+package com.yuanchu.mom.pojo.dto;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Data;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+
+@Data
+//鏍囧噯BOM鏂板鍙傛暟(1,2绾ф柊澧�)
+public class MaterialDto {
+
+ @JsonSerialize
+ @NotNull(message = "绫诲瀷(鎴愬搧鍗婃垚鍝�)涓嶈兘涓虹┖")
+ private Integer type;
+
+ @JsonSerialize
+ @NotNull(message = "浜у搧澶х被(4澶х被)涓嶈兘涓虹┖")
+ private Integer father;
+
+ @JsonSerialize
+ @NotBlank(message = "鐗╂枡鍚嶇О涓嶈兘涓虹┖")
+ private String name;
+
+ @JsonSerialize
+ @NotBlank(message = "鏍囧噯涓嶈兘涓虹┖")
+ private String standard;
+
+ @JsonSerialize
+ @NotBlank(message = "鍨嬪彿涓嶈兘涓虹┖")
+ private String specifications;
+
+}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java
index 62ffdb6..eec157c 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/SpecificationsDto.java
@@ -1,15 +1,22 @@
package com.yuanchu.mom.pojo.dto;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import java.util.List;
@Data
-class SpecificationsDto {
+//鏍囧噯BOM鏂板鍙傛暟(4绾ф柊澧�)
+public class SpecificationsDto {
+
+ @JsonSerialize
+ @NotNull(message = "鏍囧噯id涓嶈兘涓虹┖")
private Integer id;
- private String name;
-
- private String code = "[4]";
+ @JsonSerialize
+ @NotBlank(message = "鍨嬪彿涓嶈兘涓虹┖")
+ private String specifications;
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java b/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java
index 2796d34..f49fc1b 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/pojo/dto/StandardDto.java
@@ -1,17 +1,26 @@
package com.yuanchu.mom.pojo.dto;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import java.util.List;
@Data
-class StandardDto {
+//鏍囧噯BOM鏂板鍙傛暟(3绾ф柊澧�)
+public class StandardDto {
+
+ @JsonSerialize
+ @NotNull(message = "鐗╂枡id涓嶈兘涓虹┖")
private Integer id;
- private String name;
+ @JsonSerialize
+ @NotBlank(message = "鏍囧噯涓嶈兘涓虹┖")
+ private String standard;
- private String code = "[3]";
-
- List<SpecificationsDto> children;
+ @JsonSerialize
+ @NotBlank(message = "鍨嬪彿涓嶈兘涓虹┖")
+ private String specifications;
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java b/standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java
index 9e7a5aa..1951cea 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java
@@ -2,6 +2,7 @@
import com.yuanchu.mom.pojo.Material;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.dto.MaterialDto;
import java.util.List;
import java.util.Map;
@@ -21,6 +22,13 @@
List<Map<String,Object>> selectTreeByMaterial();
/**
+ * (1,2绾�)鏂板-->鐗╂枡,鏍囧噯,鍨嬪彿
+ * @param materialDto
+ * @return
+ */
+ void addMaterial(MaterialDto materialDto);
+
+ /**
* 鏍规嵁鐗╂枡鍚嶇О鏌ヨ鐗╂枡id鍜岀墿鏂欑紪鐮�
* @param name
* @return
@@ -34,8 +42,9 @@
* @return
*/
List<Map> selectIdByCoNa(String name, String code);
+
/**
- * 妫�楠屾ā鍧�-->OMS绠$悊-->鎴愬搧妫�楠�-->鏂板(椤圭洰鍚嶇О涓嬫媺妗嗭細Id涓庡悕绉帮紝缂栫爜)
+ * 妫�楠屾ā鍧�-->QMS绠$悊-->鎴愬搧妫�楠�-->鏂板(椤圭洰鍚嶇О涓嬫媺妗嗭細Id涓庡悕绉帮紝缂栫爜)
*/
List<Map<String, Object>> selectMaterialIdAndNameAndCode();
@@ -44,4 +53,5 @@
* @return
*/
List<Material> selectMaterial();
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java b/standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java
new file mode 100644
index 0000000..d41d71f
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java
@@ -0,0 +1,32 @@
+package com.yuanchu.mom.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.Mbom;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏍囧噯BOM-鐗╂枡娓呭崟琛�(Mbom)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author zss
+ * @since 2023-08-31 11:58:23
+ */
+public interface MbomService extends IService<Mbom> {
+
+ /**
+ * 鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ * @param specificationsId
+ * @return
+ */
+ List<Integer> selectVerByMbom(Integer specificationsId);
+
+ /**
+ *鍙充晶鏁版嵁灞曠ず-->鐗╂枡娓呭崟
+ * @param specificationsId
+ * @param version
+ * @return
+ */
+ List<Map<String,Object>> selectAllMbom(Integer specificationsId, Integer version,String message);
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java b/standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java
index 99cbeff..ffa0dc2 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java
@@ -14,7 +14,25 @@
*/
public interface ProductService extends IService<Product> {
- List<ProductDto> selectTreeProduct(String specifications, String project);
-
+ /**
+ * 鏍规嵁鍨嬪彿id鏌ヨ椤圭洰(鎶�鏈寚鏍�)
+ * @param specificationsId
+ * @return
+ */
List<Map<String, Object>> selectProductList(Integer specificationsId);
+
+ /**
+ * 鏍规嵁鍨嬪彿id鏌ヨ鐗堟湰
+ * @param specificationsId
+ * @return
+ */
+ List<Integer> selectVerByPro(Integer specificationsId);
+
+ /**
+ *鍙充晶鏁版嵁灞曠ず-->鎶�鏈寚鏍�(妫�楠岄」鐩�)
+ * @param specificationsId
+ * @param version
+ * @return
+ */
+ List<Map<String,Object>> selectAllPro(Integer specificationsId, Integer version,String message);
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java b/standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java
index bcba5e7..a89d774 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/SpecificationsService.java
@@ -4,6 +4,7 @@
import com.yuanchu.mom.pojo.Material;
import com.yuanchu.mom.pojo.Specifications;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.dto.SpecificationsDto;
import java.util.List;
@@ -30,4 +31,11 @@
* 妫�楠屾ā鍧�-->OMS绠$悊-->鎴愬搧妫�楠�-->鏂板(闇�瑕佽鏍煎瀷鍙风殑Id涓庡悕绉�)
*/
List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId);
+
+ /**
+ * (4绾�)鏂板-->鍨嬪彿
+ * @param specificationsDto
+ */
+ void addSpecifications(SpecificationsDto specificationsDto);
+
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java b/standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java
index 8461cf4..8a8f37f 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/StandardService.java
@@ -2,6 +2,7 @@
import com.yuanchu.mom.pojo.Standard;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.dto.StandardDto;
/**
* @author Administrator
@@ -10,4 +11,9 @@
*/
public interface StandardService extends IService<Standard> {
+ /**
+ * (3绾�)鏂板-->鏍囧噯,鍨嬪彿
+ * @param standardDto
+ */
+ void addStandard(StandardDto standardDto);
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java b/standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java
new file mode 100644
index 0000000..45dddad
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java
@@ -0,0 +1,32 @@
+package com.yuanchu.mom.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.Technique;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏍囧噯BOM-鐢熶骇宸ヨ壓琛�(Technique)琛ㄦ湇鍔℃帴鍙�
+ *
+ * @author zss
+ * @since 2023-08-31 11:57:53
+ */
+public interface TechniqueService extends IService<Technique> {
+
+ /**
+ * 鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ * @param specificationsId
+ * @return
+ */
+ List<Integer> selectVerByTeq(Integer specificationsId);
+
+ /**
+ * 鍙充晶鏁版嵁灞曠ず-->鐢熶骇宸ヨ壓
+ * @param specificationsId
+ * @param version
+ * @return
+ */
+ List<Map<String,Object>> selectAllTeq(Integer specificationsId, Integer version,String message);
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java b/standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java
index b6935c8..6f709cc 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java
@@ -16,5 +16,17 @@
*/
public interface TechnologyService extends IService<Technology> {
- List<Map<String, Object>> selectTechnology(String technologyName);
+ /**
+ * 鏍规嵁鍨嬪彿id鏌ヨ鐗堟湰
+ * @return
+ */
+ List<Integer> selectVerByTec(Integer specificationsId);
+
+ /**
+ * 鍙充晶鏁版嵁灞曠ず-->宸ヨ壓璺嚎
+ * @param specificationsId 鍨嬪彿id
+ * @param version 鐗堟湰
+ * @return
+ */
+ List<Map<String,Object>> selectAllTec(Integer specificationsId, Integer version,String message);
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java
index a096fa2..ed84a91 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java
@@ -3,14 +3,19 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.yuanchu.mom.pojo.Material;
-import com.yuanchu.mom.service.MaterialService;
-import com.yuanchu.mom.mapper.MaterialMapper;
+import com.yuanchu.mom.mapper.*;
+import com.yuanchu.mom.pojo.*;
+import com.yuanchu.mom.pojo.dto.MaterialDto;
+import com.yuanchu.mom.service.*;
+import com.yuanchu.mom.utils.MyUtil;
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;
/**
* @author Administrator
@@ -18,18 +23,139 @@
* @createDate 2023-07-26 15:52:50
*/
@Service
-public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material>
- implements MaterialService {
+public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
@Resource
MaterialMapper materialMapper;
+ @Resource
+ StandardMapper standardMapper;
+
+ @Resource
+ SpecificationsMapper specificationsMapper;
+
+ @Resource
+ TechnologyService technologyService;
+
+ @Resource
+ TechnologyTemplateMapper technologyTemplateMapper;
+
+ @Resource
+ ProductService productService;
+
+ @Resource
+ TechnicalModelMapper technicalModelMapper;
+
+ @Resource
+ MbomService mbomService;
+
+ @Resource
+ MbomModelMapper mbomModelMapper;
+
+ @Resource
+ TechniqueService techniqueService;
+
+ @Resource
+ TechniqueModelMapper techniqueModelMapper;
+
+ @Resource
+ DeviceMapper deviceMapper;
+
//鏍囧噯MOM-->宸︿晶浜旂骇鏍戝睍绀�
@Override
- public List<Map<String,Object>> selectTreeByMaterial() {
+ public List<Map<String, Object>> selectTreeByMaterial() {
return materialMapper.selectTreeByMaterial();
}
+ //(1,2绾�)鏂板-->鐗╂枡,鏍囧噯,鍨嬪彿
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void addMaterial(MaterialDto materialDto) {
+ /*鏂板鐗╂枡琛�*/
+ Material material = new Material();
+ material.setCode(MyUtil.getTimeSixNumberCode("ML", "ML"));
+ material.setName(materialDto.getName());
+ material.setType(materialDto.getType());
+ material.setFather(materialDto.getFather());
+ materialMapper.insert(material);
+ /*鏂板鏍囧噯琛�*/
+ Standard standard = new Standard();
+ standard.setName(materialDto.getStandard());
+ standard.setMaterial_id(material.getId());
+ standardMapper.insert(standard);
+ /*鏂板鍨嬪彿琛�*/
+ Specifications specifications = new Specifications();
+ specifications.setName(materialDto.getSpecifications());
+ specifications.setStandardId(standard.getId());
+ specificationsMapper.insert(specifications);
+ /*鏂板鏍囧噯BOM-->宸ヨ壓璺嚎(鎵归噺娣诲姞)*/
+ List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", materialDto.getFather()));
+ List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
+ Technology technology = new Technology();
+ technology.setSpecificationsId(specifications.getId());
+ technology.setFather(technologyTemplate.getFather());
+ technology.setName(technologyTemplate.getName());
+ technology.setDeviceGroup(technologyTemplate.getDeviceGroup());
+ return technology;
+ }).collect(Collectors.toList());
+ technologyService.saveBatch(technologyList);
+ /*鏂板鏍囧噯BOM-->鎶�鏈寚鏍�(鎵归噺娣诲姞)*/
+ //鏂板鐨勫伐鑹鸿矾绾縤d闆嗗悎
+ List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
+ //鍩虹鏁版嵁涓伐鑹鸿矾绾縤d闆嗗悎
+ List<Integer> techTemIds = technologyTemplateList.stream().map(TechnologyTemplate::getId).collect(Collectors.toList());
+ //涓よ�呴暱搴︿竴瀹氫竴鏍�
+ List<Product> productList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<TechnicalModel> technicalModelList = technicalModelMapper.selectList(Wrappers.<TechnicalModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (TechnicalModel technicalModel : technicalModelList) {
+ Product product = new Product();
+ product.setFather(technicalModel.getFather());
+ product.setName(technicalModel.getName());
+ product.setUnit(technicalModel.getUnit());
+ product.setTechnologyId(technologyIds.get(i));
+ productList.add(product);
+ }
+ }
+ productService.saveBatch(productList);
+ /*鏂板鏍囧噯BOM-->鐗╂枡娓呭崟(鎵归噺娣诲姞)*/
+ List<Mbom> mbomList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<MbomModel> mbomModelList = mbomModelMapper.selectList(Wrappers.<MbomModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (MbomModel mbomModel : mbomModelList) {
+ Mbom mbom = new Mbom();
+ mbom.setUnit(mbomModel.getUnit());
+ mbom.setName(mbomModel.getName());
+ mbom.setSupplier(mbomModel.getSupplier());
+ mbom.setQualityTraceability(mbomModel.getQualityTraceability());
+ mbom.setSpecifications(mbomModel.getSpecifications());
+ mbom.setTechnologyId(technologyIds.get(i));
+ mbomList.add(mbom);
+ }
+ }
+ mbomService.saveBatch(mbomList);
+ /*鏂板鏍囧噯BOM-->鐢熶骇宸ヨ壓(鎵归噺娣诲姞)*/
+ List<Technique> techniqueList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<TechniqueModel> techniqueModelList = techniqueModelMapper.selectList(Wrappers.<TechniqueModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (TechniqueModel techniqueModel : techniqueModelList) {
+ //鏌ヨ璁惧鍚嶇О
+ Device device = deviceMapper.selectById(techniqueModel.getDeviceId());
+ //鏌ヨ鍩虹鐢熶骇宸ヨ壓涓瘡涓澶囩殑鍏蜂綋椤圭洰
+ TechnicalModel technicalModel = technicalModelMapper.selectById(techniqueModel.getTechnicalModelId());
+ Technique technique = new Technique();
+ technique.setTechnologyId(technologyIds.get(i));
+ technique.setDevice(device.getName());
+ technique.setProductFather(technicalModel.getFather());
+ technique.setProduct(technicalModel.getName());
+ technique.setUnit(technicalModel.getUnit());
+ techniqueList.add(technique);
+ }
+ }
+ techniqueService.saveBatch(techniqueList);
+ }
+
+ //妫�楠屾ā鍧�-->QMS绠$悊-->鎴愬搧妫�楠�-->鏂板(椤圭洰鍚嶇О涓嬫媺妗嗭細Id涓庡悕绉帮紝缂栫爜)
@Override
public List<Map<String, Object>> selectMaterialIdAndNameAndCode() {
LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
@@ -52,7 +178,7 @@
//鏍规嵁鐗╂枡鍚嶇О鍜岀墿鏂欑紪鐮佹煡璇㈢墿鏂檌d,瑙勬牸淇℃伅鍜屽瀷鍙蜂俊鎭�
@Override
public List<Map> selectIdByCoNa(String name, String code) {
- return materialMapper.selectIdByCoNa(name,code);
+ return materialMapper.selectIdByCoNa(name, code);
}
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java
new file mode 100644
index 0000000..f6fffbb
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java
@@ -0,0 +1,37 @@
+package com.yuanchu.mom.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.mapper.MbomMapper;
+import com.yuanchu.mom.pojo.Mbom;
+import com.yuanchu.mom.service.MbomService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏍囧噯BOM-鐗╂枡娓呭崟琛�(Mbom)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author zss
+ * @since 2023-08-31 11:58:24
+ */
+@Service
+public class MbomServiceImpl extends ServiceImpl<MbomMapper, Mbom> implements MbomService {
+
+ @Resource
+ MbomMapper mbomMapper;
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ @Override
+ public List<Integer> selectVerByMbom(Integer specificationsId) {
+ return mbomMapper.selectVerByMbom(specificationsId);
+ }
+
+ //鍙充晶鏁版嵁灞曠ず-->鐗╂枡娓呭崟
+ @Override
+ public List<Map<String, Object>> selectAllMbom(Integer specificationsId, Integer version,String message) {
+ return mbomMapper.selectAllMbom(specificationsId,version,message);
+ }
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
index 331d83d..4ccc9d7 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
@@ -23,17 +23,22 @@
@Resource
private ProductMapper productMapper;
- @Override
- public List<ProductDto> selectTreeProduct(String specifications, String project) {
- return productMapper.selectTreeProduct(specifications, project);
- }
-
+ //鏍规嵁鍨嬪彿id鏌ヨ椤圭洰(鎶�鏈寚鏍�)
@Override
public List<Map<String, Object>> selectProductList(Integer specificationsId) {
- LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(Product::getSpecificationsId, specificationsId);
- wrapper.select(Product::getName, Product::getFather, Product::getRequired, Product::getInternal, Product::getUnit);
- return productMapper.selectMaps(wrapper);
+ return productMapper.selectProductList(specificationsId);
+ }
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ @Override
+ public List<Integer> selectVerByPro(Integer specificationsId) {
+ return productMapper.selectVerByPro(specificationsId);
+ }
+
+ //鍙充晶鏁版嵁灞曠ず-->鎶�鏈寚鏍�(妫�楠岄」鐩�)
+ @Override
+ public List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version,String message) {
+ return productMapper.selectAllPro(specificationsId,version,message);
}
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
index 75ea50f..1c418b5 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
@@ -3,18 +3,21 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.yuanchu.mom.mapper.SpecificationsMapper;
-import com.yuanchu.mom.pojo.Specifications;
-import com.yuanchu.mom.service.SpecificationsService;
+import com.yuanchu.mom.mapper.*;
+import com.yuanchu.mom.pojo.*;
+import com.yuanchu.mom.pojo.dto.SpecificationsDto;
+import com.yuanchu.mom.service.*;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* @author Administrator
@@ -22,14 +25,120 @@
* @createDate 2023-07-26 16:01:49
*/
@Service
-public class SpecificationsServiceImpl extends ServiceImpl<SpecificationsMapper, Specifications>
- implements SpecificationsService {
+public class SpecificationsServiceImpl extends ServiceImpl<SpecificationsMapper, Specifications> implements SpecificationsService {
@Resource
- private SpecificationsMapper specificationsMapper;
+ MaterialMapper materialMapper;
+
+ @Resource
+ SpecificationsMapper specificationsMapper;
+
+ @Resource
+ TechnologyService technologyService;
+
+ @Resource
+ TechnologyTemplateMapper technologyTemplateMapper;
+
+ @Resource
+ ProductService productService;
+
+ @Resource
+ TechnicalModelMapper technicalModelMapper;
+
+ @Resource
+ MbomService mbomService;
+
+ @Resource
+ MbomModelMapper mbomModelMapper;
+
+ @Resource
+ TechniqueService techniqueService;
+
+ @Resource
+ TechniqueModelMapper techniqueModelMapper;
+
+ @Resource
+ DeviceMapper deviceMapper;
+
+ //(4绾�)鏂板-->鍨嬪彿
+ @Override
+ public void addSpecifications(SpecificationsDto specificationsDto) {
+ /*鏂板鍨嬪彿琛�*/
+ Specifications specifications = new Specifications();
+ specifications.setStandardId(specificationsDto.getId());
+ specifications.setName(specificationsDto.getSpecifications());
+ specificationsMapper.insert(specifications);
+ /*鏂板鏍囧噯BOM-->宸ヨ壓璺嚎(鎵归噺娣诲姞)*/
+ //鏍规嵁鏍囧噯id鏌ヨ鐗╂枡澶х被
+ Material material = materialMapper.selFath(specificationsDto.getId());
+ List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
+ List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
+ Technology technology = new Technology();
+ technology.setSpecificationsId(specifications.getId());
+ technology.setFather(technologyTemplate.getFather());
+ technology.setName(technologyTemplate.getName());
+ technology.setDeviceGroup(technologyTemplate.getDeviceGroup());
+ return technology;
+ }).collect(Collectors.toList());
+ technologyService.saveBatch(technologyList);
+ /*鏂板鏍囧噯BOM-->鎶�鏈寚鏍�(鎵归噺娣诲姞)*/
+ //鏂板鐨勫伐鑹鸿矾绾縤d闆嗗悎
+ List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
+ //鍩虹鏁版嵁涓伐鑹鸿矾绾縤d闆嗗悎
+ List<Integer> techTemIds = technologyTemplateList.stream().map(TechnologyTemplate::getId).collect(Collectors.toList());
+ //涓よ�呴暱搴︿竴瀹氫竴鏍�
+ List<Product> productList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<TechnicalModel> technicalModelList = technicalModelMapper.selectList(Wrappers.<TechnicalModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (TechnicalModel technicalModel : technicalModelList) {
+ Product product = new Product();
+ product.setFather(technicalModel.getFather());
+ product.setName(technicalModel.getName());
+ product.setUnit(technicalModel.getUnit());
+ product.setTechnologyId(technologyIds.get(i));
+ productList.add(product);
+ }
+ }
+ productService.saveBatch(productList);
+ /*鏂板鏍囧噯BOM-->鐗╂枡娓呭崟(鎵归噺娣诲姞)*/
+ List<Mbom> mbomList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<MbomModel> mbomModelList = mbomModelMapper.selectList(Wrappers.<MbomModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (MbomModel mbomModel : mbomModelList) {
+ Mbom mbom = new Mbom();
+ mbom.setUnit(mbomModel.getUnit());
+ mbom.setName(mbomModel.getName());
+ mbom.setSupplier(mbomModel.getSupplier());
+ mbom.setQualityTraceability(mbomModel.getQualityTraceability());
+ mbom.setSpecifications(mbomModel.getSpecifications());
+ mbom.setTechnologyId(technologyIds.get(i));
+ mbomList.add(mbom);
+ }
+ }
+ mbomService.saveBatch(mbomList);
+ /*鏂板鏍囧噯BOM-->鐢熶骇宸ヨ壓(鎵归噺娣诲姞)*/
+ List<Technique> techniqueList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<TechniqueModel> techniqueModelList = techniqueModelMapper.selectList(Wrappers.<TechniqueModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (TechniqueModel techniqueModel : techniqueModelList) {
+ //鏌ヨ璁惧鍚嶇О
+ Device device = deviceMapper.selectById(techniqueModel.getDeviceId());
+ //鏌ヨ鍩虹鐢熶骇宸ヨ壓涓瘡涓澶囩殑鍏蜂綋椤圭洰
+ TechnicalModel technicalModel = technicalModelMapper.selectById(techniqueModel.getTechnicalModelId());
+ Technique technique = new Technique();
+ technique.setTechnologyId(technologyIds.get(i));
+ technique.setDevice(device.getName());
+ technique.setProductFather(technicalModel.getFather());
+ technique.setProduct(technicalModel.getName());
+ technique.setUnit(technicalModel.getUnit());
+ techniqueList.add(technique);
+ }
+ }
+ techniqueService.saveBatch(techniqueList);
+ }
/**
- * 妫�楠屾ā鍧�-->OMS绠$悊-->鎴愬搧妫�楠�-->鏂板(闇�瑕佽鏍煎瀷鍙风殑Id涓庡悕绉�)
+ * 妫�楠屾ā鍧�-->QMS绠$悊-->鎴愬搧妫�楠�-->鏂板(闇�瑕佽鏍煎瀷鍙风殑Id涓庡悕绉�)
*/
@Override
public List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId) {
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java
index f52274f..647020d 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/StandardServiceImpl.java
@@ -1,10 +1,18 @@
package com.yuanchu.mom.service.impl;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.yuanchu.mom.pojo.Standard;
-import com.yuanchu.mom.service.StandardService;
-import com.yuanchu.mom.mapper.StandardMapper;
+import com.yuanchu.mom.mapper.*;
+import com.yuanchu.mom.pojo.*;
+import com.yuanchu.mom.pojo.dto.StandardDto;
+import com.yuanchu.mom.service.*;
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.stream.Collectors;
/**
* @author Administrator
@@ -14,6 +22,124 @@
@Service
public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> implements StandardService {
+ @Resource
+ MaterialMapper materialMapper;
+
+ @Resource
+ StandardMapper standardMapper;
+
+ @Resource
+ SpecificationsMapper specificationsMapper;
+
+ @Resource
+ TechnologyService technologyService;
+
+ @Resource
+ TechnologyTemplateMapper technologyTemplateMapper;
+
+ @Resource
+ ProductService productService;
+
+ @Resource
+ TechnicalModelMapper technicalModelMapper;
+
+ @Resource
+ MbomService mbomService;
+
+ @Resource
+ MbomModelMapper mbomModelMapper;
+
+ @Resource
+ TechniqueService techniqueService;
+
+ @Resource
+ TechniqueModelMapper techniqueModelMapper;
+
+ @Resource
+ DeviceMapper deviceMapper;
+
+ //(3绾�)鏂板-->鏍囧噯,鍨嬪彿
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void addStandard(StandardDto standardDto) {
+ /*鏂板鏍囧噯琛�*/
+ Standard standard = new Standard();
+ standard.setMaterial_id(standardDto.getId());
+ standard.setName(standardDto.getStandard());
+ standardMapper.insert(standard);
+ /*鏂板鍨嬪彿琛�*/
+ Specifications specifications = new Specifications();
+ specifications.setStandardId(standard.getId());
+ specifications.setName(standardDto.getSpecifications());
+ specificationsMapper.insert(specifications);
+ /*鏂板鏍囧噯BOM-->宸ヨ壓璺嚎(鎵归噺娣诲姞)*/
+ //鏌ヨ鐗╂枡鐨勫ぇ绫�(鏍规嵁鐗╂枡id)
+ Material material = materialMapper.selectById(standardDto.getId());
+ List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
+ List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
+ Technology technology = new Technology();
+ technology.setSpecificationsId(specifications.getId());
+ technology.setFather(technologyTemplate.getFather());
+ technology.setName(technologyTemplate.getName());
+ technology.setDeviceGroup(technologyTemplate.getDeviceGroup());
+ return technology;
+ }).collect(Collectors.toList());
+ technologyService.saveBatch(technologyList);
+ /*鏂板鏍囧噯BOM-->鎶�鏈寚鏍�(鎵归噺娣诲姞)*/
+ //鏂板鐨勫伐鑹鸿矾绾縤d闆嗗悎
+ List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
+ //鍩虹鏁版嵁涓伐鑹鸿矾绾縤d闆嗗悎
+ List<Integer> techTemIds = technologyTemplateList.stream().map(TechnologyTemplate::getId).collect(Collectors.toList());
+ //涓よ�呴暱搴︿竴瀹氫竴鏍�
+ List<Product> productList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<TechnicalModel> technicalModelList = technicalModelMapper.selectList(Wrappers.<TechnicalModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (TechnicalModel technicalModel : technicalModelList) {
+ Product product = new Product();
+ product.setFather(technicalModel.getFather());
+ product.setName(technicalModel.getName());
+ product.setUnit(technicalModel.getUnit());
+ product.setTechnologyId(technologyIds.get(i));
+ productList.add(product);
+ }
+ }
+ productService.saveBatch(productList);
+ /*鏂板鏍囧噯BOM-->鐗╂枡娓呭崟(鎵归噺娣诲姞)*/
+ List<Mbom> mbomList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<MbomModel> mbomModelList = mbomModelMapper.selectList(Wrappers.<MbomModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (MbomModel mbomModel : mbomModelList) {
+ Mbom mbom = new Mbom();
+ mbom.setUnit(mbomModel.getUnit());
+ mbom.setName(mbomModel.getName());
+ mbom.setSupplier(mbomModel.getSupplier());
+ mbom.setQualityTraceability(mbomModel.getQualityTraceability());
+ mbom.setSpecifications(mbomModel.getSpecifications());
+ mbom.setTechnologyId(technologyIds.get(i));
+ mbomList.add(mbom);
+ }
+ }
+ mbomService.saveBatch(mbomList);
+ /*鏂板鏍囧噯BOM-->鐢熶骇宸ヨ壓(鎵归噺娣诲姞)*/
+ List<Technique> techniqueList = new ArrayList<>();
+ for (int i = 0; i < technologyIds.size(); i++) {
+ List<TechniqueModel> techniqueModelList = techniqueModelMapper.selectList(Wrappers.<TechniqueModel>query().eq("tech_tem_id", techTemIds.get(i)));
+ for (TechniqueModel techniqueModel : techniqueModelList) {
+ //鏌ヨ璁惧鍚嶇О
+ Device device = deviceMapper.selectById(techniqueModel.getDeviceId());
+ //鏌ヨ鍩虹鐢熶骇宸ヨ壓涓瘡涓澶囩殑鍏蜂綋椤圭洰
+ TechnicalModel technicalModel = technicalModelMapper.selectById(techniqueModel.getTechnicalModelId());
+ Technique technique = new Technique();
+ technique.setTechnologyId(technologyIds.get(i));
+ technique.setDevice(device.getName());
+ technique.setProductFather(technicalModel.getFather());
+ technique.setProduct(technicalModel.getName());
+ technique.setUnit(technicalModel.getUnit());
+ techniqueList.add(technique);
+ }
+ }
+ techniqueService.saveBatch(techniqueList);
+ }
}
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java
new file mode 100644
index 0000000..256cd31
--- /dev/null
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java
@@ -0,0 +1,37 @@
+package com.yuanchu.mom.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.mapper.TechniqueMapper;
+import com.yuanchu.mom.pojo.Technique;
+import com.yuanchu.mom.service.TechniqueService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鏍囧噯BOM-鐢熶骇宸ヨ壓琛�(Technique)琛ㄦ湇鍔″疄鐜扮被
+ *
+ * @author zss
+ * @since 2023-08-31 11:57:53
+ */
+@Service
+public class TechniqueServiceImpl extends ServiceImpl<TechniqueMapper, Technique> implements TechniqueService {
+
+ @Resource
+ TechniqueMapper techniqueMapper;
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�
+ @Override
+ public List<Integer> selectVerByTeq(Integer specificationsId) {
+ return techniqueMapper.selectVerByTeq(specificationsId);
+ }
+
+ //鍙充晶鏁版嵁灞曠ず-->鐢熶骇宸ヨ壓
+ @Override
+ public List<Map<String, Object>> selectAllTeq(Integer specificationsId, Integer version,String message) {
+ return techniqueMapper.selectAllTeq(specificationsId,version,message);
+ }
+}
+
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
index 38a5bfb..e66d960 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
@@ -24,15 +24,18 @@
public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technology> implements TechnologyService {
@Resource
- private TechnologyMapper technologyMapper;
+ TechnologyMapper technologyMapper;
+
+ //鏍规嵁鍨嬪彿id鏌ヨ鐗堟湰
@Override
- public List<Map<String, Object>> selectTechnology(String technologyName) {
- LambdaQueryWrapper<Technology> wrapper = new LambdaQueryWrapper<>();
- if (!ObjectUtils.isEmpty(technologyName)){
- wrapper.like(Technology::getName, technologyName);
- }
- wrapper.select(Technology::getId, Technology::getName, Technology::getDeviceGroup, Technology::getFather);
- return technologyMapper.selectMaps(wrapper);
+ public List<Integer> selectVerByTec(Integer specificationsId) {
+ return technologyMapper.selectVerByTec(specificationsId);
+ }
+
+ //鍙充晶鏁版嵁灞曠ず-->宸ヨ壓璺嚎
+ @Override
+ public List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version,String message) {
+ return technologyMapper.selectAllTec(specificationsId,version,message);
}
}
diff --git a/standard-server/src/main/resources/mapper/MaterialMapper.xml b/standard-server/src/main/resources/mapper/MaterialMapper.xml
index 6c02f99..53e1662 100644
--- a/standard-server/src/main/resources/mapper/MaterialMapper.xml
+++ b/standard-server/src/main/resources/mapper/MaterialMapper.xml
@@ -26,17 +26,18 @@
<id property="id" column="spid"/>
<result property="name" column="spname"/>
</resultMap>
- <select id="selectTreeByMaterial" resultMap="selectTreeByMaterialMap" >
- select m.type, #涓�绾х被鍨�
- father, #浜岀骇浜у搧澶х被(4澶х被)
- m.id mid, #涓夌骇鐗╂枡id
+ <select id="selectTreeByMaterial" resultMap="selectTreeByMaterialMap">
+ select m.type, #涓�绾х被鍨�
+ father, #浜岀骇浜у搧澶х被(4澶х被)
+ m.id mid, #涓夌骇鐗╂枡id
m.name mname, #涓夌骇鏍峰搧鍚嶇О
- s.id sid, #鍥涚骇鏍囧噯id
+ s.id sid, #鍥涚骇鏍囧噯id
s.name sname, #鍥涚骇鏍囧噯鍚�
- sp.id spid, #浜旂骇鍨嬪彿id
+ sp.id spid, #浜旂骇鍨嬪彿id
sp.name spname #浜旂骇鍨嬪彿鍚�
- from (select type, id, name,father from mom_ocean.material where state = 1) m
- left join (select id, name, material_id from mom_ocean.standard where state = 1) s on m.id = s.material_id
+ from (select type, id, name, father from mom_ocean.material where state = 1) m
+ left join (select id, name, material_id from mom_ocean.standard where state = 1) s
+ on m.id = s.material_id
left join (select id, name, standard_id from mom_ocean.specifications where state = 1) sp
on sp.standard_id = s.id
</select>
@@ -48,10 +49,10 @@
</select>
<select id="selectIdByCoNa" resultType="java.util.Map">
- select m.id '鐗╂枡id',
- st.id '瑙勬牸id',
- st.name '瑙勬牸鍚嶇О',
- sp.name '鍨嬪彿鍚嶇О'
+ select m.id '鐗╂枡id',
+ st.id '瑙勬牸id',
+ st.name '瑙勬牸鍚嶇О',
+ sp.name '鍨嬪彿鍚嶇О'
from mom_ocean.material m,
mom_ocean.standard st,
mom_ocean.specifications sp
@@ -60,4 +61,15 @@
and m.name = #{name}
and code = #{code}
</select>
+
+ <!--鏍规嵁鏍囧噯id鏌ヨ鐗╂枡-->
+ <select id="selFath" resultType="com.yuanchu.mom.pojo.Material">
+ select *
+ from mom_ocean.material
+ where state = 1
+ and id = (select material_id
+ from mom_ocean.standard
+ where standard.state = 1
+ and standard.id = #{id})
+ </select>
</mapper>
diff --git a/standard-server/src/main/resources/mapper/MbomMapper.xml b/standard-server/src/main/resources/mapper/MbomMapper.xml
new file mode 100644
index 0000000..4a312a6
--- /dev/null
+++ b/standard-server/src/main/resources/mapper/MbomMapper.xml
@@ -0,0 +1,49 @@
+<?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.mom.mapper.MbomMapper">
+ <!--鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�-->
+ <select id="selectVerByMbom" resultType="java.lang.Integer">
+ select distinct version
+ from mom_ocean.mbom
+ where state = 1
+ and technology_id in (select id
+ from mom_ocean.technology
+ where technology.state = 1
+ and specifications_id = #{specificationsId})
+ order by version desc
+ </select>
+
+ <!--鍙充晶鏁版嵁灞曠ず 鐗╂枡娓呭崟-->
+ <resultMap id="oneMap" type="map">
+ <id property="father" column="father"/>
+ <collection property="children" resultMap="twoMap" javaType="List"/>
+ </resultMap>
+ <resultMap id="twoMap" type="map">
+ <id property="tname" column="tname"/>
+ <collection property="children" resultMap="threeMap" javaType="List"/>
+ </resultMap>
+ <resultMap id="threeMap" type="map">
+ <id property="id" column="mid"/>
+ <result property="mname" column="mname"/>
+ <result property="specifications" column="specifications"/>
+ <result property="unit" column="unit"/>
+ <result property="num" column="num"/>
+ </resultMap>
+ <select id="selectAllMbom" resultMap="oneMap">
+ select m.id mid,
+ m.name mname,
+ unit,
+ num,
+ specifications,
+ t.name tname,
+ father
+ from mom_ocean.mbom m
+ left join mom_ocean.technology t on m.technology_id = t.id
+ where m.state = 1
+ and m.version = #{version}
+ and specifications_id = #{specificationsId}
+ <if test="message!=null and message!=''">
+ and m.name like concat('%',#{message},'%')
+ </if>
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/standard-server/src/main/resources/mapper/ProductMapper.xml b/standard-server/src/main/resources/mapper/ProductMapper.xml
index cee2fea..4fcd5c3 100644
--- a/standard-server/src/main/resources/mapper/ProductMapper.xml
+++ b/standard-server/src/main/resources/mapper/ProductMapper.xml
@@ -3,42 +3,69 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.ProductMapper">
+ <!--鏍规嵁鍨嬪彿id鏌ヨ椤圭洰(鎶�鏈寚鏍�)-->
+ <select id="selectProductList" resultType="java.util.Map">
+ select name,
+ father,
+ unit,
+ required,
+ internal
+ from mom_ocean.product
+ where state = 1
+ and technology_id in (select id
+ from mom_ocean.technology
+ where technology.state = 1
+ and specifications_id = #{specificationsId})
+ </select>
- <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.Product">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="father" column="father" jdbcType="VARCHAR"/>
- <result property="unit" column="unit" jdbcType="VARCHAR"/>
- <result property="required" column="required" jdbcType="VARCHAR"/>
- <result property="internal" column="internal" jdbcType="VARCHAR"/>
- <result property="state" column="state" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="version" column="version" jdbcType="INTEGER"/>
- <result property="specificationsId" column="specifications_id" jdbcType="INTEGER"/>
+ <!--鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�-->
+ <select id="selectVerByPro" resultType="java.lang.Integer">
+ select distinct version
+ from mom_ocean.product
+ where state = 1
+ and technology_id in (select id
+ from mom_ocean.technology
+ where technology.state = 1
+ and specifications_id = #{specificationsId})
+ order by version desc
+ </select>
+
+ <!--鍙充晶鏁版嵁灞曠ず 鎶�鏈寚鏍�(妫�楠岄」鐩�)-->
+ <resultMap id="oneMap" type="map">
+ <id property="tfather" column="tfather"/>
+ <collection property="children" resultMap="twoMap" javaType="List"/>
</resultMap>
-
- <resultMap id="selectTreeProduct" type="ProductDto">
- <id property="father" column="father" jdbcType="VARCHAR"/>
- <collection property="children" resultMap="productDto2ListMap"/>
+ <resultMap id="twoMap" type="map">
+ <id property="tname" column="tname"/>
+ <collection property="children" resultMap="threeMap" javaType="List"/>
</resultMap>
-
- <resultMap id="productDto2ListMap" type="ProductDto2">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="unit" column="unit" jdbcType="VARCHAR"/>
- <result property="required" column="required" jdbcType="VARCHAR"/>
- <result property="internal" column="internal" jdbcType="VARCHAR"/>
- <result property="state" column="state" jdbcType="INTEGER"/>
+ <resultMap id="threeMap" type="map">
+ <id property="pfather" column="pfather"/>
+ <collection property="children" resultMap="fourMap" javaType="List"/>
</resultMap>
-
- <select id="selectTreeProduct" resultMap="selectTreeProduct">
- SELECT p.id, p.`name`, IFNULL(p.`father`,p.`name`) father, p.`unit`, p.`required`, p.`internal`
- FROM product p
- where p.specifications_id = #{specifications}
- <if test="project != null and project != ''">
- AND p.father like concat('%',#{project},'%')
- </if>
- and p.state = 1
+ <resultMap id="fourMap" type="map">
+ <id property="pid" column="pid"/>
+ <result property="pname" column="pname"/>
+ <result property="unit" column="unit"/>
+ <result property="required" column="required"/>
+ <result property="internal" column="internal"/>
+ </resultMap>
+ <select id="selectAllPro" resultMap="oneMap">
+ select p.id pid,
+ p.name pname,
+ p.father pfather,
+ unit,
+ required,
+ internal,
+ t.father tfather,
+ t.name tname
+ from mom_ocean.product p
+ left join mom_ocean.technology t on p.technology_id = t.id
+ where p.state = 1
+ and p.version = #{version}
+ and specifications_id = #{specificationsId}
+ <if test="message!=null and message!=''">
+ and p.name like concat('%',#{message},'%')
+ </if>
</select>
</mapper>
diff --git a/standard-server/src/main/resources/mapper/TechniqueMapper.xml b/standard-server/src/main/resources/mapper/TechniqueMapper.xml
new file mode 100644
index 0000000..0d8255b
--- /dev/null
+++ b/standard-server/src/main/resources/mapper/TechniqueMapper.xml
@@ -0,0 +1,49 @@
+<?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.mom.mapper.TechniqueMapper">
+ <!--鏍规嵁鍨嬪彿id鏌ヨ鎵�鏈夌増鏈�-->
+ <select id="selectVerByTeq" resultType="java.lang.Integer">
+ select distinct version
+ from mom_ocean.technique
+ where state = 1
+ and technology_id in (select id
+ from mom_ocean.technology
+ where technology.state = 1
+ and specifications_id = #{specificationsId})
+ order by version desc
+ </select>
+
+ <!--鍙充晶鏁版嵁灞曠ず 鐢熶骇宸ヨ壓-->
+ <resultMap id="oneMap" type="map">
+ <id property="father" column="father"/>
+ <collection property="children" resultMap="twoMap" javaType="List"/>
+ </resultMap>
+ <resultMap id="twoMap" type="map">
+ <id property="name" column="name"/>
+ <collection property="children" resultMap="threeMap" javaType="List"/>
+ </resultMap>
+ <resultMap id="threeMap" type="map">
+ <id property="tqid" column="tqid"/>
+ <result property="device" column="device"/>
+ <result property="productFather" column="product_father"/>
+ <result property="product" column="product"/>
+ <result property="unit" column="unit"/>
+ </resultMap>
+ <select id="selectAllTeq" resultMap="oneMap">
+ select tq.id tqid,
+ device,
+ product_father,
+ product,
+ unit,
+ name,
+ father
+ from mom_ocean.technique tq
+ left join mom_ocean.technology tc on tq.technology_id = tc.id
+ where tq.state = 1
+ and specifications_id = #{specificationsId}
+ and tq.version = #{version}
+ <if test="message!=null and message!=''">
+ and device like concat('%',#{message},'%')
+ </if>
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/standard-server/src/main/resources/mapper/TechnologyMapper.xml b/standard-server/src/main/resources/mapper/TechnologyMapper.xml
index 1a5c4fe..aacc7ab 100644
--- a/standard-server/src/main/resources/mapper/TechnologyMapper.xml
+++ b/standard-server/src/main/resources/mapper/TechnologyMapper.xml
@@ -1,5 +1,38 @@
<?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.mom.mapper.TechnologyMapper">
+ <!--鏍规嵁鍨嬪彿id鏌ヨ鐗堟湰-->
+ <select id="selectVerByTec" resultType="java.lang.Integer">
+ select distinct version
+ from mom_ocean.technology
+ where state = 1
+ and specifications_id = #{specificationsId}
+ order by version desc
+ </select>
+ <!--鍙充晶鏁版嵁灞曠ず 宸ヨ壓璺嚎-->
+ <resultMap id="selectAllTecMap" type="map">
+ <id property="father" column="father"/>
+ <collection property="children" resultMap="selectAllTecMaps" javaType="List"/>
+ </resultMap>
+ <resultMap id="selectAllTecMaps" type="map">
+ <id property="id" column="id"/>
+ <result property="name" column="name"/>
+ <result property="dg" column="dg"/>
+ <result property="pq" column="pq"/>
+ </resultMap>
+ <select id="selectAllTec" resultMap="selectAllTecMap">
+ select id,
+ name,
+ father,
+ device_group dg,
+ production_quota pq
+ from mom_ocean.technology
+ where state = 1
+ and specifications_id = #{specificationsId}
+ and version = #{version}
+ <if test="message!=null and message!=''">
+ and father like concat('%',#{message},'%')
+ </if>
+ </select>
</mapper>
--
Gitblit v1.9.3