| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> deleteMaterialInformation(Integer materialId) { |
| | | public Result<?> deleteMaterialInformation(String materialId) { |
| | | Integer isDeleteMaterialSuccess = materialService.deleteMaterialInformation(materialId); |
| | | if (isDeleteMaterialSuccess == 1) { |
| | | return Result.success("删除成功!"); |
| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class) |
| | | }) |
| | | public Result<?> getListProductInformation(Integer materialId) { |
| | | public Result<?> getListProductInformation(String materialId) { |
| | | List<Map<String, Object>> listMaterialInformation = productService.getListProductInformation(materialId); |
| | | return Result.success(listMaterialInformation); |
| | | } |
| | | |
| | | @ApiOperation("物料库-->根据测试标准ID查询基本信息") |
| | | @GetMapping("/delete") |
| | | @GetMapping("/productId") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "测试标准ID", name = "productId", dataTypeClass = String.class) |
| | | }) |
| | |
| | | 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() +"】失败!"); |
| | | // } |
| | | @ApiOperation("物料库-->根据测试标准Id修改数据") |
| | | @PutMapping("/update") |
| | | public Result<?> updateMaterialInformation(@RequestBody Product product) { |
| | | Integer isUpdateMaterialSuccess = productService.updateMaterialInformation(product); |
| | | if (isUpdateMaterialSuccess == 1) { |
| | | return Result.success("修改【"+ product.getName() +"】成功!"); |
| | | } |
| | | return Result.fail("修改【"+ product.getName() +"】失败!"); |
| | | } |
| | | } |
| | |
| | | map.put("total", selectStandards.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据Id修改型号参数") |
| | | @PutMapping("/update") |
| | | public Result<?> updateSerialNumberInformation(@RequestHeader("X-Token") String token, @RequestBody SerialNumber serialNumber) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | serialNumber.setUserId((Integer) unmarshal.get("id")); |
| | | Integer isUpdateSerialNumberSuccess = serialNumberService.updateSerialNumberInformation(serialNumber); |
| | | if (isUpdateSerialNumberSuccess == 1){ |
| | | return Result.success("更新成功!"); |
| | | } |
| | | return Result.fail("更新失败!"); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据Id删除型号") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteSerialNumberInformation(String serialNumberId) { |
| | | Integer isDeleteSerialNumberSuccess = serialNumberService.deleteSerialNumberInformation(serialNumberId); |
| | | if (isDeleteSerialNumberSuccess == 1){ |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiOperation("标准库-->产品规格-->删除") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationsId", value = "规格Id", dataTypeClass = String.class, required = true) |
| | | @ApiImplicitParam(name = "specificationsId", value = "规格Id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteSpecificationsInformation(String specificationsId) { |
| | | public Result<?> deleteSpecificationsInformation(Integer specificationsId) { |
| | | Integer isStandardsSuccess = specificationsService.deleteSpecifications(specificationsId); |
| | | if (isStandardsSuccess == 1) { |
| | | return Result.success("删除成功!"); |
| | |
| | | @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); |
| | |
| | | map.put("total", listPage.getTotal()); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据Id修改参数") |
| | | @PutMapping("/update") |
| | | public Result<?> updateStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | standards.setUserId((Integer) unmarshal.get("id")); |
| | | Integer isUpdateSuccess = standardsService.updateStandardsInformation(standards); |
| | | if (isUpdateSuccess == 1){ |
| | | return Result.success("更新成功!"); |
| | | } |
| | | return Result.fail("更新失败!"); |
| | | } |
| | | |
| | | @ApiOperation("标准库-->根据ID删除数据") |
| | | @DeleteMapping("/delete") |
| | | public Result<?> deleteStandardsInformation(String standardsId) { |
| | | Integer isDeleteSuccess = standardsService.deleteStandardsInformation(standardsId); |
| | | if (isDeleteSuccess == 1){ |
| | | return Result.success("删除成功!"); |
| | | } |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.pojo; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | |
| | | * @param materialId |
| | | * @return |
| | | */ |
| | | Integer deleteMaterialInformation(Integer materialId); |
| | | Integer deleteMaterialInformation(String materialId); |
| | | |
| | | /** |
| | | * 更新Material的数据 |
| | |
| | | Integer updateMaterialInformation(Material material); |
| | | |
| | | /** |
| | | * 删除等于SpecificationId的数据 |
| | | * @param specificationsId |
| | | * 删除等于SpecificationsId的物料数据 |
| | | * @param deleteSpecificationsId |
| | | * @return |
| | | */ |
| | | List<String> deleteMaterialEqSpecification(String specificationsId); |
| | | List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId); |
| | | } |
| | |
| | | |
| | | Integer addProductInformation(Product product); |
| | | |
| | | List<Map<String, Object>> getListProductInformation(Integer materialId); |
| | | List<Map<String, Object>> getListProductInformation(String materialId); |
| | | |
| | | Map<String, Object> getProductInformation(Integer productId); |
| | | |
| | | Integer deleteProductInformation(Integer productId); |
| | | |
| | | void deleteProductEqMaterialId(List<String> materialListId); |
| | | void MaterialIdDeleteProduct(List<String> deleteMaterialId); |
| | | |
| | | Integer updateMaterialInformation(Product product); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.SerialNumber; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | Integer addSerialNumberInformation(SerialNumber serialNumber); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param idOrNameOfSerialNumber |
| | | * @param standardsId |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page); |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> selectIdSerialNumberInformation(String id); |
| | | |
| | | /** |
| | | * 根据Id修改名称 |
| | | * @param serialNumber |
| | | * @return |
| | | */ |
| | | Integer updateSerialNumberInformation(SerialNumber serialNumber); |
| | | |
| | | List<String> StandardsIdDeleteSerialNumber(String standardsId); |
| | | |
| | | /** |
| | | * 根据型号Id删除数据 |
| | | * @param serialNumberId |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteSerialNumberInformation(String serialNumberId); |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteSpecifications(String specificationsId); |
| | | Integer deleteSpecifications(Integer specificationsId); |
| | | |
| | | List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Standards; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | Boolean standardsIsNull(String Id); |
| | | |
| | | IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards); |
| | | |
| | | /** |
| | | * 根据Id修改字段 |
| | | * @param standards |
| | | * @return |
| | | */ |
| | | Integer updateStandardsInformation(Standards standards); |
| | | |
| | | /** |
| | | * 根据标准Id删除数据 |
| | | * @param standardsId |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | Integer deleteStandardsInformation(String standardsId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Material; |
| | | import com.yuanchu.limslaboratory.mapper.MaterialMapper; |
| | | import com.yuanchu.limslaboratory.pojo.Specifications; |
| | | import com.yuanchu.limslaboratory.service.MaterialService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | @Resource |
| | | private MaterialMapper materialMapper; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Override |
| | | public Integer addMaterialInformation(Material material) { |
| | | return materialMapper.insert(material); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteMaterialInformation(Integer materialId) { |
| | | LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Material::getId, materialId); |
| | | return materialMapper.delete(wrapper); |
| | | public Integer deleteMaterialInformation(String materialId) { |
| | | LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Material::getId, materialId); |
| | | updateWrapper.set(Material::getState, 0); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(materialId); |
| | | int isDeleteSuccess = materialMapper.update(new Material(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | productService.MaterialIdDeleteProduct(list); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @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){ |
| | | public List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (Integer serialNumberId:deleteSpecificationsId){ |
| | | LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Material::getSpecificationsId, serialNumberId); |
| | | wrapper.select(Material::getId); |
| | | List<Material> maps1 = materialMapper.selectList(wrapper); |
| | | for (Material material:maps1){ |
| | | LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Material::getId, material.getId()); |
| | | updateWrapper.set(Material::getState, 0); |
| | | materialMapper.update(new Material(), updateWrapper); |
| | | list.add(material.getId()); |
| | | } |
| | | int isDeleteList = materialMapper.deleteBatchIds(list); |
| | | if (isDeleteList != 0) { |
| | | return list; |
| | | } |
| | | } |
| | | return null; |
| | | return list; |
| | | } |
| | | } |
| | |
| | | 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.Product; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getListProductInformation(Integer materialId) { |
| | | public List<Map<String, Object>> getListProductInformation(String materialId) { |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Product::getMaterialId, materialId); |
| | | wrapper.select(Product::getId, Product::getName, Product::getFather); |
| | |
| | | |
| | | @Override |
| | | public Integer deleteProductInformation(Integer productId) { |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(Product::getId, productId); |
| | | return productMapper.delete(wrapper); |
| | | wrapper.set(Product::getState, 0); |
| | | return productMapper.update(new Product(), wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteProductEqMaterialId(List<String> materialListId) { |
| | | for (String materialId : materialListId){ |
| | | LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); |
| | | public void MaterialIdDeleteProduct(List<String> deleteMaterialId) { |
| | | for (String materialId : deleteMaterialId){ |
| | | LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>(); |
| | | 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); |
| | | wrapper.set(Product::getState, 0); |
| | | productMapper.update(new Product(), wrapper); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateMaterialInformation(Product product) { |
| | | LambdaUpdateWrapper<Product> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Product::getId, product.getId()); |
| | | return productMapper.update(product, updateWrapper); |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.SerialNumber; |
| | | import com.yuanchu.limslaboratory.mapper.SerialNumberMapper; |
| | | import com.yuanchu.limslaboratory.service.SerialNumberService; |
| | | import com.yuanchu.limslaboratory.pojo.Standards; |
| | | 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.utils.MyUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private StandardsService standardsService; |
| | | |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Override |
| | | public Integer addSerialNumberInformation(SerialNumber serialNumber) { |
| | | Boolean userIsNull = userService.userIsNull(serialNumber.getUserId()); |
| | |
| | | wrapper.select(SerialNumber::getId,SerialNumber::getName); |
| | | return serialNumberMapper.selectMaps(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateSerialNumberInformation(SerialNumber serialNumber) { |
| | | return serialNumberMapper.updateById(serialNumber); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> StandardsIdDeleteSerialNumber(String standardsId) { |
| | | LambdaQueryWrapper<SerialNumber> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SerialNumber::getStandardsId, standardsId); |
| | | wrapper.select(SerialNumber::getId); |
| | | List<String> serialNumberId = new ArrayList<>(); |
| | | List<SerialNumber> maps = serialNumberMapper.selectList(wrapper); |
| | | for (SerialNumber map:maps){ |
| | | LambdaUpdateWrapper<SerialNumber> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(SerialNumber::getStandardsId, standardsId); |
| | | updateWrapper.set(SerialNumber::getState, 0); |
| | | serialNumberMapper.update(new SerialNumber(), updateWrapper); |
| | | serialNumberId.add(map.getId()); |
| | | } |
| | | return serialNumberId; |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteSerialNumberInformation(String serialNumberId) { |
| | | LambdaUpdateWrapper<SerialNumber> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(SerialNumber::getId, serialNumberId); |
| | | updateWrapper.set(SerialNumber::getState, 0); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(serialNumberId); |
| | | int isDeleteSuccess = serialNumberMapper.update(new SerialNumber(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(list); |
| | | if (!ObjectUtils.isEmpty(deleteSpecificationsId)){ |
| | | List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId); |
| | | if (!ObjectUtils.isEmpty(deleteMaterialId)){ |
| | | productService.MaterialIdDeleteProduct(deleteMaterialId); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.SerialNumber; |
| | | import com.yuanchu.limslaboratory.pojo.Specifications; |
| | | import com.yuanchu.limslaboratory.mapper.SpecificationsMapper; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import io.swagger.models.auth.In; |
| | | 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; |
| | | import java.util.Objects; |
| | |
| | | } |
| | | |
| | | @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); |
| | | public Integer deleteSpecifications(Integer specificationsId) { |
| | | LambdaUpdateWrapper<Specifications> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Specifications::getId, specificationsId); |
| | | updateWrapper.set(Specifications::getState, 0); |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(specificationsId); |
| | | int isDeleteSuccess = specificationsMapper.update(new Specifications(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(list); |
| | | if (!ObjectUtils.isEmpty(deleteMaterialId)){ |
| | | productService.MaterialIdDeleteProduct(deleteMaterialId); |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | for (String serialNumberId:deleteSerialNumberId){ |
| | | LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Specifications::getSerialId, serialNumberId); |
| | | wrapper.select(Specifications::getId); |
| | | List<Specifications> maps1 = specificationsMapper.selectList(wrapper); |
| | | for (Specifications specifications:maps1){ |
| | | LambdaUpdateWrapper<Specifications> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Specifications::getId, specifications.getId()); |
| | | updateWrapper.set(Specifications::getState, 0); |
| | | specificationsMapper.update(new Specifications(), updateWrapper); |
| | | list.add(specifications.getId()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Standards; |
| | | import com.yuanchu.limslaboratory.mapper.StandardsMapper; |
| | | import com.yuanchu.limslaboratory.pojo.User; |
| | | import com.yuanchu.limslaboratory.service.SerialNumberService; |
| | | import com.yuanchu.limslaboratory.service.StandardsService; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | 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; |
| | |
| | | @Lazy |
| | | @Autowired |
| | | private SerialNumberService serialNumberService; |
| | | |
| | | @Lazy |
| | | @Autowired |
| | | private SpecificationsService specificationsService; |
| | | |
| | | @Autowired |
| | | private MaterialService materialService; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Override |
| | | public Integer addStandardsInformation(Standards standards) { |
| | |
| | | public IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards) { |
| | | return standardsMapper.listPageStandardsInformation(page, idOrNameOfStandards); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateStandardsInformation(Standards standards) { |
| | | return standardsMapper.updateById(standards); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteStandardsInformation(String standardsId) { |
| | | LambdaUpdateWrapper<Standards> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(Standards::getId, standardsId); |
| | | updateWrapper.set(Standards::getState, 0); |
| | | int isDeleteSuccess = standardsMapper.update(new Standards(), updateWrapper); |
| | | if (isDeleteSuccess == 1){ |
| | | List<String> deleteSerialNumberId = serialNumberService.StandardsIdDeleteSerialNumber(standardsId); |
| | | if (!ObjectUtils.isEmpty(deleteSerialNumberId)){ |
| | | List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(deleteSerialNumberId); |
| | | if (!ObjectUtils.isEmpty(deleteSpecificationsId)){ |
| | | List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId); |
| | | if (!ObjectUtils.isEmpty(deleteMaterialId)){ |
| | | productService.MaterialIdDeleteProduct(deleteMaterialId); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | 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() { |