|
@@ -8,6 +8,8 @@ import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
import cn.cslg.pas.common.utils.FileUtils;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
import cn.cslg.pas.domain.Product;
|
|
|
+import cn.cslg.pas.domain.ProductMarketData;
|
|
|
+import cn.cslg.pas.domain.Structure;
|
|
|
import cn.cslg.pas.domain.asso.AssoProductPatent;
|
|
|
import cn.cslg.pas.domain.asso.AssoProductPicture;
|
|
|
import cn.cslg.pas.domain.asso.AssoStructurePatent;
|
|
@@ -17,7 +19,10 @@ import cn.cslg.pas.mapper.asso.AssoProductPictureMapper;
|
|
|
import cn.cslg.pas.mapper.ProductMapper;
|
|
|
import cn.cslg.pas.mapper.asso.AssoProductPatentMapper;
|
|
|
import cn.cslg.pas.mapper.asso.AssoStructurePatentMapper;
|
|
|
+import cn.cslg.pas.service.IProductMarketDataService;
|
|
|
import cn.cslg.pas.service.IProductService;
|
|
|
+import cn.cslg.pas.service.IStructureService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -48,6 +53,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|
|
private final AssoProductPatentMapper assoProductPatentMapper;
|
|
|
private final AssoStructurePatentMapper assoStructurePatentMapper;
|
|
|
private final ProjectMapper projectMapper;
|
|
|
+ private final IStructureService structureService;
|
|
|
+ private final IProductMarketDataService productMarketDataService;
|
|
|
private final CacheUtils cacheUtils;
|
|
|
private final LoginUtils loginUtils;
|
|
|
private final FileUtils fileUtils;
|
|
@@ -279,6 +286,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|
|
}
|
|
|
|
|
|
//检查专题库表中是否有该产品数据,若有则不允许删除
|
|
|
+ log.info("检查专题库表中是否有该产品数据,若有则不允许删除");
|
|
|
count = projectMapper.countByProductId(id);
|
|
|
if (count > 0) {
|
|
|
String message = "删除产品失败,该产品已被专题库使用,请尝试先修改专题库";
|
|
@@ -286,8 +294,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|
|
throw new XiaoShiException(message);
|
|
|
}
|
|
|
|
|
|
- //删除产品架构专利号专题库关联表数据
|
|
|
- log.info("产品架构专利号专题库关联表删除数据");
|
|
|
+ //删除产品架构专利专题库关联表数据
|
|
|
+ log.info("产品架构专利专题库关联表删除数据");
|
|
|
AssoStructurePatent assoStructurePatent = new AssoStructurePatent()
|
|
|
.setProductId(id);
|
|
|
assoStructurePatentMapper.delete(assoStructurePatent);
|
|
@@ -300,6 +308,20 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
|
|
log.info("产品专利关联表删除数据");
|
|
|
assoProductPatentMapper.deleteByProductId(id);
|
|
|
|
|
|
+ //删除产品的所有架构的架构关联表数据和架构表数据
|
|
|
+
|
|
|
+
|
|
|
+ LambdaQueryWrapper<Structure> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(Structure::getProductId, id);
|
|
|
+ log.info("产品的架构表删除数据");
|
|
|
+ structureService.remove(wrapper);
|
|
|
+
|
|
|
+ //删除产品营销数据
|
|
|
+ LambdaQueryWrapper<ProductMarketData> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper2.eq(ProductMarketData::getProductId, id);
|
|
|
+ log.info("产品的营销数据表删除数据");
|
|
|
+ productMarketDataService.remove(wrapper2);
|
|
|
+
|
|
|
//删除产品数据
|
|
|
log.info("产品表删除数据");
|
|
|
int rows = productMapper.deleteById(id);
|