| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | |
| | | return Result.fail("类型错误!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增检验单-->选择检验项目版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "name", value = "产品名称", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "mcode", value = "产品编号", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "specifications", value = "规格型号", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseVer") |
| | | public Result chooseVer(String name, String mcode, String specifications) { |
| | | return Result.success(inspectionService.chooseVer(name, mcode, specifications)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "新增检验单") |
| | | @PostMapping("/addInspect") |
| | | public Result addInspect(@RequestHeader("token") String token, @RequestBody InspectionVo inspectionVo) throws Exception { |
| | | public Result addInspect(@RequestHeader("token") String token, @Validated @RequestBody InspectionVo inspectionVo) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | return Result.success(inspectionService.addInspect((Integer) unmarshal.get("id"), inspectionVo)); |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "保存检验项目责任人") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "检验单项目id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "userProId", value = "责任人id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "检验单项目id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "userProId", value = "责任人id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseUseProId") |
| | | public Result chooseUseProId(Integer id,Integer userProId) { |
| | | return Result.success(inspectionService.chooseUseProId(id,userProId)); |
| | | public Result chooseUseProId(Integer id, Integer userProId) { |
| | | return Result.success(inspectionService.chooseUseProId(id, userProId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "作废检验单") |
| | |
| | | @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/delInspect") |
| | | public Result delInspect(Integer id) { |
| | | public Result delInspect(Integer id) { |
| | | return Result.success(inspectionService.delInspect(id)); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.yuanchu.limslaboratory.pojo.LinkBasicInformation; |
| | | import com.yuanchu.limslaboratory.pojo.LinkDetection; |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.service.LinkBasicInformationService; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.service.StandardService; |
| | | 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 javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @Autowired |
| | | private StandardService standardService; |
| | | |
| | | @Resource |
| | | ProductService productService; |
| | | |
| | | @ApiOperation("链接-->获取样品名称") |
| | | @GetMapping("/material") |
| | | public Result<?> getMaterialIdAndName(@RequestHeader("link") String link) { |
| | |
| | | return Result.fail("抱歉链接错误或已过期!"); |
| | | } |
| | | |
| | | @ApiOperation("链接-->添加检验申请单") |
| | | @ApiOperation("链接-->选择试验项目") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "modelId", value = "型号id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseProject") |
| | | public Result<?> chooseProject(@RequestHeader("link") String link, Integer modelId) { |
| | | String redisLink = RedisUtil.get("viewId").toString(); |
| | | if (linkBasicInformationService.isIfViewUUID(redisLink)){ |
| | | //查询标准库中该型号下的所有试验项目(父类) |
| | | return Result.success(productService.chooseProject(modelId)); |
| | | } |
| | | return Result.fail("抱歉链接错误或已过期!"); |
| | | |
| | | } |
| | | |
| | | @ApiOperation("链接-->添加委托报检申请单") |
| | | @PostMapping("/addInspection") |
| | | public Result<?> addLinkBasicInformation(@RequestHeader("link") String link, @RequestBody LinkBasicInformation linkBasicInformation) { |
| | | String redisLink = RedisUtil.get("viewId").toString(); |
| | | if (linkBasicInformationService.isIfViewUUID(redisLink)){ |
| | | linkBasicInformation.setUUID(redisLink); |
| | | linkBasicInformation.setUid(redisLink); |
| | | String code = linkBasicInformationService.addLinkBasicInformation(linkBasicInformation); |
| | | if (!ObjectUtils.isEmpty(code)){ |
| | | return Result.success("添加成功!", code); |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private List<LinkDetection> linkDetectionList; |
| | | |
| | | @ApiModelProperty(value = "生成id:作用于有效期内查询内容所用") |
| | | private String UUID; |
| | | private String uid; |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "检验日期", hidden = true) |
| | | @ApiModelProperty(value = "检验日期", required = true,example = "2023-08-22") |
| | | private Date dateSurvey; |
| | | |
| | | @ApiModelProperty(value = "检验状态", hidden = true) |
| | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | //新增检验单 |
| | |
| | | *检验类型 0:原材料;1:产品;2:半成品; |
| | | **/ |
| | | @JsonSerialize |
| | | @NotNull(message = "检验类型不能为空") |
| | | private Integer type; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "来料日期不能为空") |
| | | private Date formTime; |
| | | |
| | | /** |
| | | * 供应商 |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "供应商不能为空") |
| | | private String supplier; |
| | | |
| | | /** |
| | | * 物料编码 |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "样品编码不能为空") |
| | | private String mcode; |
| | | |
| | | /** |
| | | * 物料名称 |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "样品名称不能为空") |
| | | private String name; |
| | | |
| | | /** |
| | | * 规格名称-型号名称 |
| | | **/ |
| | | @JsonSerialize |
| | | @NotBlank(message = "规格型号不能为空") |
| | | private String specifications; |
| | | |
| | | /** |
| | |
| | | * 报检数量-物料数量 |
| | | **/ |
| | | @JsonSerialize |
| | | @NotNull(message = "报检数量不能为空") |
| | | private Integer num; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "检验开始时间不能为空") |
| | | private Date startTime; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "检验结束时间不能为空") |
| | | private Date endTime; |
| | | |
| | | //试验项目 |
| | | @NotBlank(message = "试验项目不能为空") |
| | | @JsonSerialize |
| | | private String experiment; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | String chooseUseProId(Integer id, Integer userProId); |
| | | |
| | | /** |
| | | * 新增检验单-->选择检验项目版本 |
| | | * @param name |
| | | * @param mcode |
| | | * @param specifications |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> chooseVer(String name, String mcode, String specifications); |
| | | |
| | | } |
| | | |
| | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | .build(); |
| | | inspectionMaterialMapper.insert(inspectionMaterial); |
| | | /*新增检验项目表*/ |
| | | //获取物料id |
| | | Material material = materialMapper.selectOne(Wrappers.<Material>query() |
| | | .eq("name", inspectionVo.getName()) |
| | | .eq("code", inspectionVo.getMcode())); |
| | | //获取规格名称和型号名称 |
| | | String specification = inspectionVo.getSpecifications(); |
| | | String[] split = specification.split("-"); |
| | | String stName = split[0]; |
| | | String spName = split[1]; |
| | | //获取规格id |
| | | Standard standard = standardService.getOne(Wrappers.<Standard>query() |
| | | .eq("name", stName) |
| | | .eq("material_id", material.getId())); |
| | | //获取型号id |
| | | Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query() |
| | | .eq("name", spName) |
| | | .eq("standard_id", standard.getId())); |
| | | //根据型号id查询项目信息 |
| | | List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specifications.getId())); |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : productList) { |
| | | InspectionProduct rawInsProduct = InspectionProduct.builder() |
| | | .name(product.getName()) |
| | | .unit(product.getUnit()) |
| | | .required(product.getRequired()) |
| | | .internal(product.getInternal()) |
| | | .inspectionMaterialId(material.getId()) |
| | | .build(); |
| | | list.add(rawInsProduct); |
| | | //根据样品名称编号以及型号规格获取型号id |
| | | Integer specificationId = getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications()); |
| | | //如果试验项目字段不为空 |
| | | if (ObjectUtils.isNotEmpty(inspectionVo.getExperiment())) { |
| | | //获取试验项目信息(结构,导线外径) |
| | | List<String> experiments = Arrays.stream(inspectionVo.getExperiment().split(",")).collect(Collectors.toList()); |
| | | //根据型号id和项目信息查询项目信息 |
| | | List<Product> products = new ArrayList<>(); |
| | | for (String experiment : experiments) { |
| | | List<Product> productList1 = productMapper.selectList(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .eq("father", experiment)); |
| | | if (ObjectUtils.isEmpty(productList1)) { |
| | | Product product = productMapper.selectOne(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .isNull("father") |
| | | .eq("name", experiment)); |
| | | products.add(product); |
| | | } else products.addAll(productList1); |
| | | } |
| | | |
| | | //将查询的项目信息构建成检验项目 |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : products) { |
| | | InspectionProduct rawInsProduct = InspectionProduct.builder() |
| | | .name(product.getName()) |
| | | .unit(product.getUnit()) |
| | | .required(product.getRequired()) |
| | | .internal(product.getInternal()) |
| | | .inspectionMaterialId(inspectionMaterial.getId()) |
| | | .build(); |
| | | list.add(rawInsProduct); |
| | | } |
| | | |
| | | //检验项目批量添加 |
| | | inspectionProductService.saveBatch(list); |
| | | return inspection.getId(); |
| | | } |
| | | //检验项目批量添加 |
| | | inspectionProductService.saveBatch(list); |
| | | return inspection.getId(); |
| | | //todo:未完 |
| | | return null; |
| | | } |
| | | |
| | | //根据检验单id查询原材料检验单详情 |
| | |
| | | } |
| | | |
| | | |
| | | //新增检验单-->选择检验项目版本 |
| | | @Override |
| | | public List<Map<String, Object>> chooseVer(String name, String mcode, String specifications) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /*根据样品名称,样品编号,型号规格获取型号id*/ |
| | | private Integer getSpecificationId(String name, String mcode, String specification) { |
| | | //获取物料id |
| | | Material material = materialMapper.selectOne(Wrappers.<Material>query() |
| | | .eq("name", name) |
| | | .eq("code", mcode)); |
| | | //获取规格名称和型号名称 |
| | | String[] split = specification.split("-"); |
| | | String stName = split[0]; |
| | | String spName = split[1]; |
| | | //获取规格id |
| | | Standard standard = standardService.getOne(Wrappers.<Standard>query() |
| | | .eq("name", stName) |
| | | .eq("material_id", material.getId())); |
| | | //获取型号id |
| | | Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query() |
| | | .eq("name", spName) |
| | | .eq("standard_id", standard.getId())); |
| | | return specifications.getId(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public String addLinkBasicInformation(LinkBasicInformation linkBasicInformation) { |
| | | //委托编号 |
| | | String code = MyUtil.getTimeSixNumberCode("SL", "SL"); |
| | | linkBasicInformation.setEntrustCoding(code); |
| | | //新增基本信息表 |
| | | int insert = linkBasicInformationMapper.insert(linkBasicInformation); |
| | | if (insert == 1) { |
| | | //新增委托样品表 |
| | | linkDetectionService.insertListData(linkBasicInformation.getId(), linkBasicInformation.getLinkDetectionList()); |
| | | return code; |
| | | } |
| | |
| | | @Override |
| | | public void insertListData(Integer id, List<LinkDetection> linkDetectionList) { |
| | | for (LinkDetection linkDetection:linkDetectionList){ |
| | | linkDetection.setInspectionStatus(2); |
| | | linkDetection.setInspectionStatus(1); |
| | | linkDetection.setLinkBasicId(id); |
| | | } |
| | | linkDetectionMapper.insertBatchSomeColumn(linkDetectionList); |
| | |
| | | </select> |
| | | |
| | | <select id="selectLinkAll" resultType="java.util.Map"> |
| | | SELECT DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') formTime, |
| | | l.`entrusted` supplier, |
| | | d.`sample_number` mcode, |
| | | d.`sample_name` name, |
| | | d.`specifications_models` specifications, |
| | | SELECT DATE_FORMAT(l.`inspection_time`, '%Y-%m-%d') formTime, |
| | | l.`entrusted` supplier, |
| | | d.`sample_number` mcode, |
| | | d.`sample_name` name, |
| | | d.`specifications_models` specifications, |
| | | d.`unit`, |
| | | d.`samples_number` num, |
| | | DATE_FORMAT(date_survey,'%Y-%m-%d') startTime, |
| | | DATE_FORMAT(completion_deadline,'%Y-%m-%d') endTime |
| | | d.`samples_number` num, |
| | | experiment, |
| | | DATE_FORMAT(date_survey, '%Y-%m-%d') startTime, |
| | | DATE_FORMAT(completion_deadline, '%Y-%m-%d') endTime |
| | | FROM lims_laboratory.link_basic_information l, |
| | | lims_laboratory.link_detection d |
| | | WHERE l.`id` = d.`link_basic_id` |
| | | AND l.`state` = 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.*; |
| | | 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; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @ApiOperation("查询该型号下的项目") |
| | | @ApiOperation("查询该型号下的项目-->选择版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号ID", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @GetMapping("/chooseVersion") |
| | | public Result<?> chooseVersion(Integer specificationsId) { |
| | | return Result.success(productService.chooseVersion(specificationsId)); |
| | | } |
| | | |
| | | @ApiOperation("查询该型号下的项目") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号ID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "版本(默认最新版本)", dataTypeClass = Integer.class,required = true ) |
| | | }) |
| | | @GetMapping("/page") |
| | | public Result<?> pageProductInformation(Integer specificationsId) { |
| | | return Result.success(productService.pageProductInformation(specificationsId)); |
| | | public Result<?> pageProductInformation(Integer specificationsId,Integer version) { |
| | | return Result.success(productService.pageProductInformation(specificationsId,version)); |
| | | } |
| | | |
| | | @ApiOperation("填写标准值与内控值,鼠标移开保存") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "标准项目ID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "required", value = "标准值", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "internal", value = "内控值", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "internal", value = "内控值", dataTypeClass = String.class, required = true) |
| | | |
| | | }) |
| | | @PostMapping("/write") |
| | | public Result<?> write(Integer id, String required, String internal) { |
| | |
| | | productService.deleteList(ids); |
| | | return Result.success("删除成功"); |
| | | } |
| | | |
| | | @ApiOperation("添加同一个型号的其他版本") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/addVersion") |
| | | public Result<?> addVersion(Integer specificationsId ) { |
| | | Integer version = productService.addVersion(specificationsId); |
| | | return Result.success("添加版本"+version+"成功"); |
| | | } |
| | | } |
| | |
| | | List<Map> selectProductByMaterialId(int materialId); |
| | | |
| | | //展示该型号下的检验项目要求 |
| | | List<Map<String, Object>> pageProductInformation(Integer specificationsId); |
| | | List<Map<String, Object>> pageProductInformation(Integer specificationsId,Integer version); |
| | | |
| | | void deleteList(String ids); |
| | | |
| | | //展示该型号下的检验项目要求-->选择版本 |
| | | List<Integer> chooseVersion(Integer specificationsId); |
| | | |
| | | //查询该型号下的所有试验项目(父类) |
| | | List<Map<String,Object>> chooseProject(Integer modelId); |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "乐观锁", hidden = true) |
| | | @ApiModelProperty(value = "版本", hidden = true) |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty(value = "关联 型号id", example = "1", hidden = true) |
| | |
| | | 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.Product; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | |
| | | public interface ProductService extends IService<Product> { |
| | | void deleteProductInformation(List<Integer> SpecificationsId); |
| | | |
| | | /** |
| | | * 展示该型号下的检验项目要求-->选择版本 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | List<Integer> chooseVersion(Integer specificationsId); |
| | | |
| | | |
| | | /** |
| | | * 展示该型号下的检验项目要求 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> pageProductInformation(Integer specificationsId); |
| | | List<Map<String,Object>> pageProductInformation(Integer specificationsId,Integer version); |
| | | |
| | | /** |
| | | * 填写标准值与内控值,鼠标移开保存 |
| | |
| | | Integer write(Integer id, String required, String internal); |
| | | |
| | | void deleteList(String ids); |
| | | |
| | | /** |
| | | * 添加同一个型号的其他版本 |
| | | * @param specificationsId |
| | | * @return |
| | | */ |
| | | Integer addVersion(Integer specificationsId); |
| | | |
| | | |
| | | /** |
| | | * 查询该型号下的所有试验项目(父类) |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> chooseProject(Integer modelId); |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.mapper.ProductModelMapper; |
| | | import com.yuanchu.limslaboratory.mapper.SpecificationsMapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | import com.yuanchu.limslaboratory.pojo.ProductModel; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.yuanchu.limslaboratory.service.UserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private ProductMapper productMapper; |
| | | |
| | | @Resource |
| | | ProductModelMapper productModelMapper; |
| | | |
| | | |
| | | @Override |
| | | public void deleteProductInformation(List<Integer> SpecificationsId) { |
| | |
| | | } |
| | | } |
| | | |
| | | //展示该型号下的检验项目要求-->选择版本 |
| | | @Override |
| | | public List<Integer> chooseVersion(Integer specificationsId) { |
| | | return productMapper.chooseVersion(specificationsId); |
| | | } |
| | | |
| | | //展示该型号下的检验项目要求 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<Map<String, Object>> pageProductInformation(Integer specificationsId) { |
| | | return productMapper.pageProductInformation(specificationsId); |
| | | public List<Map<String, Object>> pageProductInformation(Integer specificationsId,Integer version) { |
| | | return productMapper.pageProductInformation(specificationsId,version); |
| | | } |
| | | |
| | | //填写标准值与内控值,鼠标移开保存 |
| | |
| | | productMapper.deleteList(ids); |
| | | } |
| | | |
| | | //添加同一个型号的其他版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId) { |
| | | List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specificationsId)); |
| | | for (Product product : productList) { |
| | | product.setVersion(product.getVersion()+1); |
| | | } |
| | | saveBatch(productList); |
| | | return productList.get(0).getVersion(); |
| | | } |
| | | |
| | | //查询该型号下的所有试验项目(父类) |
| | | @Override |
| | | public List<Map<String,Object>> chooseProject(Integer modelId) { |
| | | return productMapper.chooseProject(modelId); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <result property="unit" column="unit"/> |
| | | <result property="required" column="required"/> |
| | | <result property="internal" column="internal"/> |
| | | <result property="version" column="version"/> |
| | | </resultMap> |
| | | |
| | | <select id="pageProductInformation" resultMap="pageProductInformationMap"> |
| | |
| | | father, |
| | | unit, |
| | | required, |
| | | internal |
| | | internal, |
| | | version |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationsId} |
| | | and version = #{version} |
| | | </select> |
| | | |
| | | <select id="deleteList"> |
| | |
| | | set state=0 |
| | | where id in (${ids}) |
| | | </select> |
| | | |
| | | <!--展示该型号下的检验项目要求-选择版本--> |
| | | <select id="chooseVersion" resultType="java.lang.Integer"> |
| | | select distinct version |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationsId} |
| | | order by version desc |
| | | </select> |
| | | |
| | | <!--查询该型号下的所有试验项目(父类)--> |
| | | <resultMap id="chooseProjects" type="map"> |
| | | <id property="name" column="father"/> |
| | | <collection property="children" resultMap="chooseProjectTowMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="chooseProjectTowMap" type="map"> |
| | | <id property="id" column="id"/> |
| | | <result property="name" column="name"/> |
| | | </resultMap> |
| | | <select id="chooseProject" resultMap="chooseProjects"> |
| | | select id, father, name |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{modelId} |
| | | </select> |
| | | </mapper> |