From 22271e641e4505ba906c3770905b7e84e3ad8d85 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 02 四月 2024 17:05:57 +0800
Subject: [PATCH] mrshi

---
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
index 75e4954..3f3a8e3 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -61,6 +61,15 @@
         LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
         initCreateParam(solutions);//宸ョ鏁版嵁鏈夋晥鎬ф楠岋紝鍘婚櫎绌虹櫧琛屾暟鎹�
 
+
+        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
+                .eq(Solutions::getName,solutions.getName())
+                .eq(Solutions::getIsdeleted,Constants.ZERO)
+                .eq(Solutions::getDataType,Constants.ZERO)
+        )>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�");
+        }
+
         solutions.setIsdeleted(Constants.ZERO);
         solutions.setCreator(user.getId());
         solutions.setCreateDate(new Date());
@@ -167,7 +176,14 @@
         }
         //鏁版嵁鏈夋晥鎬ф牎楠�
         initCreateParam(solutions);
-
+        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
+                .eq(Solutions::getName,solutions.getName())
+                .eq(Solutions::getIsdeleted,Constants.ZERO)
+                .eq(Solutions::getDataType,Constants.ZERO)
+                .ne(Solutions::getId,solutions.getId())
+        )>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�");
+        }
         solutions.setEditor(user.getId());
         solutions.setVersion(UUID.randomUUID().toString());
         solutions.setEditDate(new Date());
@@ -316,7 +332,10 @@
         queryWrapper.selectAll(Solutions.class);
         queryWrapper.selectAs(Insurance::getName,Solutions::getInsuranceName);
         queryWrapper.leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId);
-
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(user.getType().equals(Constants.ONE)){
+            queryWrapper.exists(("select 1 from company_solution b where b.isdeleted=0 and b.company_id="+user.getCompanyId()+" and b.SOLUTION_BASE_ID = t.id"));
+        }
         if (pageWrap.getModel().getId() != null) {
             queryWrapper.eq(Solutions::getId, pageWrap.getModel().getId());
         }
@@ -451,11 +470,17 @@
         List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>()
                         .selectAll(Solutions.class)
                 .leftJoin(CompanySolution.class,CompanySolution::getSolutionId,Solutions::getId)
+                .leftJoin(Company.class,Company::getId,CompanySolution::getCompanyId)
+                .leftJoin(Insurance.class,Insurance::getId,Solutions::getInsuranceId)
                 .eq(Solutions::getIsdeleted,Constants.ZERO)
                 .eq(Solutions::getStatus,Constants.ZERO)
                 .eq(Solutions::getDataType,dataType)
                 .eq(CompanySolution::getIsdeleted,Constants.ZERO)
                 .eq(CompanySolution::getCompanyId,user.getCompanyId())
+                .eq(Company::getIsdeleted,Constants.ZERO)
+                .eq(Company::getStatus,Constants.ZERO)
+                .eq(Insurance::getIsdeleted,Constants.ZERO)
+                .eq(Insurance::getStatus,Constants.ZERO)
                 .orderByAsc(Solutions::getSortnum)
         );
         return solutionsList;

--
Gitblit v1.9.3