| | |
| | | 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> |
| | |
| | | * @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() +"ã失败ï¼"); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-17 |
| | | */ |
| | | @Api(tags = "æ ååº-->è§æ ¼-->æ¥ç-->ç¶-->å") |
| | | @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(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() +"ã失败ï¼"); |
| | | // } |
| | | } |
| | |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-11 |
| | | */ |
| | | @Api(tags = "æ ååº-->åå·æä½") |
| | | @Api(tags = "æ ååº-->åå·") |
| | | @RestController |
| | | @RequestMapping("/serial-number") |
| | | public class SerialNumberController { |
| | |
| | | return Result.fail("æ·»å ã"+ serialNumber.getName() +"ã失败ï¼"); |
| | | } |
| | | |
| | | @ApiOperation("æ ååº-->ç¹å»ä¾§è¾¹æ æ åï¼æ¥è¯¢ææåå·") |
| | | @ApiOperation("æ ååº-->ç¹å»ä¾§è¾¹æ æ åï¼å页æ¥è¯¢ææåå·") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "æ åå·/æ ååç§°", name = "IdOrNameOfSerialNumber", dataTypeClass = String.class), |
| | | @ApiImplicitParam(value = "æ åå·Id", name = "standardsId", dataTypeClass = String.class, required = true) |
| | | @ApiImplicitParam(value = "åå·/åå·åç§°", name = "IdOrNameOfSerialNumber", dataTypeClass = String.class), |
| | | @ApiImplicitParam(value = "æ åå·Id", 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-11 |
| | | */ |
| | | @Api(tags = "æ ååº-->åå·-->产åè§æ ¼æä½") |
| | | @Api(tags = "æ ååº-->åå·-->产åè§æ ¼") |
| | | @RestController |
| | | @RequestMapping("/specifications") |
| | | public class SpecificationsController { |
| | |
| | | @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("对ä¸èµ·ï¼è¯·æºå¸¦Token!"); |
| | | } |
| | | 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("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | 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 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> |
| | |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2023-07-11 |
| | | */ |
| | | @Api(tags = "æ ååºæä½") |
| | | @Api(tags = "æ ååº-->âââ") |
| | | @RestController |
| | | @RequestMapping("/standards") |
| | | public class StandardsController { |
| | |
| | | @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("对ä¸èµ·æ·»å 失败ï¼è¯·æ·»å Tokenï¼"); |
| | | } |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | standards.setUserId((Integer) unmarshal.get("id")); |
| | | Integer isStandardsSuccess = standardsService.addStandardsInformation(standards); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | |
| | | */ |
| | | public interface ProductMapper extends BaseMapper<Product> { |
| | | |
| | | Map<String, Object> getProductInformation(Integer productId); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | public interface SerialNumberMapper extends BaseMapper<SerialNumber> { |
| | | |
| | | IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page); |
| | | } |
| | |
| | | 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; |
| | |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | public interface StandardsMapper extends BaseMapper<Standards> { |
| | | |
| | | List<Map<String, Object>> listStandardsInformation(String idOrNameOfStandards); |
| | | IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards); |
| | | } |
| | |
| | | |
| | | 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") |
| | |
| | | @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; |
| | | |
| | | |
| | |
| | | |
| | | 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") |
| | |
| | | @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; |
| | | |
| | | |
| | |
| | | @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) |
| | |
| | | private Integer spe_state; |
| | | |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | @TableLogic(value = "1", delval = "0") |
| | | private Integer state; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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> |
| | |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | 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); |
| | | |
| | | /** |
| | | * å¤è¡¨å é¤ï¼è¡¨æ ¼å嫿ï¼Specification --> Material --> Product |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteSpecifications(String specificationsId); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | |
| | | 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); |
| | | } |
| | |
| | | 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> |
| | |
| | | @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; |
| | | } |
| | | } |
| | |
| | | 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> |
| | |
| | | @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); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | @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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Override |
| | | public Integer addSpecificationsInformation(Specifications specifications) { |
| | | Boolean userIsNull = userService.userIsNull(specifications.getUserId()); |
| | |
| | | } |
| | | |
| | | @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çMaterialè¡¨æ ¼ä¸çæ°æ®ï¼å¹¶ä¸è·åè¯¥æ°æ®çIdï¼ç¨äºå é¤Productè¡¨æ ¼ä¸çæ°æ® |
| | | List<String> materialListId = materialService.deleteMaterialEqSpecification(specificationsId); |
| | | if (!ObjectUtils.isEmpty(materialListId)){ |
| | | // æ ¹æ®Material表è¿åçå表Idï¼å é¤Productè¡¨ä¸ææMaterialIdçäºè¯¥å表ä¸çæææ°æ®ï¼æ è¿åå¼ |
| | | productService.deleteProductEqMaterialId(materialListId); |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Lazy |
| | | @Autowired |
| | | private SerialNumberService serialNumberService; |
| | | |
| | | @Override |
| | | public Integer addStandardsInformation(Standards standards) { |
| | | Boolean userIsNull = userService.userIsNull(standards.getUserId()); |
| | |
| | | } |
| | | |
| | | @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 |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | |
| | | <!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> |
| | |
| | | <!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> |
| | |
| | | <!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> |
| | |
| | | <!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> |
| | |
| | | |
| | | # éµ·éç½ç»IPæè
åå |
| | | customer: |
| | | url: http://127.0.0.1:6789 |
| | | url: http://114.132.189.42:8011 |
| | | |
| | | mybatis-plus: |
| | | configuration: |
| | |
| | | # redis访é®å¯ç ï¼é»è®¤ä¸ºç©ºï¼ |
| | | password: null |
| | | # redisè¿æ¥è¶
æ¶æ¶é´ï¼å使¯«ç§ï¼ |
| | | timeout: 0 |
| | | timeout: 5000 |
| | | # redisè¿æ¥æ± é
ç½® |
| | | pool: |
| | | # æå¤§å¯ç¨è¿æ¥æ°ï¼é»è®¤ä¸º8ï¼è´æ°è¡¨ç¤ºæ éï¼ |
| | |
| | | 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()); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import java.util.Map; |
| | | |
| | | @FeignClient(value = "userservice", url = "localhost:6789") |
| | | @FeignClient(value = "userservice", url = "${customer.url}") |
| | | public interface UserClient { |
| | | |
| | | @PostMapping("/business/login") |
| | |
| | | * @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); |
| | | } |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |