From 2d44844cafa096bd42391b8d2c2185f0bfbf2d79 Mon Sep 17 00:00:00 2001 From: XiaoRuby <3114200645@qq.com> Date: 星期三, 19 七月 2023 11:13:17 +0800 Subject: [PATCH] LIMS管理系统框架-开发7-19-v1.0.0 --- standard-server/src/main/resources/mapper/SpecificationsMapper.xml | 15 user-server/src/main/java/com/yuanchu/limslaboratory/clients/UserClient.java | 2 sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java | 11 standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java | 67 ++++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java | 40 ++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java | 11 standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Material.java | 17 standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java | 14 standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java | 32 ++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java | 58 ++++ standard-server/src/main/resources/mapper/StandardsMapper.xml | 4 user-server/src/main/java/com/yuanchu/limslaboratory/service/UserService.java | 35 ++ standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardsMapper.java | 4 standard-server/src/main/resources/mapper/ProductMapper.xml | 6 standard-server/src/main/java/com/yuanchu/limslaboratory/vo/UpdateSpecificationsInformation.java | 42 +++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java | 6 standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java | 23 + standard-server/src/main/resources/mapper/SerialNumberMapper.xml | 9 sys/src/main/resources/application-dev.yml | 4 standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardsServiceImpl.java | 29 ++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java | 75 +++++ /dev/null | 27 -- standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java | 3 standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java | 4 standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Specifications.java | 3 standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/Product.java | 19 standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SerialNumberServiceImpl.java | 16 standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java | 32 ++ user-server/src/main/java/com/yuanchu/limslaboratory/service/impl/UserServiceImpl.java | 9 standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java | 61 ++++ standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java | 13 + standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java | 42 ++ standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SerialNumberMapper.java | 3 33 files changed, 627 insertions(+), 109 deletions(-) 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 73bde91..4eb8a23 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 @@ -1,9 +1,20 @@ package com.yuanchu.limslaboratory.controller; -import org.springframework.web.bind.annotation.RequestMapping; +import com.yuanchu.limslaboratory.pojo.Material; +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; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.RestController; +import java.util.List; +import java.util.Map; /** * <p> @@ -13,8 +24,54 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-17 */ +@Api(tags = "鏍囧噯搴�-->瑙勬牸-->鏌ョ湅-->鐖�->鐗╂枡") @RestController @RequestMapping("/material") public class MaterialController { + @Autowired + private MaterialService materialService; + + @ApiOperation("鐗╂枡搴�-->娣诲姞鐗╂枡") + @PostMapping("/add") + public Result<?> addMaterialInformation(@RequestBody Material material) { + Integer isMaterialSuccess = materialService.addMaterialInformation(material); + 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鍒犻櫎鐗╂枡") + @DeleteMapping("/delete") + @ApiImplicitParams(value = { + @ApiImplicitParam(value = "鐗╂枡ID", name = "materialId", dataTypeClass = String.class) + }) + public Result<?> deleteMaterialInformation(Integer materialId) { + Integer isDeleteMaterialSuccess = materialService.deleteMaterialInformation(materialId); + if (isDeleteMaterialSuccess == 1) { + return Result.success("鍒犻櫎鎴愬姛锛�"); + } + return Result.fail("鍒犻櫎澶辫触锛�"); + } + + @ApiOperation("鐗╂枡搴�-->淇敼鐗╂枡") + @PutMapping("/update") + public Result<?> updateMaterialInformation(@RequestBody Material material) { + 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 abe2d9d..62c8682 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 @@ -1,15 +1,16 @@ package com.yuanchu.limslaboratory.controller; - -import com.yuanchu.limslaboratory.pojo.SerialNumber; +import com.yuanchu.limslaboratory.pojo.Product; import com.yuanchu.limslaboratory.service.ProductService; import com.yuanchu.limslaboratory.utils.JackSonUtil; import com.yuanchu.limslaboratory.utils.RedisUtil; import com.yuanchu.limslaboratory.vo.Result; -import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; /** @@ -20,6 +21,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-17 */ +@Api(tags = "鏍囧噯搴�-->瑙勬牸-->鏌ョ湅-->鐖�-->瀛�") @RestController @RequestMapping("/product") public class ProductController { @@ -27,4 +29,63 @@ @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(Integer materialId) { + List<Map<String, Object>> listMaterialInformation = productService.getListProductInformation(materialId); + return Result.success(listMaterialInformation); + } + + @ApiOperation("鐗╂枡搴�-->鏍规嵁娴嬭瘯鏍囧噯ID鏌ヨ鍩烘湰淇℃伅") + @GetMapping("/delete") + @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") + @ApiImplicitParams(value = { + @ApiImplicitParam(value = "娴嬭瘯鏍囧噯ID", name = "productId", dataTypeClass = String.class) + }) + public Result<?> deleteProductInformation(Integer productId) { + Integer isDeleteProduct = productService.deleteProductInformation(productId); + if (isDeleteProduct == 1) { + return Result.success("鍒犻櫎鎴愬姛锛�"); + } + return Result.fail("鍒犻櫎澶辫触锛�"); + } + +// @ApiOperation("鐗╂枡搴�-->淇敼鐗╂枡") +// @PutMapping("/update") +// public Result<?> updateMaterialInformation(@RequestBody Material material) { +// 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/SerialNumberController.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java index fc8f537..96d1770 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java @@ -1,9 +1,12 @@ 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; @@ -13,6 +16,7 @@ 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; @@ -24,7 +28,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-11 */ -@Api(tags = "鏍囧噯搴�-->鍨嬪彿鎿嶄綔") +@Api(tags = "鏍囧噯搴�-->鍨嬪彿") @RestController @RequestMapping("/serial-number") public class SerialNumberController { @@ -45,14 +49,19 @@ return Result.fail("娣诲姞銆�"+ serialNumber.getName() +"銆戝け璐ワ紒"); } - @ApiOperation("鏍囧噯搴�-->鐐瑰嚮渚ц竟鏍忔爣鍑嗭紝鏌ヨ鎵�鏈夊瀷鍙�") + @ApiOperation("鏍囧噯搴�-->鐐瑰嚮渚ц竟鏍忔爣鍑嗭紝鍒嗛〉鏌ヨ鎵�鏈夊瀷鍙�") @ApiImplicitParams(value = { - @ApiImplicitParam(value = "鏍囧噯鍙�/鏍囧噯鍚嶇О", name = "IdOrNameOfSerialNumber", dataTypeClass = String.class), - @ApiImplicitParam(value = "鏍囧噯鍙稩d", name = "standardsId", dataTypeClass = String.class, required = true) + @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){ - List<Map<String, Object>> selectStandards= serialNumberService.listSerialNumberInformation(IdOrNameOfSerialNumber,standardsId); - return Result.success(selectStandards); + 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); } } 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 1a9c8a1..db9cd47 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 @@ -4,22 +4,20 @@ 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.pojo.Standards; import com.yuanchu.limslaboratory.service.SpecificationsService; import com.yuanchu.limslaboratory.utils.JackSonUtil; -import com.yuanchu.limslaboratory.utils.MyUtil; import com.yuanchu.limslaboratory.utils.RedisUtil; -import com.yuanchu.limslaboratory.vo.ListSpecificationsInformation; import com.yuanchu.limslaboratory.vo.Result; +import com.yuanchu.limslaboratory.vo.UpdateSpecificationsInformation; 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; @@ -31,7 +29,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-11 */ -@Api(tags = "鏍囧噯搴�-->鍨嬪彿-->浜у搧瑙勬牸鎿嶄綔") +@Api(tags = "鏍囧噯搴�-->鍨嬪彿-->浜у搧瑙勬牸") @RestController @RequestMapping("/specifications") public class SpecificationsController { @@ -57,17 +55,47 @@ @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), + @ApiImplicitParam(name = "serialNumberId", value = "鍨嬪彿ID", dataTypeClass = String.class,required = true) }) @GetMapping("/list") public Result<?> listSpecificationsInformation(Integer pageNo, Integer pageSize, String specificationsName, String serialNumberId){ - IPage<ListSpecificationsInformation> pageList= specificationsService.listSpecificationsInformation(specificationsName,serialNumberId,new Page<Objects>(pageNo, pageSize)); + 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 UpdateSpecificationsInformation updateSpecificationsInformation) 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); + updateSpecificationsInformation.setUserId((Integer) unmarshal.get("id")); + Specifications specifications = JackSonUtil.unmarshal(JackSonUtil.marshal(updateSpecificationsInformation), Specifications.class); + Integer isStandardsSuccess = specificationsService.updateSpecificationsInformation(specifications); + if (isStandardsSuccess == 1) { + return Result.success("鏇存柊銆�"+ specifications.getName() +"銆戞垚鍔燂紒"); + } + return Result.fail("鏇存柊銆�"+ specifications.getName() +"銆戝け璐ワ紒"); + } + + @ApiOperation("鏍囧噯搴�-->浜у搧瑙勬牸-->鍒犻櫎") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "specificationsId", value = "瑙勬牸Id", dataTypeClass = String.class, required = true) + }) + @DeleteMapping("/delete") + public Result<?> deleteSpecificationsInformation(String specificationsId) { + Integer isStandardsSuccess = specificationsService.deleteSpecifications(specificationsId); + if (isStandardsSuccess == 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 index c7fdf0d..efc64de 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java @@ -2,6 +2,8 @@ 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; @@ -13,10 +15,13 @@ 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> @@ -26,7 +31,7 @@ * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃 * @since 2023-07-11 */ -@Api(tags = "鏍囧噯搴撴搷浣�") +@Api(tags = "鏍囧噯搴�-->猸愨瓙猸�") @RestController @RequestMapping("/standards") public class StandardsController { @@ -38,6 +43,9 @@ @PostMapping("/add") public Result<?> addStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) 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); standards.setUserId((Integer) unmarshal.get("id")); Integer isStandardsSuccess = standardsService.addStandardsInformation(standards); @@ -47,13 +55,25 @@ return Result.fail("娣诲姞銆�"+ standards.getName() +"銆戝け璐ワ紒"); } - @ApiOperation("鏍囧噯搴�-->鐐瑰嚮鍏ㄩ儴锛氭煡璇㈡墍鏈夋爣鍑嗘暟鎹�") + @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") - public Result<?> listStandardsInformation(String IdOrNameOfStandards){ - List<Map<String, Object>> list = standardsService.listStandardsInformation(IdOrNameOfStandards); - return Result.success(list); + @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); } } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java index 57ca6ee..c97499e 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/ProductMapper.java @@ -3,6 +3,8 @@ import com.yuanchu.limslaboratory.pojo.Product; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.Map; + /** * <p> * Mapper 鎺ュ彛 @@ -13,4 +15,5 @@ */ public interface ProductMapper extends BaseMapper<Product> { + Map<String, Object> getProductInformation(Integer productId); } 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 index 466b13d..3e18ceb 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SerialNumberMapper.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SerialNumberMapper.java @@ -1,5 +1,7 @@ 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; @@ -16,4 +18,5 @@ */ 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/SpecificationsMapper.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java index 38b90bd..f68f302 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/SpecificationsMapper.java @@ -1,11 +1,9 @@ package com.yuanchu.limslaboratory.mapper; -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.Specifications; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yuanchu.limslaboratory.vo.ListSpecificationsInformation; import java.util.Map; import java.util.Objects; @@ -20,5 +18,5 @@ */ public interface SpecificationsMapper extends BaseMapper<Specifications> { - IPage<ListSpecificationsInformation> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page); + IPage<Map<String, Objects>> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> 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/StandardsMapper.java index 5155826..6dcc176 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardsMapper.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/StandardsMapper.java @@ -1,5 +1,7 @@ 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.Standards; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -16,5 +18,5 @@ */ public interface StandardsMapper extends BaseMapper<Standards> { - List<Map<String, Object>> listStandardsInformation(String idOrNameOfStandards); + 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 7641c02..6044690 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 @@ -28,25 +28,25 @@ private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "鐗╂枡id") + @ApiModelProperty(value = "鐗╂枡id", example = "152453211563212", required = true) private String id; - @ApiModelProperty(value = "鐗╂枡鍚嶇О") + @ApiModelProperty(value = "鐗╂枡鍚嶇О", example = "鐭冲ご", required = true) private String name; - @ApiModelProperty(value = "渚涘簲鍟�") + @ApiModelProperty(value = "渚涘簲鍟�", example = "鐧惧害", required = true) private String supplier; - @ApiModelProperty(value = "鐗╂枡瀛樻斁鍦�") + @ApiModelProperty(value = "鐗╂枡瀛樻斁鍦�", example = "浠撳簱涓�锛屼簩鍙锋灦", required = true) private String location; - @ApiModelProperty(value = "鐗╂枡鏁伴噺") + @ApiModelProperty(value = "鐗╂枡鏁伴噺", example = "200", required = true) private Integer num; - @ApiModelProperty(value = "鎵规") + @ApiModelProperty(value = "鎵规", example = "1", required = true) private String batch; - @ApiModelProperty(value = "鐩樺彿") + @ApiModelProperty(value = "鐩樺彿", example = "152453211563212", required = true) private String reelNumber; @TableLogic(value = "1", delval = "0") @@ -63,9 +63,10 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; + @ApiModelProperty(value = "涔愯閿�", hidden = true) private Integer version; - @ApiModelProperty(value = "鍏宠仈 瑙勬牸id") + @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 be8b55b..fcf0006 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 @@ -27,26 +27,26 @@ private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "椤圭洰id") + @ApiModelProperty(value = "娴嬭瘯鏍囧噯id", hidden = true) @TableId(value = "id", type = IdType.AUTO) private Integer id; - @ApiModelProperty(value = "椤圭洰鍚嶇О") + @ApiModelProperty(value = "娴嬭瘯鏍囧噯鍚嶇О", example = "鍗曚綅闀垮害璐ㄩ噺", required = true) private String name; - @ApiModelProperty(value = "璇曢獙鏂规硶") + @ApiModelProperty(value = "璇曢獙鏂规硶", example = "--", required = true) private String method; - @ApiModelProperty(value = "椤圭洰鐖剁被") + @ApiModelProperty(value = "娴嬭瘯鏍囧噯鐖剁被", example = "閾濆寘閽㈣姱閾濈粸绾�") private String father; - @ApiModelProperty(value = "鍗曚綅") + @ApiModelProperty(value = "鍗曚綅", example = "km", required = true) private String unit; - @ApiModelProperty(value = "鎷涙爣浜鸿姹傚��") + @ApiModelProperty(value = "鎷涙爣浜鸿姹傚��", example = "<=0.3458", required = true) private String required; - @ApiModelProperty(value = "鍐呮帶鍊�") + @ApiModelProperty(value = "鍐呮帶鍊�", example = "<=0.3458", required = true) private String internal; @TableLogic(value = "1", delval = "0") @@ -63,12 +63,13 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; + @ApiModelProperty(value = "涔愯閿�", hidden = true) private Integer version; - @ApiModelProperty(value = "鍏宠仈 鐢ㄦ埛id") + @ApiModelProperty(value = "鍏宠仈 鐢ㄦ埛id", hidden = true) private Integer userId; - @ApiModelProperty(value = "鍏宠仈 鐗╂枡id") + @ApiModelProperty(value = "鍏宠仈 鐗╂枡id", example = "152453211563212", required = true) private String materialId; 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 56d0026..5cab1a0 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,7 +32,7 @@ @TableId(value = "id", type = IdType.AUTO) private Integer id; - @ApiModelProperty(value = "瑙勬牸id", example = "modelId", required = true) + @ApiModelProperty(value = "瑙勬牸缂栧彿", example = "modelId", required = true) private String number; @ApiModelProperty(value = "浜у搧瑙勬牸鍚嶇О", example = "AB", required = true) @@ -54,6 +54,7 @@ private Integer spe_state; @ApiModelProperty(value = "閫昏緫鍒犻櫎 姝e父>=1,鍒犻櫎<=0", hidden = true) + @TableLogic(value = "1", delval = "0") private Integer state; @TableField(fill = FieldFill.INSERT) 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 572c272..e8b6dc5 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 @@ -3,6 +3,9 @@ import com.yuanchu.limslaboratory.pojo.Material; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; +import java.util.Map; + /** * <p> * 鏈嶅姟绫� @@ -13,4 +16,33 @@ */ public interface MaterialService extends IService<Material> { + Integer addMaterialInformation(Material material); + + /** + * 渚ц竟鏍忕墿鏂欐暟鎹� + * @param specificationsId + * @return + */ + List<Map<String, Object>> getListMaterialInformation(String specificationsId); + + /** + * 鍒犻櫎绛変簬MaterialId鐨勬暟鎹� + * @param materialId + * @return + */ + Integer deleteMaterialInformation(Integer materialId); + + /** + * 鏇存柊Material鐨勬暟鎹� + * @param material + * @return + */ + Integer updateMaterialInformation(Material material); + + /** + * 鍒犻櫎绛変簬SpecificationId鐨勬暟鎹� + * @param specificationsId + * @return + */ + List<String> deleteMaterialEqSpecification(String specificationsId); } 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 0fc62ef..aed3611 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 @@ -2,6 +2,10 @@ import com.yuanchu.limslaboratory.pojo.Product; import com.baomidou.mybatisplus.extension.service.IService; +import io.swagger.models.auth.In; + +import java.util.List; +import java.util.Map; /** * <p> @@ -13,4 +17,13 @@ */ public interface ProductService extends IService<Product> { + Integer addProductInformation(Product product); + + List<Map<String, Object>> getListProductInformation(Integer materialId); + + Map<String, Object> getProductInformation(Integer productId); + + Integer deleteProductInformation(Integer productId); + + void deleteProductEqMaterialId(List<String> materialListId); } 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 index 94f4955..8b34b30 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java @@ -1,5 +1,7 @@ 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; @@ -23,5 +25,12 @@ */ Integer addSerialNumberInformation(SerialNumber serialNumber); - List<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId); + IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page); + + /** + * 鏍规嵁鏍囧噯Id鏌ヨ鎵�鏈夊瀷鍙� + * @param id + * @return + */ + List<Map<String, Object>> selectIdSerialNumberInformation(String id); } 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 8991ba5..b66b142 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 @@ -4,7 +4,7 @@ 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.vo.ListSpecificationsInformation; +import org.springframework.transaction.annotation.Transactional; import java.util.Map; import java.util.Objects; @@ -21,5 +21,15 @@ Integer addSpecificationsInformation(Specifications specifications); - IPage<ListSpecificationsInformation> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page); + IPage<Map<String, Objects>> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page); + + Integer updateSpecificationsInformation(Specifications specifications); + + /** + * 澶氳〃鍒犻櫎锛岃〃鏍煎垎鍒湁锛歋pecification --> Material --> Product + * @param specificationsId + * @return + */ + @Transactional(rollbackFor = Exception.class) + Integer deleteSpecifications(String specificationsId); } 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 index 0225c87..d22fcda 100644 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java @@ -1,5 +1,7 @@ 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; @@ -18,10 +20,12 @@ Integer addStandardsInformation(Standards standards); - List<Map<String, Object>> listStandardsInformation(String IdOrNameOfStandards); + List<Map<String, Object>> listStandardsInformation(); /** * 鏍规嵁Id鏌ヨ鏄惁瀛樺湪璇ユ爣鍑� */ Boolean standardsIsNull(String Id); + + IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards); } 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 9279599..0a4c757 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 @@ -1,10 +1,19 @@ package com.yuanchu.limslaboratory.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.yuanchu.limslaboratory.pojo.Material; import com.yuanchu.limslaboratory.mapper.MaterialMapper; import com.yuanchu.limslaboratory.service.MaterialService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yuanchu.limslaboratory.utils.MyUtil; 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> @@ -17,4 +26,53 @@ @Service public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService { + @Resource + private MaterialMapper materialMapper; + + @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(Integer materialId) { + LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Material::getId, materialId); + return materialMapper.delete(wrapper); + } + + @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> deleteMaterialEqSpecification(String specificationsId) { + LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Material::getSpecificationsId, specificationsId); + wrapper.select(Material::getId); + List<Material> materials = materialMapper.selectList(wrapper); + if (!ObjectUtils.isEmpty(materials)){ + List<String> list = new ArrayList<>(); + for (Material material:materials){ + list.add(material.getId()); + } + int isDeleteList = materialMapper.deleteBatchIds(list); + if (isDeleteList != 0) { + return list; + } + } + return null; + } } 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 8079756..59dcc91 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 @@ -1,10 +1,20 @@ package com.yuanchu.limslaboratory.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.yuanchu.limslaboratory.pojo.Product; import com.yuanchu.limslaboratory.mapper.ProductMapper; import com.yuanchu.limslaboratory.service.ProductService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yuanchu.limslaboratory.service.UserService; +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> @@ -17,4 +27,69 @@ @Service public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService { + @Resource + private ProductMapper productMapper; + + @Autowired + private UserService userService; + + @Override + public Integer addProductInformation(Product product) { + return productMapper.insert(product); + } + + @Override + public List<Map<String, Object>> getListProductInformation(Integer 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) { + LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Product::getId, productId); + return productMapper.delete(wrapper); + } + + @Override + public void deleteProductEqMaterialId(List<String> materialListId) { + for (String materialId : materialListId){ + LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Product::getMaterialId, materialId); + wrapper.select(Product::getId); + List<Product> products = productMapper.selectList(wrapper); + List<Integer> productDeleteId = new ArrayList<>(); + for (Product product : products){ + productDeleteId.add(product.getId()); + } + productMapper.deleteBatchIds(productDeleteId); + } + } } 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 index 2c00278..d52c1b7 100644 --- 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 @@ -1,12 +1,15 @@ package com.yuanchu.limslaboratory.service.impl; 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.SerialNumber; import com.yuanchu.limslaboratory.mapper.SerialNumberMapper; import com.yuanchu.limslaboratory.service.SerialNumberService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.limslaboratory.service.StandardsService; import com.yuanchu.limslaboratory.service.UserService; +import com.yuanchu.limslaboratory.utils.MyUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; @@ -50,12 +53,15 @@ @Override - public List<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId) { + 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, standardsId); - wrapper.like(SerialNumber::getId, idOrNameOfSerialNumber); - wrapper.or().like(SerialNumber::getName, idOrNameOfSerialNumber); - wrapper.select(SerialNumber::getId, SerialNumber::getName); + wrapper.eq(SerialNumber::getStandardsId, id); + wrapper.select(SerialNumber::getId,SerialNumber::getName); return serialNumberMapper.selectMaps(wrapper); } } 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 099e61e..766270e 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 @@ -5,16 +5,15 @@ 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.SpecificationsService; +import com.yuanchu.limslaboratory.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yuanchu.limslaboratory.service.StandardsService; -import com.yuanchu.limslaboratory.service.UserService; -import com.yuanchu.limslaboratory.vo.ListSpecificationsInformation; +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.List; import java.util.Map; import java.util.Objects; @@ -38,6 +37,12 @@ @Autowired private UserService userService; + @Autowired + private MaterialService materialService; + + @Autowired + private ProductService productService; + @Override public Integer addSpecificationsInformation(Specifications specifications) { Boolean userIsNull = userService.userIsNull(specifications.getUserId()); @@ -56,7 +61,32 @@ } @Override - public IPage<ListSpecificationsInformation> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page) { + public IPage<Map<String, Objects>> listSpecificationsInformation(String specificationsName, String serialNumberId, Page<Objects> page) { return specificationsMapper.listSpecificationsInformation(specificationsName,serialNumberId,page); } + + @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(String specificationsId) { + LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Specifications::getId, specificationsId); + // 鍒犻櫎Specifications涓殑鏁版嵁 + int delete = specificationsMapper.delete(wrapper); + if (delete == 1){ + // 鍒犻櫎绛変簬SpecificationsId鐨凪aterial琛ㄦ牸涓殑鏁版嵁锛屽苟涓旇幏鍙栬鏁版嵁鐨処d锛岀敤浜庡垹闄roduct琛ㄦ牸涓殑鏁版嵁 + List<String> materialListId = materialService.deleteMaterialEqSpecification(specificationsId); + if (!ObjectUtils.isEmpty(materialListId)){ + // 鏍规嵁Material琛ㄨ繑鍥炵殑鍒楄〃Id锛屽垹闄roduct琛ㄤ腑鎵�鏈塎aterialId绛変簬璇ュ垪琛ㄤ腑鐨勬墍鏈夋暟鎹紝鏃犺繑鍥炲�� + productService.deleteProductEqMaterialId(materialListId); + } + 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 index d82050d..13cf3f8 100644 --- 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 @@ -1,14 +1,18 @@ package com.yuanchu.limslaboratory.service.impl; 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.mapper.StandardsMapper; import com.yuanchu.limslaboratory.pojo.User; +import com.yuanchu.limslaboratory.service.SerialNumberService; import com.yuanchu.limslaboratory.service.StandardsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.limslaboratory.service.UserService; 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; @@ -33,6 +37,10 @@ @Autowired private UserService userService; + @Lazy + @Autowired + private SerialNumberService serialNumberService; + @Override public Integer addStandardsInformation(Standards standards) { Boolean userIsNull = userService.userIsNull(standards.getUserId()); @@ -43,8 +51,20 @@ } @Override - public List<Map<String, Object>> listStandardsInformation(String IdOrNameOfStandards) { - return standardsMapper.listStandardsInformation(IdOrNameOfStandards); + 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 @@ -54,4 +74,9 @@ 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); + } } diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/vo/ListSpecificationsInformation.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/vo/ListSpecificationsInformation.java deleted file mode 100644 index c3e13de..0000000 --- a/standard-server/src/main/java/com/yuanchu/limslaboratory/vo/ListSpecificationsInformation.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.yuanchu.limslaboratory.vo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -@Data -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="ListSpecificationsInformation瀵硅薄", description="鐢ㄤ簬鍒嗛〉鏄剧ず瑙勬牸鏁版嵁") -public class ListSpecificationsInformation { - - private Integer id; - - private String name; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date updateTime; - - private String username; - - private String vel; - - private Integer spe_state; -} diff --git a/standard-server/src/main/java/com/yuanchu/limslaboratory/vo/UpdateSpecificationsInformation.java b/standard-server/src/main/java/com/yuanchu/limslaboratory/vo/UpdateSpecificationsInformation.java new file mode 100644 index 0000000..db45b73 --- /dev/null +++ b/standard-server/src/main/java/com/yuanchu/limslaboratory/vo/UpdateSpecificationsInformation.java @@ -0,0 +1,42 @@ +package com.yuanchu.limslaboratory.vo; + +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 UpdateSpecificationsInformation { + + @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/resources/mapper/ProductMapper.xml b/standard-server/src/main/resources/mapper/ProductMapper.xml index 4868b93..960436d 100644 --- a/standard-server/src/main/resources/mapper/ProductMapper.xml +++ b/standard-server/src/main/resources/mapper/ProductMapper.xml @@ -2,4 +2,10 @@ <!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="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 index f9f96e2..b64df13 100644 --- a/standard-server/src/main/resources/mapper/SerialNumberMapper.xml +++ b/standard-server/src/main/resources/mapper/SerialNumberMapper.xml @@ -2,4 +2,13 @@ <!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 f5a4457..bd4b25d 100644 --- a/standard-server/src/main/resources/mapper/SpecificationsMapper.xml +++ b/standard-server/src/main/resources/mapper/SpecificationsMapper.xml @@ -2,20 +2,11 @@ <!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"> - <resultMap id="listSpecificationsInformationMap" type="com.yuanchu.limslaboratory.vo.ListSpecificationsInformation"> - <result property="id" column="id"/> - <result property="name" column="name"/> - <result property="updateTime" column="update_time"/> - <result property="username" column="username"/> - <result property="vel" column="vel"/> - <result property="spe_state" column="spe_state"/> - </resultMap> - - <select id="listSpecificationsInformation" resultMap="listSpecificationsInformationMap"> - SELECT s.`id`,s.`name`,s.`update_time`,u.`name` username,s.`vel`,s.`spe_state` + <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.`number` = #{serialNumberId} + AND s.`serial_id` = #{serialNumberId} <if test="specificationsName != null"> AND s.`name` = #{specificationsName} </if> diff --git a/standard-server/src/main/resources/mapper/StandardsMapper.xml b/standard-server/src/main/resources/mapper/StandardsMapper.xml index 35264ea..07d18b5 100644 --- a/standard-server/src/main/resources/mapper/StandardsMapper.xml +++ b/standard-server/src/main/resources/mapper/StandardsMapper.xml @@ -2,12 +2,12 @@ <!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="listStandardsInformation" resultType="Map"> + <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},'%') + OR s.name LIKE concat('%',#{idOrNameOfStandards},'%') </if> </select> </mapper> diff --git a/sys/src/main/resources/application-dev.yml b/sys/src/main/resources/application-dev.yml index af6697f..c8ae754 100644 --- a/sys/src/main/resources/application-dev.yml +++ b/sys/src/main/resources/application-dev.yml @@ -27,7 +27,7 @@ # 榈烽洀缃戠粶IP鎴栬�呭煙鍚� customer: - url: http://127.0.0.1:6789 + url: http://114.132.189.42:8011 mybatis-plus: configuration: @@ -69,7 +69,7 @@ # redis璁块棶瀵嗙爜锛堥粯璁や负绌猴級 password: null # redis杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶆绉掞級 - timeout: 0 + timeout: 5000 # redis杩炴帴姹犻厤缃� pool: # 鏈�澶у彲鐢ㄨ繛鎺ユ暟锛堥粯璁や负8锛岃礋鏁拌〃绀烘棤闄愶級 diff --git a/sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java b/sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java index 901a1a4..ee78f6d 100644 --- a/sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java +++ b/sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java @@ -1,17 +1,26 @@ package com.yuanchu.limslaboratory; +import com.yuanchu.limslaboratory.service.SerialNumberService; +import com.yuanchu.limslaboratory.utils.MyUtil; import com.yuanchu.limslaboratory.utils.RedisUtil; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.text.NumberFormat; +import java.util.List; +import java.util.Map; @SpringBootTest class SysApplicationTests { + @Autowired + private SerialNumberService serialNumberService; + @Test void contextLoads() { - + List<Map<String, Object>> maps = serialNumberService.listSerialNumberInformation(null, "230711000002"); + MyUtil.PrintLog(maps.toString()); } } diff --git a/user-server/src/main/java/com/yuanchu/limslaboratory/clients/UserClient.java b/user-server/src/main/java/com/yuanchu/limslaboratory/clients/UserClient.java index da0c9fa..8a3df54 100644 --- a/user-server/src/main/java/com/yuanchu/limslaboratory/clients/UserClient.java +++ b/user-server/src/main/java/com/yuanchu/limslaboratory/clients/UserClient.java @@ -8,7 +8,7 @@ import java.util.Map; -@FeignClient(value = "userservice", url = "localhost:6789") +@FeignClient(value = "userservice", url = "${customer.url}") public interface UserClient { @PostMapping("/business/login") diff --git a/user-server/src/main/java/com/yuanchu/limslaboratory/service/UserService.java b/user-server/src/main/java/com/yuanchu/limslaboratory/service/UserService.java index fee7cd5..8f57ac8 100644 --- a/user-server/src/main/java/com/yuanchu/limslaboratory/service/UserService.java +++ b/user-server/src/main/java/com/yuanchu/limslaboratory/service/UserService.java @@ -23,21 +23,54 @@ * @since 2023-07-07 */ public interface UserService extends IService<User> { -// 閫氳繃鐢ㄦ埛id鑾峰彇鐢ㄦ埛淇℃伅 + /** + * 閫氳繃鐢ㄦ埛id鑾峰彇鐢ㄦ埛淇℃伅 + * @param userId + * @return + */ Map<String, String> selectUserByUserId(int userId); User AccordingUsernameSelectAll(String account); + /** + * 娣诲姞鐢ㄦ埛 + * @param newPersonnelVo + * @param enterpriseId + * @return + */ Integer addNewPersonnel(NewPersonnelVo newPersonnelVo, String enterpriseId); + /** + * 鏇存柊鐢ㄦ埛鍩烘湰淇℃伅 + * @param updatePersonnelVo + * @return + */ Integer updateNewPersonnel(UpdatePersonnelVo updatePersonnelVo); + /** + * 鍒嗛〉鏌ヨ鎵�鏈夌敤鎴蜂俊鎭� + * @param name + * @param page + * @return + */ IPage<PagePersonnelVo> getNewPersonnelPage(String name, Page page); + /** + * 鐧诲綍鑾峰彇鐢ㄦ埛鍩烘湰淇℃伅涓庣郴缁熻秴鏃舵椂闂存彁閱� + * @param token + * @return + */ Map<String, Object> getUserInfo(String token); /** * 鏍规嵁Id鏌ヨ鏄惁瀛樺湪璇ョ敤鎴� */ Boolean userIsNull(Integer Id); + + /** + * 鏍规嵁鐢ㄦ埛Id鏌ヨ鐢ㄦ埛鍚嶇О + * @param userId 鐢ㄦ埛Id + * @return + */ + String selectByUserId(Integer userId); } diff --git a/user-server/src/main/java/com/yuanchu/limslaboratory/service/impl/UserServiceImpl.java b/user-server/src/main/java/com/yuanchu/limslaboratory/service/impl/UserServiceImpl.java index 4690324..0a38be0 100644 --- a/user-server/src/main/java/com/yuanchu/limslaboratory/service/impl/UserServiceImpl.java +++ b/user-server/src/main/java/com/yuanchu/limslaboratory/service/impl/UserServiceImpl.java @@ -65,6 +65,15 @@ } @Override + public String selectByUserId(Integer userId) { + LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(User::getId, userId); + wrapper.select(User::getName); + User user = userMapper.selectOne(wrapper); + return user.getName(); + } + + @Override public Map<String, String> selectUserByUserId(int userId) { return userMapper.selectUserByUserId(userId); } -- Gitblit v1.9.3