From cdaff9ab0d1b676e3b429171d6de0887c98f488c Mon Sep 17 00:00:00 2001 From: XiaoRuby <3114200645@qq.com> Date: 星期三, 26 七月 2023 09:15:31 +0800 Subject: [PATCH] LIMS管理系统框架-开发7-26标准库修改前 --- standard-server/src/main/resources/mapper/SpecificationsMapper.xml | 19 - standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java | 36 +++ standard-server/src/main/resources/mapper/ProductMapper.xml | 12 - standard-server/src/main/resources/mapper/MaterialMapper.xml | 2 standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java | 49 ---- standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java | 62 +++++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java | 55 ---- standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java | 55 ---- standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java | 24 ++ /dev/null | 13 - standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Specifications.java | 26 -- standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java | 30 -- standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java | 12 standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java | 16 - standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardMapper.java | 5 standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java | 27 -- standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java | 37 --- standard-server/src/main/resources/mapper/StandardMapper.xml | 5 standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java | 41 --- standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java | 12 - standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java | 73 ------ inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java | 1 standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standard.java | 18 - 23 files changed, 155 insertions(+), 475 deletions(-) diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java index c7ed1f0..4d916d9 100644 --- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java +++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java @@ -53,7 +53,6 @@ list.forEach(a-> { InspectionProductList inspectionProductList = new InspectionProductList(); inspectionProductList.setName(a.getName()) - .setMethod(a.getMethod()) .setUnit(a.getUnit()) .setRequired(a.getRequired()) .setInternal(a.getInternal()) 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 5469759..d3ca6fd 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 @@ -2,10 +2,7 @@ import com.yuanchu.limslaboratory.pojo.Material; -import com.yuanchu.limslaboratory.pojo.dto.UpdateMaterialInformation; import com.yuanchu.limslaboratory.service.MaterialService; -import com.yuanchu.limslaboratory.utils.JackSonUtil; -import com.yuanchu.limslaboratory.utils.RedisUtil; import com.yuanchu.limslaboratory.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -13,9 +10,6 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; /** * <p> @@ -25,7 +19,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-17 */ -@Api(tags = "鏍囧噯搴�-->4銆佽鏍�-->鏌ョ湅-->鐖舵ā鍧�") +@Api(tags = "鏍囧噯搴�-->1銆佺墿鏂�") @RestController @RequestMapping("/material") public class MaterialController { @@ -36,31 +30,11 @@ @ApiOperation("娣诲姞鐗╂枡") @PostMapping("/add") public Result<?> addMaterialInformation(@RequestBody Material material) { - Integer isMaterialSuccess = materialService.addMaterialInformation(material); + Integer isMaterialSuccess = null; if (isMaterialSuccess == 1) { return Result.success("娣诲姞鐗╂枡銆�"+ material.getName() +"銆戞垚鍔燂紒"); } return Result.fail("娣诲姞鐗╂枡銆�"+ material.getName() +"銆戝け璐ワ紒"); - } - - @ApiOperation("鏍规嵁瑙勬牸ID鏌ヨ鎵�鏈夌墿鏂�") - @GetMapping("/list") - @ApiImplicitParams(value = { - @ApiImplicitParam(value = "瑙勬牸ID", name = "specificationsId", dataTypeClass = String.class) - }) - public Result<?> getListMaterialInformation(String specificationsId) { - List<Map<String, Object>> listMaterialInformation = materialService.getListMaterialInformation(specificationsId); - return Result.success(listMaterialInformation); - } - - @ApiOperation("鏍规嵁鐗╂枡ID鏌ヨ鐗╂枡璇︽儏") - @GetMapping("/list_id") - @ApiImplicitParams(value = { - @ApiImplicitParam(value = "鐗╂枡ID", name = "materialId", dataTypeClass = String.class) - }) - public Result<?> getListIdMaterialInformation(String materialId) throws Exception { - Material listIdMaterialInformation = materialService.ListIdMaterialInformation(materialId); - return Result.success(listIdMaterialInformation); } @ApiOperation("鏍规嵁鐗╂枡ID鍒犻櫎鐗╂枡") @@ -74,16 +48,5 @@ return Result.success("鍒犻櫎鎴愬姛锛�"); } return Result.fail("鍒犻櫎澶辫触锛�"); - } - - @ApiOperation("淇敼鐗╂枡") - @PutMapping("/update") - public Result<?> updateMaterialInformation(@RequestBody UpdateMaterialInformation updateMaterialInformation) throws Exception { - Material material = JackSonUtil.unmarshal(JackSonUtil.marshal(updateMaterialInformation), Material.class); - Integer isUpdateMaterialSuccess = materialService.updateMaterialInformation(material); - if (isUpdateMaterialSuccess == 1) { - return Result.success("淇敼鐗╂枡銆�"+ material.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("淇敼鐗╂枡銆�"+ material.getName() +"銆戝け璐ワ紒"); } } 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 65e8dac..ac7a176 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 @@ -21,50 +21,13 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-17 */ -@Api(tags = "鏍囧噯搴�-->5銆佽鏍�-->鏌ョ湅-->瀛愭ā鍧�") +@Api(tags = "鏍囧噯搴�-->4銆侀」鐩�") @RestController @RequestMapping("/product") public class ProductController { @Autowired private ProductService productService; - - @ApiOperation("娣诲姞娴嬭瘯鏍囧噯") - @PostMapping("/add") - public Result<?> addProductInformation(@RequestHeader("X-Token") String token, @RequestBody Product product) throws Exception { - Object userMessage = RedisUtil.get(token); - if (!ObjectUtils.isEmpty(userMessage)){ - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(userMessage), Map.class); - product.setUserId(Integer.parseInt(unmarshal.get("id").toString())); - } else { - return Result.fail("瀵逛笉璧凤紝Token閿欒!"); - } - Integer isProductSuccess = productService.addProductInformation(product); - if (isProductSuccess == 1) { - return Result.success("娣诲姞鐗╂枡銆�"+ product.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("娣诲姞鐗╂枡銆�"+ product.getName() +"銆戝け璐ワ紒"); - } - - @ApiOperation("鏍规嵁鐗╂枡ID鏌ヨ鎵�鏈夋祴璇曟爣鍑�") - @GetMapping("/list") - @ApiImplicitParams(value = { - @ApiImplicitParam(value = "鐗╂枡ID", name = "materialId", dataTypeClass = String.class) - }) - public Result<?> getListProductInformation(String materialId) { - List<Map<String, Object>> listMaterialInformation = productService.getListProductInformation(materialId); - return Result.success(listMaterialInformation); - } - - @ApiOperation("鏍规嵁娴嬭瘯鏍囧噯ID鏌ヨ鍩烘湰淇℃伅") - @GetMapping("/productId") - @ApiImplicitParams(value = { - @ApiImplicitParam(value = "娴嬭瘯鏍囧噯ID", name = "productId", dataTypeClass = String.class) - }) - public Result<?> getProductInformation(Integer productId) { - Map<String, Object> productInformation = productService.getProductInformation(productId); - return Result.success(productInformation); - } @ApiOperation("鍒犻櫎娴嬭瘯鏍囧噯妯″潡鏁版嵁") @DeleteMapping("/delete") @@ -77,15 +40,5 @@ return Result.success("鍒犻櫎鎴愬姛锛�"); } return Result.fail("鍒犻櫎澶辫触锛�"); - } - - @ApiOperation("鏍规嵁娴嬭瘯鏍囧噯Id淇敼鏁版嵁") - @PutMapping("/update") - public Result<?> updateMaterialInformation(@RequestBody Product product) { - Integer isUpdateMaterialSuccess = productService.updateMaterialInformation(product); - if (isUpdateMaterialSuccess == 1) { - return Result.success("淇敼銆�"+ product.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("淇敼銆�"+ product.getName() +"銆戝け璐ワ紒"); } } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java deleted file mode 100644 index 1c91dff..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java +++ /dev/null @@ -1,90 +0,0 @@ -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.SerialNumber; -import com.yuanchu.limslaboratory.service.SerialNumberService; -import com.yuanchu.limslaboratory.utils.JackSonUtil; -import com.yuanchu.limslaboratory.utils.MyUtil; -import com.yuanchu.limslaboratory.utils.RedisUtil; -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.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * <p> - * 鍓嶇鎺у埗鍣� - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -@Api(tags = "鏍囧噯搴�-->2銆佸瀷鍙�") -@RestController -@RequestMapping("/serial-number") -public class SerialNumberController { - - @Autowired - private SerialNumberService serialNumberService; - - @ApiOperation("娣诲姞鍨嬪彿") - @PostMapping("/add") - public Result<?> addSerialNumberInformation(@RequestHeader("X-Token") String token,@RequestBody SerialNumber serialNumber) throws Exception { - Object object = RedisUtil.get(token); - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); - serialNumber.setUserId((Integer) unmarshal.get("id")); - Integer isStandardsSuccess = serialNumberService.addSerialNumberInformation(serialNumber); - if (isStandardsSuccess == 1) { - return Result.success("娣诲姞銆�"+ serialNumber.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("娣诲姞銆�"+ serialNumber.getName() +"銆戝け璐ワ紒"); - } - - @ApiOperation("鐐瑰嚮渚ц竟鏍忔爣鍑嗭紝鍒嗛〉鏌ヨ鎵�鏈夊瀷鍙�") - @ApiImplicitParams(value = { - @ApiImplicitParam(value = "鍨嬪彿/鍨嬪彿鍚嶇О", name = "IdOrNameOfSerialNumber", dataTypeClass = String.class), - @ApiImplicitParam(value = "鏍囧噯鍙稩d", name = "standardsId", dataTypeClass = String.class, required = true), - @ApiImplicitParam(name = "pageNo", value = "璧峰椤�", dataTypeClass = Integer.class, required = true), - @ApiImplicitParam(name = "pageSize", value = "姣忎竴椤垫暟閲�", dataTypeClass = Integer.class, required = true), - }) - @GetMapping("/list") - public Result<?> listSerialNumberInformation(String IdOrNameOfSerialNumber, String standardsId, Integer pageNo, Integer pageSize){ - IPage<Map<String, Object>> selectStandards= serialNumberService.listSerialNumberInformation(IdOrNameOfSerialNumber,standardsId, new Page<Object>(pageNo, pageSize)); - Map<String, Object> map = new HashMap<>(); - map.put("row", selectStandards.getRecords()); - map.put("total", selectStandards.getTotal()); - return Result.success(map); - } - - @ApiOperation("鏍规嵁Id淇敼鍨嬪彿") - @PutMapping("/update") - public Result<?> updateSerialNumberInformation(@RequestHeader("X-Token") String token, @RequestBody SerialNumber serialNumber) throws Exception { - Object object = RedisUtil.get(token); - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); - serialNumber.setUserId((Integer) unmarshal.get("id")); - Integer isUpdateSerialNumberSuccess = serialNumberService.updateSerialNumberInformation(serialNumber); - if (isUpdateSerialNumberSuccess == 1){ - return Result.success("鏇存柊鎴愬姛锛�"); - } - return Result.fail("鏇存柊澶辫触锛�"); - } - - @ApiOperation("鏍规嵁Id鍒犻櫎鍨嬪彿") - @DeleteMapping("/delete") - public Result<?> deleteSerialNumberInformation(String serialNumberId) { - Integer isDeleteSerialNumberSuccess = serialNumberService.deleteSerialNumberInformation(serialNumberId); - if (isDeleteSerialNumberSuccess == 1){ - return Result.success("鍒犻櫎鎴愬姛锛�"); - } - return Result.fail("鍒犻櫎澶辫触锛�"); - } -} 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 6b7ff99..bfc1627 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 @@ -1,26 +1,14 @@ 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.Specifications; import com.yuanchu.limslaboratory.service.SpecificationsService; -import com.yuanchu.limslaboratory.utils.JackSonUtil; -import com.yuanchu.limslaboratory.utils.RedisUtil; import com.yuanchu.limslaboratory.vo.Result; -import com.yuanchu.limslaboratory.pojo.dto.UpdateSpeStateSpecificationsDto; -import com.yuanchu.limslaboratory.pojo.dto.UpdateSpecificationsInformationDto; 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.util.ObjectUtils; import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; /** * <p> @@ -30,62 +18,13 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-11 */ -@Api(tags = "鏍囧噯搴�-->3銆佸瀷鍙�-->浜у搧瑙勬牸") +@Api(tags = "鏍囧噯搴�-->3銆佷骇鍝佽鏍�") @RestController @RequestMapping("/specifications") public class SpecificationsController { @Autowired private SpecificationsService specificationsService; - - @ApiOperation("娣诲姞浜у搧瑙勬牸") - @PostMapping("/add") - public Result<?> addSpecificationsInformation(@RequestHeader("X-Token") String token,@RequestBody Specifications specifications) throws Exception { - Object object = RedisUtil.get(token); - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); - specifications.setUserId((Integer) unmarshal.get("id")); - Integer isStandardsSuccess = specificationsService.addSpecificationsInformation(specifications); - if (isStandardsSuccess == 1) { - return Result.success("娣诲姞銆�"+ specifications.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("娣诲姞銆�"+ specifications.getName() +"銆戝け璐ワ紒"); - } - - @ApiOperation("鏍规嵁鍨嬪彿鏌ヨ浜у搧瑙勬牸") - @ApiImplicitParams(value = { - @ApiImplicitParam(name = "pageNo", value = "璧峰椤�", dataTypeClass = Integer.class, required = true), - @ApiImplicitParam(name = "pageSize", value = "姣忎竴椤垫暟閲�", dataTypeClass = Integer.class, required = true), - @ApiImplicitParam(name = "specificationsName", value = "瑙勬牸鍚嶇О", dataTypeClass = String.class), - @ApiImplicitParam(name = "serialNumberId", value = "鍨嬪彿ID", dataTypeClass = String.class,required = true) - }) - @GetMapping("/list") - public Result<?> listSpecificationsInformation(Integer pageNo, - Integer pageSize, - String specificationsName, - String serialNumberId){ - IPage<Map<String, Objects>> pageList= specificationsService.listSpecificationsInformation(specificationsName,serialNumberId,new Page<Objects>(pageNo, pageSize)); - Map<String, Object> map = new HashMap<>(); - map.put("row", pageList.getRecords()); - map.put("total", pageList.getTotal()); - return Result.success(map); - } - - @ApiOperation("缂栬緫浜у搧瑙勬牸") - @PutMapping("/update") - public Result<?> updateSpecificationsInformation(@RequestHeader("X-Token") String token, @RequestBody UpdateSpecificationsInformationDto updateSpecificationsInformationDto) throws Exception { - Object object = RedisUtil.get(token); - if (ObjectUtils.isEmpty(object)){ - return Result.fail("瀵逛笉璧凤紝璇锋惡甯oken!"); - } - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); - updateSpecificationsInformationDto.setUserId((Integer) unmarshal.get("id")); - Specifications specifications = JackSonUtil.unmarshal(JackSonUtil.marshal(updateSpecificationsInformationDto), Specifications.class); - Integer isStandardsSuccess = specificationsService.updateSpecificationsInformation(specifications); - if (isStandardsSuccess == 1) { - return Result.success("鏇存柊銆�"+ specifications.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("鏇存柊銆�"+ specifications.getName() +"銆戝け璐ワ紒"); - } @ApiOperation("鍒犻櫎浜у搧瑙勬牸") @ApiImplicitParams(value = { @@ -98,15 +37,5 @@ return Result.success("鍒犻櫎鎴愬姛锛�"); } return Result.fail("鍒犻櫎澶辫触锛�"); - } - - @ApiOperation("鏇存柊瑙勬牸鐘舵��") - @PutMapping("/update_spe_state") - public Result<?> updateSpeStateSpecifications(@RequestBody UpdateSpeStateSpecificationsDto updateSpeStateSpecificationsDto) { - Integer isStandardsSuccess = specificationsService.updateSpeStateSpecifications(updateSpeStateSpecificationsDto); - if (isStandardsSuccess == 1) { - return Result.success("鎿嶄綔鎴愬姛锛�"); - } - return Result.fail("鎿嶄綔澶辫触锛�"); } } 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 new file mode 100644 index 0000000..37ab29e --- /dev/null +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardController.java @@ -0,0 +1,36 @@ +package com.yuanchu.limslaboratory.controller; + + +import com.yuanchu.limslaboratory.service.StandardService; +import com.yuanchu.limslaboratory.vo.Result; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * <p> + * 鍓嶇鎺у埗鍣� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2023-07-11 + */ +@Api(tags = "鏍囧噯搴�-->2銆佹爣鍑�") +@RestController +@RequestMapping("/standards") +public class StandardController { + + @Autowired + private StandardService standardService; + + @ApiOperation("鏍规嵁ID鍒犻櫎鏁版嵁") + @DeleteMapping("/delete") + public Result<?> deleteStandardsInformation(String standardsId) { + Integer isDeleteSuccess = standardService.deleteStandardsInformation(standardsId); + if (isDeleteSuccess == 1){ + return Result.success("鍒犻櫎鎴愬姛锛�"); + } + return Result.fail("鍒犻櫎澶辫触锛�"); + } +} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java deleted file mode 100644 index 0190a3d..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.yuanchu.limslaboratory.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.Standards; -import com.yuanchu.limslaboratory.service.StandardsService; -import com.yuanchu.limslaboratory.utils.JackSonUtil; -import com.yuanchu.limslaboratory.utils.MyUtil; -import com.yuanchu.limslaboratory.utils.RedisUtil; -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.util.ObjectUtils; -import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * <p> - * 鍓嶇鎺у埗鍣� - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -@Api(tags = "鏍囧噯搴�-->1銆佲瓙猸愨瓙") -@RestController -@RequestMapping("/standards") -public class StandardsController { - - @Autowired - private StandardsService standardsService; - - @ApiOperation("娣诲姞鏍囧噯") - @PostMapping("/add") - public Result<?> addStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception { - Object object = RedisUtil.get(token); - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); - standards.setUserId((Integer) unmarshal.get("id")); - Integer isStandardsSuccess = standardsService.addStandardsInformation(standards); - if (isStandardsSuccess == 1) { - return Result.success("娣诲姞銆�"+ standards.getName() +"銆戞垚鍔燂紒"); - } - return Result.fail("娣诲姞銆�"+ standards.getName() +"銆戝け璐ワ紒"); - } - - @ApiOperation("渚ц竟鏍忔煡璇㈡墍鏈夋爣鍑嗘暟鎹�") - @GetMapping("/list") - public Result<?> listStandardsInformation(){ - List<Map<String, Object>> list = standardsService.listStandardsInformation(); - return Result.success(list); - } - - @ApiOperation("鐐瑰嚮鍏ㄩ儴锛氬垎椤垫煡璇㈡墍鏈夋爣鍑嗘暟鎹�") - @ApiImplicitParams(value = { - @ApiImplicitParam(name = "pageNo", value = "璧峰椤�", dataTypeClass = Integer.class, required = true), - @ApiImplicitParam(name = "pageSize", value = "姣忎竴椤垫暟閲�", dataTypeClass = Integer.class, required = true), - @ApiImplicitParam(value = "鏍囧噯鍙�/鏍囧噯鍚嶇О", name = "IdOrNameOfStandards", dataTypeClass = String.class) - }) - @GetMapping("/list_page") - public Result<?> listPageStandardsInformation(Integer pageNo, Integer pageSize, String IdOrNameOfStandards){ - IPage<Map<String, Object>> listPage = standardsService.listPageStandardsInformation(new Page<Object>(pageNo, pageSize), IdOrNameOfStandards); - Map<String, Object> map = new HashMap<>(); - map.put("row", listPage.getRecords()); - map.put("total", listPage.getTotal()); - return Result.success(map); - } - - @ApiOperation("鏍规嵁Id淇敼鍙傛暟") - @PutMapping("/update") - public Result<?> updateStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception { - Object object = RedisUtil.get(token); - Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); - standards.setUserId((Integer) unmarshal.get("id")); - Integer isUpdateSuccess = standardsService.updateStandardsInformation(standards); - if (isUpdateSuccess == 1){ - return Result.success("鏇存柊鎴愬姛锛�"); - } - return Result.fail("鏇存柊澶辫触锛�"); - } - - @ApiOperation("鏍规嵁ID鍒犻櫎鏁版嵁") - @DeleteMapping("/delete") - public Result<?> deleteStandardsInformation(String standardsId) { - Integer isDeleteSuccess = standardsService.deleteStandardsInformation(standardsId); - if (isDeleteSuccess == 1){ - return Result.success("鍒犻櫎鎴愬姛锛�"); - } - return Result.fail("鍒犻櫎澶辫触锛�"); - } -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SerialNumberMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SerialNumberMapper.java deleted file mode 100644 index 3e18ceb..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SerialNumberMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.yuanchu.limslaboratory.mapper; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.SerialNumber; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -import java.util.List; -import java.util.Map; - -/** - * <p> - * Mapper 鎺ュ彛 - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -public interface SerialNumberMapper extends BaseMapper<SerialNumber> { - - IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page); -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardsMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardMapper.java similarity index 77% rename from standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardsMapper.java rename to standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardMapper.java index 6dcc176..3a15040 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardsMapper.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardMapper.java @@ -2,10 +2,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.Standards; +import com.yuanchu.limslaboratory.pojo.Standard; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import java.util.List; import java.util.Map; /** @@ -16,7 +15,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-11 */ -public interface StandardsMapper extends BaseMapper<Standards> { +public interface StandardMapper extends BaseMapper<Standard> { IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards); } 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 4472d52..9eee171 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 @@ -4,9 +4,7 @@ import java.io.Serializable; import java.util.Date; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -29,26 +27,18 @@ private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "鐗╂枡id", example = "152453211563212", required = true) + @ApiModelProperty(value = "鐗╂枡id", hidden = true) + @TableId(value = "id", type = IdType.AUTO) private String id; + + @ApiModelProperty(value = "鐗╂枡缂栫爜", example = "152453211563212", required = true) + private String code; @ApiModelProperty(value = "鐗╂枡鍚嶇О", example = "鐭冲ご", required = true) private String name; - @ApiModelProperty(value = "渚涘簲鍟�", example = "鐧惧害", required = true) - private String supplier; - - @ApiModelProperty(value = "鐗╂枡瀛樻斁鍦�", example = "浠撳簱涓�锛屼簩鍙锋灦", required = true) - private String location; - - @ApiModelProperty(value = "鐗╂枡鏁伴噺", example = "200", required = true) - private Integer num; - - @ApiModelProperty(value = "鎵规", example = "1", required = true) - private String batch; - - @ApiModelProperty(value = "鐩樺彿", example = "152453211563212", required = true) - private String reelNumber; + @ApiModelProperty(value = "0锛氬師鏉愭枡锛�1锛氭垚鍝侊紱2锛氬崐鎴愬搧", example = "1", required = true) + private Integer type; @TableLogic(value = "1", delval = "0") @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true) @@ -66,8 +56,4 @@ @ApiModelProperty(value = "涔愯閿�", hidden = true) private Integer version; - - @ApiModelProperty(value = "鍏宠仈 瑙勬牸id", example = "1", required = true) - private Integer specificationsId; - } 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 fcf0006..0acfd49 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 @@ -34,16 +34,13 @@ @ApiModelProperty(value = "娴嬭瘯鏍囧噯鍚嶇О", example = "鍗曚綅闀垮害璐ㄩ噺", required = true) private String name; - @ApiModelProperty(value = "璇曢獙鏂规硶", example = "--", required = true) - private String method; - @ApiModelProperty(value = "娴嬭瘯鏍囧噯鐖剁被", example = "閾濆寘閽㈣姱閾濈粸绾�") private String father; @ApiModelProperty(value = "鍗曚綅", example = "km", required = true) private String unit; - @ApiModelProperty(value = "鎷涙爣浜鸿姹傚��", example = "<=0.3458", required = true) + @ApiModelProperty(value = "鏍囧噯鍊�", example = "<=0.3458", required = true) private String required; @ApiModelProperty(value = "鍐呮帶鍊�", example = "<=0.3458", required = true) @@ -66,11 +63,8 @@ @ApiModelProperty(value = "涔愯閿�", hidden = true) private Integer version; - @ApiModelProperty(value = "鍏宠仈 鐢ㄦ埛id", hidden = true) - private Integer userId; - - @ApiModelProperty(value = "鍏宠仈 鐗╂枡id", example = "152453211563212", required = true) - private String materialId; + @ApiModelProperty(value = "鍏宠仈 鐗╂枡id", example = "1", hidden = true) + private Integer specifications_id; } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/SerialNumber.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/SerialNumber.java deleted file mode 100644 index 464092d..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/SerialNumber.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.yuanchu.limslaboratory.pojo; - -import java.io.Serializable; -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.Version; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * <p> - * - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="SerialNumber瀵硅薄", description="鍨嬪彿") -public class SerialNumber implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(value = "鍨嬪彿缂栧彿", example = "ModelNumber001", required = true) - private String id; - - @ApiModelProperty(value = "鍨嬪彿鍚嶇О",example = "鍏夌氦2.0.1", required = true) - private String name; - - @TableLogic(value = "1", delval = "0") - @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; - - @ApiModelProperty(value = "涔愯閿�", hidden = true) - @Version - private Integer version; - - @ApiModelProperty(value = "鍏宠仈瀛楁 鏍囧噯缂栧彿id", example = "230711000002", required = true) - private String standardsId; - - @ApiModelProperty(value = "鍏宠仈瀛楁 娣诲姞鐢ㄦ埛id", hidden = true) - private Integer userId; - -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Specifications.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Specifications.java index 5cab1a0..023a593 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Specifications.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Specifications.java @@ -32,26 +32,8 @@ @TableId(value = "id", type = IdType.AUTO) private Integer id; - @ApiModelProperty(value = "瑙勬牸缂栧彿", example = "modelId", required = true) - private String number; - @ApiModelProperty(value = "浜у搧瑙勬牸鍚嶇О", example = "AB", required = true) private String name; - - @ApiModelProperty(value = "鐢熶骇鎸囦护鍙�", example = "test", required = true) - private String instruct; - - @ApiModelProperty(value = "鐢靛帇绛夌骇", example = "test", required = true) - private String voltageLevel; - - @ApiModelProperty(value = "涓荤嚎蹇冩埅闈�", example = "test", required = true) - private String crossSection; - - @ApiModelProperty(value = "涓荤嚎鑺姱鏁�", example = "test", required = true) - private String numberOfCores; - - @ApiModelProperty(value = "瑙勬牸鐘舵�� 0锛氬仠鐢紱1锛氭甯革紱-1锛氳崏绋�", hidden = true) - private Integer spe_state; @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true) @TableLogic(value = "1", delval = "0") @@ -71,13 +53,7 @@ @Version private Integer version; - @ApiModelProperty(value = "鍏宠仈瀛楁 鍨嬪彿id", hidden = true) - private String vel; - - @ApiModelProperty(value = "鍏宠仈瀛楁 鍨嬪彿id", example = "230711000002", required = true) - private String serialId; - @ApiModelProperty(value = "鍏宠仈瀛楁 鐢ㄦ埛id", hidden = true) - private Integer userId; + private Integer standardId; } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standards.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standard.java similarity index 74% rename from standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standards.java rename to standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standard.java index c9088fe..4f25ea6 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standards.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Standard.java @@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.annotation.*; -import java.time.LocalDateTime; import java.io.Serializable; import java.util.Date; @@ -23,22 +22,16 @@ @Data @EqualsAndHashCode(callSuper = false) @ApiModel(value="Standards瀵硅薄", description="鏍囧噯") -public class Standards implements Serializable { +public class Standard implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "鏍囧噯缂栧彿 yyMMdd000001(000001++)", example = "230711000001", required = true) - @TableId(value = "id", type = IdType.INPUT) - private String id; + @TableId(value = "id", type = IdType.AUTO) + private Integer id; @ApiModelProperty(value = "鏍囧噯鍚嶇О", example = "鍏夌氦", required = true) private String name; - - @ApiModelProperty(value = "鑻辨枃鍚嶇О", example = "OpticalFibre", required = true) - private String engName; - - @ApiModelProperty(value = "0锛氬師鏉愭枡锛�1锛氱數绾跨數缂�", example = "1", required = true) - private Integer type; @TableLogic(value = "1", delval = "0") @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true) @@ -58,8 +51,7 @@ @Version private Integer version; - @ApiModelProperty(value = "鍏宠仈瀛楁 鏇存柊浜篿d", hidden = true) - private Integer userId; - + @ApiModelProperty(value = "鐗╂枡Id", hidden = true) + private Integer materialId; } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateMaterialInformation.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateMaterialInformation.java deleted file mode 100644 index 7a97a12..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateMaterialInformation.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.yuanchu.limslaboratory.pojo.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="鏍囧噯搴�-->瑙勬牸鍨嬪彿-->鐗╂枡鏇存柊", description="鐢ㄤ簬瀵硅鏍肩殑鏇存柊") -public class UpdateMaterialInformation { - - @ApiModelProperty(value = "鐗╂枡id", example = "152453211563212", required = true) - private String id; - - @ApiModelProperty(value = "鐗╂枡鍚嶇О", example = "鐭冲ご", required = true) - private String name; - - @ApiModelProperty(value = "渚涘簲鍟�", example = "鐧惧害", required = true) - private String supplier; - - @ApiModelProperty(value = "鐗╂枡瀛樻斁鍦�", example = "浠撳簱涓�锛屼簩鍙锋灦", required = true) - private String location; - - @ApiModelProperty(value = "鐗╂枡鏁伴噺", example = "200", required = true) - private Integer num; - - @ApiModelProperty(value = "鎵规", example = "1", required = true) - private String batch; - - @ApiModelProperty(value = "鐩樺彿", example = "152453211563212", required = true) - private String reelNumber; -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateSpeStateSpecificationsDto.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateSpeStateSpecificationsDto.java deleted file mode 100644 index 468cb7f..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateSpeStateSpecificationsDto.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.yuanchu.limslaboratory.pojo.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="鏍囧噯搴�-->瑙勬牸鍨嬪彿-->鐢ㄤ簬瀵硅鏍肩姸鎬佺殑淇敼", description="鐢ㄤ簬瀵硅鏍肩姸鎬佺殑淇敼") -public class UpdateSpeStateSpecificationsDto { - - @ApiModelProperty(value = "瑙勬牸id", example = "2", required = true) - private Integer id; - - @ApiModelProperty(value = "瑙勬牸鐘舵�� 0锛氬仠鐢紱1锛氭甯革紱-1锛氳崏绋�", example = "1", required = true) - private Integer spe_state; -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateSpecificationsInformationDto.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateSpecificationsInformationDto.java deleted file mode 100644 index 8a186dc..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/dto/UpdateSpecificationsInformationDto.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.yuanchu.limslaboratory.pojo.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="鏍囧噯搴�-->瑙勬牸鍨嬪彿-->缂栬緫瀵硅薄", description="鐢ㄤ簬瀵硅鏍肩殑鏇存柊") -public class UpdateSpecificationsInformationDto { - - @ApiModelProperty(value = "瑙勬牸id", example = "2", required = true) - private Integer id; - - @ApiModelProperty(value = "瑙勬牸缂栧彿", example = "modelId", required = true) - private String number; - - @ApiModelProperty(value = "浜у搧瑙勬牸鍚嶇О", example = "AB", required = true) - private String name; - - @ApiModelProperty(value = "鐢熶骇鎸囦护鍙�", example = "test", required = true) - private String instruct; - - @ApiModelProperty(value = "鐢靛帇绛夌骇", example = "test", required = true) - private String voltageLevel; - - @ApiModelProperty(value = "涓荤嚎蹇冩埅闈�", example = "test", required = true) - private String crossSection; - - @ApiModelProperty(value = "涓荤嚎鑺姱鏁�", example = "test", required = true) - private String numberOfCores; - - @ApiModelProperty(value = "瑙勬牸鐘舵�� 0锛氬仠鐢紱1锛氭甯革紱-1锛氳崏绋�", example = "1", required = true) - private Integer spe_state; - - @ApiModelProperty(value = "鍏宠仈瀛楁 鍨嬪彿id", example = "230711000002", required = true) - private String serialId; - - @ApiModelProperty(value = "鍏宠仈瀛楁 鐢ㄦ埛id", hidden = true) - private Integer userId; -} 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 b0e93cb..28e5a43 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 @@ -2,7 +2,6 @@ import com.yuanchu.limslaboratory.pojo.Material; import com.baomidou.mybatisplus.extension.service.IService; -import com.yuanchu.limslaboratory.pojo.dto.UpdateMaterialInformation; import java.util.List; import java.util.Map; @@ -16,16 +15,10 @@ * @since 2023-07-17 */ public interface MaterialService extends IService<Material> { + List<Material> selectMaterialLimit(int pageSize,int countSize); - Integer addMaterialInformation(Material material); - - /** - * 渚ц竟鏍忕墿鏂欐暟鎹� - * @param specificationsId - * @return - */ - List<Map<String, Object>> getListMaterialInformation(String specificationsId); + Map selectMaterialById(String materialId); /** * 鍒犻櫎绛変簬MaterialId鐨勬暟鎹� @@ -35,25 +28,9 @@ Integer deleteMaterialInformation(String materialId); /** - * 鏇存柊Material鐨勬暟鎹� - * @param material - * @return - */ - Integer updateMaterialInformation(Material material); - - /** * 鍒犻櫎绛変簬SpecificationsId鐨勭墿鏂欐暟鎹� * @param deleteSpecificationsId * @return */ List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId); - - Map selectMaterialById(String materialId); - - /** - * 鏍规嵁Id鏌ヨ瑙勬牸璇︽儏 - * @param materialId - * @return - */ - Material ListIdMaterialInformation(String materialId) throws Exception; } 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 66bb330..9940876 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 @@ -16,19 +16,7 @@ * @since 2023-07-17 */ public interface ProductService extends IService<Product> { - - /*閫氳繃鐗╂枡id鑾峰彇鐗╂枡淇″強涓嬪睘鐨勯」鐩垪琛�*/ - List<Product> selectProductByMaterialId(String materialId); - - Integer addProductInformation(Product product); - - List<Map<String, Object>> getListProductInformation(String materialId); - - Map<String, Object> getProductInformation(Integer productId); - Integer deleteProductInformation(Integer productId); void MaterialIdDeleteProduct(List<String> deleteMaterialId); - - Integer updateMaterialInformation(Product product); } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java deleted file mode 100644 index ed9ffe5..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.yuanchu.limslaboratory.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.SerialNumber; -import com.baomidou.mybatisplus.extension.service.IService; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Map; - -/** - * <p> - * 鏈嶅姟绫� - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -public interface SerialNumberService extends IService<SerialNumber> { - - /** - * 娣诲姞鍨嬪彿锛岄鍏堥渶瑕佸垽鏂敤鎴凤紝鏍囧噯缂栫爜鏄惁瀛樺湪 - * @param serialNumber - * @return - */ - Integer addSerialNumberInformation(SerialNumber serialNumber); - - /** - * 鍒嗛〉鏌ヨ - * @param idOrNameOfSerialNumber - * @param standardsId - * @param page - * @return - */ - IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page); - - /** - * 鏍规嵁鏍囧噯Id鏌ヨ鎵�鏈夊瀷鍙� - * @param id - * @return - */ - List<Map<String, Object>> selectIdSerialNumberInformation(String id); - - /** - * 鏍规嵁Id淇敼鍚嶇О - * @param serialNumber - * @return - */ - Integer updateSerialNumberInformation(SerialNumber serialNumber); - - List<String> StandardsIdDeleteSerialNumber(String standardsId); - - /** - * 鏍规嵁鍨嬪彿Id鍒犻櫎鏁版嵁 - * @param serialNumberId - * @return - */ - @Transactional(rollbackFor = Exception.class) - Integer deleteSerialNumberInformation(String serialNumberId); -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java index 81adab5..9111ec9 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java @@ -1,15 +1,10 @@ package com.yuanchu.limslaboratory.service; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.limslaboratory.pojo.Specifications; import com.baomidou.mybatisplus.extension.service.IService; -import com.yuanchu.limslaboratory.pojo.dto.UpdateSpeStateSpecificationsDto; import org.springframework.transaction.annotation.Transactional; import java.util.List; -import java.util.Map; -import java.util.Objects; /** * <p> @@ -20,15 +15,6 @@ * @since 2023-07-11 */ public interface SpecificationsService extends IService<Specifications> { - - Integer addSpecificationsInformation(Specifications specifications); - - Map<String,Object> selectSNameSNName(int materialId); - - IPage<Map<String, Objects>> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page); - - Integer updateSpecificationsInformation(Specifications specifications); - /** * 澶氳〃鍒犻櫎锛岃〃鏍煎垎鍒湁锛歋pecification --> Material --> Product * @param specificationsId @@ -38,6 +24,4 @@ Integer deleteSpecifications(Integer specificationsId); List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId); - - Integer updateSpeStateSpecifications(UpdateSpeStateSpecificationsDto updateSpeStateSpecificationsDto); } 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 new file mode 100644 index 0000000..643d7cc --- /dev/null +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardService.java @@ -0,0 +1,24 @@ +package com.yuanchu.limslaboratory.service; + +import com.yuanchu.limslaboratory.pojo.Standard; +import com.baomidou.mybatisplus.extension.service.IService; +import org.springframework.transaction.annotation.Transactional; + +/** + * <p> + * 鏈嶅姟绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2023-07-11 + */ +public interface StandardService extends IService<Standard> { + + /** + * 鏍规嵁鏍囧噯Id鍒犻櫎鏁版嵁 + * @param standardsId + * @return + */ + @Transactional(rollbackFor = Exception.class) + Integer deleteStandardsInformation(String standardsId); +} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java deleted file mode 100644 index ee3b5ef..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.yuanchu.limslaboratory.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.Standards; -import com.baomidou.mybatisplus.extension.service.IService; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Map; - -/** - * <p> - * 鏈嶅姟绫� - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -public interface StandardsService extends IService<Standards> { - - Integer addStandardsInformation(Standards standards); - - List<Map<String, Object>> listStandardsInformation(); - - /** - * 鏍规嵁Id鏌ヨ鏄惁瀛樺湪璇ユ爣鍑� - */ - Boolean standardsIsNull(String Id); - - IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards); - - /** - * 鏍规嵁Id淇敼瀛楁 - * @param standards - * @return - */ - Integer updateStandardsInformation(Standards standards); - - /** - * 鏍规嵁鏍囧噯Id鍒犻櫎鏁版嵁 - * @param standardsId - * @return - */ - @Transactional(rollbackFor = Exception.class) - Integer deleteStandardsInformation(String standardsId); -} 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 a7839fe..02ac399 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,17 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.yuanchu.limslaboratory.pojo.Material; import com.yuanchu.limslaboratory.mapper.MaterialMapper; -import com.yuanchu.limslaboratory.pojo.Specifications; -import com.yuanchu.limslaboratory.pojo.dto.UpdateMaterialInformation; import com.yuanchu.limslaboratory.service.MaterialService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.limslaboratory.service.ProductService; -import com.yuanchu.limslaboratory.utils.JackSonUtil; -import com.yuanchu.limslaboratory.utils.MyUtil; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import java.util.ArrayList; @@ -45,30 +39,8 @@ return materialMapper.selectMaterialById(materialId); } - @Override - public Material ListIdMaterialInformation(String materialId) { - LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Material::getId, materialId); - wrapper.select(Material::getId, Material::getName, Material::getSupplier, Material::getLocation, Material::getNum, Material::getBatch, - Material::getReelNumber); - return materialMapper.selectOne(wrapper); - } - @Autowired private ProductService productService; - - @Override - public Integer addMaterialInformation(Material material) { - return materialMapper.insert(material); - } - - @Override - public List<Map<String, Object>> getListMaterialInformation(String specificationsId) { - LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Material::getSpecificationsId, specificationsId); - wrapper.select(Material::getId, Material::getName); - return materialMapper.selectMaps(wrapper); - } @Override public Integer deleteMaterialInformation(String materialId) { @@ -86,19 +58,10 @@ } @Override - public Integer updateMaterialInformation(Material material) { - LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(Material::getId, material.getId()); - materialMapper.updateById(material); - return materialMapper.update(material, updateWrapper); - } - - @Override public List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId) { List<String> list = new ArrayList<>(); for (Integer serialNumberId:deleteSpecificationsId){ LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Material::getSpecificationsId, serialNumberId); wrapper.select(Material::getId); List<Material> maps1 = materialMapper.selectList(wrapper); for (Material material:maps1){ 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 11ff370..45dee2f 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 @@ -31,52 +31,6 @@ private ProductMapper productMapper; @Override - public List<Product> selectProductByMaterialId(String materialId) { - return productMapper.selectProductByMaterialId(materialId); - } - - @Autowired - private UserService userService; - - @Override - public Integer addProductInformation(Product product) { - return productMapper.insert(product); - } - - @Override - public List<Map<String, Object>> getListProductInformation(String materialId) { - LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Product::getMaterialId, materialId); - wrapper.select(Product::getId, Product::getName, Product::getFather); - wrapper.groupBy(Product::getFather); - List<Map<String, Object>> products = productMapper.selectMaps(wrapper); - for (Map<String, Object> product:products){ - if (!ObjectUtils.isEmpty(product.get("father"))){ - product.remove("name"); - product.remove("id"); - LambdaQueryWrapper<Product> wrapper1 = new LambdaQueryWrapper<>(); - wrapper1.eq(Product::getFather, product.get("father")); - wrapper1.select(Product::getId, Product::getName); - List<Map<String, Object>> maps = productMapper.selectMaps(wrapper1); - product.put("sonProduct", maps); - } - } - for (Map<String, Object> product:products){ - System.out.println(product); - } - return products; - } - - @Override - public Map<String, Object> getProductInformation(Integer productId) { - Map<String, Object> productMap = productMapper.getProductInformation(productId); - String userName = userService.selectByUserId((Integer) productMap.get("user_id")); - productMap.remove("user_id"); - productMap.put("userName", userName); - return productMap; - } - - @Override public Integer deleteProductInformation(Integer productId) { LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); wrapper.eq(Product::getId, productId); @@ -88,16 +42,9 @@ public void MaterialIdDeleteProduct(List<String> deleteMaterialId) { for (String materialId : deleteMaterialId){ LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); - wrapper.eq(Product::getMaterialId, materialId); + wrapper.eq(Product::getId, materialId); wrapper.set(Product::getState, 0); productMapper.update(new Product(), wrapper); } - } - - @Override - public Integer updateMaterialInformation(Product product) { - LambdaUpdateWrapper<Product> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(Product::getId, product.getId()); - return productMapper.update(product, updateWrapper); } } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SerialNumberServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SerialNumberServiceImpl.java deleted file mode 100644 index 9448406..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SerialNumberServiceImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.yuanchu.limslaboratory.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.SerialNumber; -import com.yuanchu.limslaboratory.mapper.SerialNumberMapper; -import com.yuanchu.limslaboratory.pojo.Standards; -import com.yuanchu.limslaboratory.service.*; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yuanchu.limslaboratory.utils.MyUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.ObjectUtils; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * <p> - * 鏈嶅姟瀹炵幇绫� - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -@Service -public class SerialNumberServiceImpl extends ServiceImpl<SerialNumberMapper, SerialNumber> implements SerialNumberService { - - @Resource - private SerialNumberMapper serialNumberMapper; - - @Autowired - private UserService userService; - - @Autowired - private StandardsService standardsService; - - @Autowired - private SpecificationsService specificationsService; - - @Autowired - private MaterialService materialService; - - @Autowired - private ProductService productService; - - @Override - public Integer addSerialNumberInformation(SerialNumber serialNumber) { - Boolean userIsNull = userService.userIsNull(serialNumber.getUserId()); - if (userIsNull){ - Boolean standardsIsNull = standardsService.standardsIsNull(serialNumber.getStandardsId()); - if (!ObjectUtils.isEmpty(standardsIsNull)){ - return serialNumberMapper.insert(serialNumber); - } - } - return 0; - } - - - @Override - public IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page) { - return serialNumberMapper.listSerialNumberInformation(idOrNameOfSerialNumber, standardsId, page); - } - - @Override - public List<Map<String, Object>> selectIdSerialNumberInformation(String id) { - LambdaQueryWrapper<SerialNumber> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SerialNumber::getStandardsId, id); - wrapper.select(SerialNumber::getId,SerialNumber::getName); - return serialNumberMapper.selectMaps(wrapper); - } - - @Override - public Integer updateSerialNumberInformation(SerialNumber serialNumber) { - return serialNumberMapper.updateById(serialNumber); - } - - @Override - public List<String> StandardsIdDeleteSerialNumber(String standardsId) { - LambdaQueryWrapper<SerialNumber> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SerialNumber::getStandardsId, standardsId); - wrapper.select(SerialNumber::getId); - List<String> serialNumberId = new ArrayList<>(); - List<SerialNumber> maps = serialNumberMapper.selectList(wrapper); - for (SerialNumber map:maps){ - LambdaUpdateWrapper<SerialNumber> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(SerialNumber::getStandardsId, standardsId); - updateWrapper.set(SerialNumber::getState, 0); - serialNumberMapper.update(new SerialNumber(), updateWrapper); - serialNumberId.add(map.getId()); - } - return serialNumberId; - } - - @Override - public Integer deleteSerialNumberInformation(String serialNumberId) { - LambdaUpdateWrapper<SerialNumber> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(SerialNumber::getId, serialNumberId); - updateWrapper.set(SerialNumber::getState, 0); - List<String> list = new ArrayList<>(); - list.add(serialNumberId); - int isDeleteSuccess = serialNumberMapper.update(new SerialNumber(), updateWrapper); - if (isDeleteSuccess == 1){ - List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(list); - if (!ObjectUtils.isEmpty(deleteSpecificationsId)){ - List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId); - if (!ObjectUtils.isEmpty(deleteMaterialId)){ - productService.MaterialIdDeleteProduct(deleteMaterialId); - } - } - return 1; - } - return 0; - } -} 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 3ff92cb..0730bc4 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,13 +2,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.limslaboratory.pojo.Specifications; import com.yuanchu.limslaboratory.mapper.SpecificationsMapper; import com.yuanchu.limslaboratory.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yuanchu.limslaboratory.pojo.dto.UpdateSpeStateSpecificationsDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; @@ -16,8 +13,6 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.Objects; /** * <p> @@ -34,50 +29,10 @@ private SpecificationsMapper specificationsMapper; @Autowired - private StandardsService standardsService; - - @Autowired - private UserService userService; - - @Autowired private MaterialService materialService; @Autowired private ProductService productService; - - @Override - public Integer addSpecificationsInformation(Specifications specifications) { - Boolean userIsNull = userService.userIsNull(specifications.getUserId()); - if (userIsNull){ - Boolean standardsIsNull = standardsService.standardsIsNull(specifications.getSerialId()); - if (!ObjectUtils.isEmpty(standardsIsNull)){ - LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Specifications::getNumber, specifications.getNumber()); - Specifications specificationsNumberIsNull = specificationsMapper.selectOne(wrapper); - if (ObjectUtils.isEmpty(specificationsNumberIsNull)){ - return specificationsMapper.insert(specifications); - } - } - } - return 0; - } - - @Override - public IPage<Map<String, Objects>> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page) { - return specificationsMapper.listSpecificationsInformation(specificationsName,serialNumberId,page); - } - - @Override - public Map<String, Object> selectSNameSNName(int materialId) { - return specificationsMapper.selectSNameSNName(materialId); - } - - @Override - public Integer updateSpecificationsInformation(Specifications specifications) { - LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Specifications::getId, specifications.getId()); - return specificationsMapper.update(specifications, wrapper); - } @Override public Integer deleteSpecifications(Integer specificationsId) { @@ -102,7 +57,7 @@ List<Integer> list = new ArrayList<>(); for (String serialNumberId:deleteSerialNumberId){ LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Specifications::getSerialId, serialNumberId); + wrapper.eq(Specifications::getId, serialNumberId); wrapper.select(Specifications::getId); List<Specifications> maps1 = specificationsMapper.selectList(wrapper); for (Specifications specifications:maps1){ @@ -114,13 +69,5 @@ } } return list; - } - - @Override - public Integer updateSpeStateSpecifications(UpdateSpeStateSpecificationsDto updateSpeStateSpecificationsDto) { - LambdaUpdateWrapper<Specifications> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(Specifications::getId, updateSpeStateSpecificationsDto.getId()); - updateWrapper.set(Specifications::getSpe_state, updateSpeStateSpecificationsDto.getSpe_state()); - return specificationsMapper.update(new Specifications(), updateWrapper); } } 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 new file mode 100644 index 0000000..5aed855 --- /dev/null +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java @@ -0,0 +1,62 @@ +package com.yuanchu.limslaboratory.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.yuanchu.limslaboratory.mapper.StandardMapper; +import com.yuanchu.limslaboratory.pojo.Standard; +import com.yuanchu.limslaboratory.service.*; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; + +import javax.annotation.Resource; +import java.util.List; + +/** + * <p> + * 鏈嶅姟瀹炵幇绫� + * </p> + * + * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 + * @since 2023-07-11 + */ +@Service +public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> implements StandardService { + + @Resource + private StandardMapper standardMapper; + + @Autowired + private UserService userService; + + @Lazy + @Autowired + private SpecificationsService specificationsService; + + @Autowired + private MaterialService materialService; + + @Autowired + private ProductService productService; + + + @Override + public Integer deleteStandardsInformation(String standardsId) { + LambdaUpdateWrapper<Standard> updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(Standard::getId, standardsId); + updateWrapper.set(Standard::getState, 0); + int isDeleteSuccess = standardMapper.update(new Standard(), updateWrapper); + if (isDeleteSuccess == 1){ + List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(null); + if (!ObjectUtils.isEmpty(deleteSpecificationsId)){ + List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId); + if (!ObjectUtils.isEmpty(deleteMaterialId)){ + productService.MaterialIdDeleteProduct(deleteMaterialId); + } + } + return 1; + } + return 0; + } +} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardsServiceImpl.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardsServiceImpl.java deleted file mode 100644 index 7eb47b0..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardsServiceImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.yuanchu.limslaboratory.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.limslaboratory.pojo.Standards; -import com.yuanchu.limslaboratory.mapper.StandardsMapper; -import com.yuanchu.limslaboratory.pojo.User; -import com.yuanchu.limslaboratory.service.*; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yuanchu.limslaboratory.utils.MyUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Service; -import org.springframework.util.ObjectUtils; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * <p> - * 鏈嶅姟瀹炵幇绫� - * </p> - * - * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 - * @since 2023-07-11 - */ -@Service -public class StandardsServiceImpl extends ServiceImpl<StandardsMapper, Standards> implements StandardsService { - - @Resource - private StandardsMapper standardsMapper; - - @Autowired - private UserService userService; - - @Lazy - @Autowired - private SerialNumberService serialNumberService; - - @Lazy - @Autowired - private SpecificationsService specificationsService; - - @Autowired - private MaterialService materialService; - - @Autowired - private ProductService productService; - - @Override - public Integer addStandardsInformation(Standards standards) { - Boolean userIsNull = userService.userIsNull(standards.getUserId()); - if (userIsNull){ - return standardsMapper.insert(standards); - } - return 0; - } - - @Override - public List<Map<String, Object>> listStandardsInformation() { - LambdaQueryWrapper<Standards> wrapper = new LambdaQueryWrapper<>(); - wrapper.select(Standards::getId, Standards::getName); - List<Map<String, Object>> maps = standardsMapper.selectMaps(wrapper); - for (Map<String, Object> map : maps){ - String id = map.get("id").toString(); - List<Map<String, Object>> serialNumberList = serialNumberService.selectIdSerialNumberInformation(id); - if (ObjectUtils.isEmpty(serialNumberList)){ - map.put("serialNumber", null); - } else { - map.put("serialNumber", serialNumberList); - } - } - return maps; - } - - @Override - public Boolean standardsIsNull(String Id) { - LambdaQueryWrapper<Standards> wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Standards::getId, Id); - Standards standardsIsNull = standardsMapper.selectOne(wrapper); - return !ObjectUtils.isEmpty(standardsIsNull); - } - - @Override - public IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards) { - return standardsMapper.listPageStandardsInformation(page, idOrNameOfStandards); - } - - @Override - public Integer updateStandardsInformation(Standards standards) { - return standardsMapper.updateById(standards); - } - - @Override - public Integer deleteStandardsInformation(String standardsId) { - LambdaUpdateWrapper<Standards> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(Standards::getId, standardsId); - updateWrapper.set(Standards::getState, 0); - int isDeleteSuccess = standardsMapper.update(new Standards(), updateWrapper); - if (isDeleteSuccess == 1){ - List<String> deleteSerialNumberId = serialNumberService.StandardsIdDeleteSerialNumber(standardsId); - if (!ObjectUtils.isEmpty(deleteSerialNumberId)){ - List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(deleteSerialNumberId); - if (!ObjectUtils.isEmpty(deleteSpecificationsId)){ - List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId); - if (!ObjectUtils.isEmpty(deleteMaterialId)){ - productService.MaterialIdDeleteProduct(deleteMaterialId); - } - } - } - 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 a14fe8e..e2cb725 100644 --- a/standard-server/src/main/resources/mapper/MaterialMapper.xml +++ b/standard-server/src/main/resources/mapper/MaterialMapper.xml @@ -7,7 +7,7 @@ from material where state = 1 order by create_time desc - limit #{num1},#{num2} + limit #{num1},#{num2} </select> <select id="selectMaterialById" resultType="java.util.Map"> select m.id, diff --git a/standard-server/src/main/resources/mapper/ProductMapper.xml b/standard-server/src/main/resources/mapper/ProductMapper.xml index ff7ffbb..4868b93 100644 --- a/standard-server/src/main/resources/mapper/ProductMapper.xml +++ b/standard-server/src/main/resources/mapper/ProductMapper.xml @@ -1,17 +1,5 @@ <?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="selectProductByMaterialId" resultType="Product"> - select id, name, method, father, unit, required, internal - from product - where material_id = #{material_id} - and state = 1 - </select> - <select id="getProductInformation" parameterType="integer" resultType="map"> - SELECT p.method, ifnull(null, p.father) projectClassification, p.user_id, date_format(p.update_time, '%Y-%m-%d %H:%i:%s') updateTime, - p.unit, p.required, p.internal - FROM product p - where p.id = #{productId} - </select> </mapper> diff --git a/standard-server/src/main/resources/mapper/SerialNumberMapper.xml b/standard-server/src/main/resources/mapper/SerialNumberMapper.xml deleted file mode 100644 index b64df13..0000000 --- a/standard-server/src/main/resources/mapper/SerialNumberMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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.SerialNumberMapper"> - - <select id="listSerialNumberInformation" resultType="map"> - SELECT s.`id`, s.`name` - FROM serial_number s - WHERE s.`standards_id` = #{standardsId} - <if test="idOrNameOfSerialNumber != null"> - OR s.`name` LIKE concat('%',#{idOrNameOfSerialNumber},'%') - OR s.`id` LIKE concat('%',#{idOrNameOfSerialNumber},'%') - </if> - </select> -</mapper> diff --git a/standard-server/src/main/resources/mapper/SpecificationsMapper.xml b/standard-server/src/main/resources/mapper/SpecificationsMapper.xml index 0d0c394..4daa5c5 100644 --- a/standard-server/src/main/resources/mapper/SpecificationsMapper.xml +++ b/standard-server/src/main/resources/mapper/SpecificationsMapper.xml @@ -2,23 +2,4 @@ <!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"> - <select id="listSpecificationsInformation" resultType="map"> - SELECT s.`id`,s.`name`,DATE_FORMAT(s.`update_time`, '%Y-%m-%d %H:%i') updateTime,u.`name` username,s.`vel`,s.`spe_state` - FROM specifications s,`user` u - WHERE s.`user_id` = u.`id` - AND s.`serial_id` = #{serialNumberId} - <if test="specificationsName != null"> - AND s.`name` = #{specificationsName} - </if> - </select> - - <select id="selectSNameSNName" resultType="Map"> - select m.num,m.supplier,m.name m_name,m.location,m.batch,m.reel_number,concat(s.name,'/',sn.name) ss_name,s.voltage_level,s.cross_section,s.number_of_cores,s.instruct - from material m,specifications s,serial_number sn - where m.specifications_id = s.id - and s.serial_id = sn.id - and m.id = #{materialId} - order by s.create_time desc - limit 1 - </select> </mapper> diff --git a/standard-server/src/main/resources/mapper/StandardMapper.xml b/standard-server/src/main/resources/mapper/StandardMapper.xml new file mode 100644 index 0000000..0e0f8ce --- /dev/null +++ b/standard-server/src/main/resources/mapper/StandardMapper.xml @@ -0,0 +1,5 @@ +<?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.StandardMapper"> + +</mapper> diff --git a/standard-server/src/main/resources/mapper/StandardsMapper.xml b/standard-server/src/main/resources/mapper/StandardsMapper.xml deleted file mode 100644 index 07d18b5..0000000 --- a/standard-server/src/main/resources/mapper/StandardsMapper.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?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.StandardsMapper"> - - <select id="listPageStandardsInformation" resultType="Map"> - SELECT s.`id`, s.`name`, s.`eng_name`, DATE_FORMAT(s.`create_time`, '%Y-%m-%d %H:%i') createTime - FROM standards s - <if test="idOrNameOfStandards != null"> - WHERE s.`id` LIKE concat('%',#{idOrNameOfStandards},'%') - OR s.name LIKE concat('%',#{idOrNameOfStandards},'%') - </if> - </select> -</mapper> -- Gitblit v1.9.3