Эх сурвалжийг харах

Merge branch 'dev' of http://219.151.181.73:3000/zhuwei/bladex into dev

lvy 3 өдөр өмнө
parent
commit
0d93ea7341

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialClassificationTreeVO.java

@@ -36,6 +36,8 @@ public class TrialClassificationTreeVO  {
 	private Long id;
 
 	private Long projectId;
+
+	private Long contractId;
 	/**
 	 * 父级ID
 	 */

+ 2 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialClassificationTreeController.java

@@ -61,7 +61,6 @@ import java.util.stream.Collectors;
 public class TrialClassificationTreeController extends BladeController {
 
 	private final ITrialClassificationTreeService trialClassificationTreeService;
-	private final Long TJ05_CONTRACT_ID = 1912405021063585793L;
 
 //	/**
 //	 * 详情
@@ -80,11 +79,11 @@ public class TrialClassificationTreeController extends BladeController {
 	@GetMapping("/list")
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "查询当前节点的子节点", notes = "传入trialClassificationTree")
-	public R<List<TrialClassificationTreeVO>> list(Long id,Long projectId,Long TJ05_CONTRACT_ID) {
+	public R<List<TrialClassificationTreeVO>> list(Long id,Long projectId,Long contractId) {
 		if(projectId==null){
 			throw new ServiceException("请选择项目");
 		}
-		List<TrialClassificationTreeVO> list = trialClassificationTreeService.selectAllNode(id,projectId,TJ05_CONTRACT_ID);
+		List<TrialClassificationTreeVO> list = trialClassificationTreeService.selectAllNode(id,projectId,contractId);
 		return R.data(list);
 	}
 
@@ -123,7 +122,6 @@ public class TrialClassificationTreeController extends BladeController {
 		for (TrialClassificationTreeDTO trialClassificationTreeDTO : dto.getList()) {
 			TrialClassificationTree trialClassificationTree = new TrialClassificationTree();
 			BeanUtil.copy(trialClassificationTreeDTO, trialClassificationTree);
-			trialClassificationTree.setContractId(TJ05_CONTRACT_ID);
 			Long parentId = trialClassificationTree.getParentId();
 			StringBuilder classificationAncestors = new StringBuilder();
 			classificationAncestors.append(trialClassificationTree.getId());

+ 0 - 3
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialSystemDockingController.java

@@ -66,7 +66,6 @@ public class TrialSystemDockingController extends BladeController {
 
 	private final ITrialClassificationTreeService trialClassificationTreeService;
 
-	private final Long TJ05_CONTRACT_ID = 1912405021063585793L;
 
 	/**
 	 * 详情
@@ -97,7 +96,6 @@ public class TrialSystemDockingController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入trialSystemDocking")
 	public R<IPage<TrialSystemDockingVO>> page(TrialSystemDockingVO trialSystemDocking, Query query) {
-		trialSystemDocking.setContractId(TJ05_CONTRACT_ID);
 		IPage<TrialSystemDockingVO> pages = trialSystemDockingService.selectTrialSystemDockingPage(Condition.getPage(query), trialSystemDocking);
 		return R.data(pages);
 	}
@@ -113,7 +111,6 @@ public class TrialSystemDockingController extends BladeController {
 		for (TrialSystemDockingDTO trialSystemDockingDTO : list) {
 			TrialSystemDocking trialSystemDocking = new TrialSystemDocking();
 			BeanUtil.copy(trialSystemDockingDTO,trialSystemDocking);
-			trialSystemDocking.setContractId(TJ05_CONTRACT_ID);
 			TrialClassificationTree trialClassificationTree = trialClassificationTreeService.getById(trialSystemDockingDTO.getClassificationId());
 			if(trialClassificationTree!=null){
 				trialSystemDocking.setClassificationAncestors(trialClassificationTree.getClassificationAncestors());

+ 11 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyTestTypeMapper.java

@@ -17,6 +17,17 @@ public interface TrialCyTestTypeMapper extends BaseMapper<TrialCyTestType> {
     List<TrialCyTestType> getTree(@Param("projectId") Long projectId,
                                   @Param("parentId") String parentId,
                                   @Param("contractId") String contractId);
+
+    int selectTreeContractCount(@Param("projectId") Long projectId);
+
+    /**
+     * 只根据项目id查询树
+     * @param projectId
+     * @param parentId
+     * @return
+     */
+    List<TrialCyTestType> getTree2(Long projectId, String parentId);
+
 }
 
 

+ 12 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialCyTestTypeMapper.xml

@@ -22,4 +22,16 @@
           and father_id = #{parentId}
         order by order_index
     </select>
+    <select id="selectTreeContractCount" resultType="java.lang.Integer">
+        SELECT count(DISTINCT contract_id) FROM `vw_u_trial_cy_tree` where project_id = #{projectId}
+    </select>
+    <select id="getTree2" resultType="org.springblade.business.entity.TrialCyTestType">
+        select
+        <include refid="Base_sql"/>,
+        (select count(1) > 0 from vw_u_trial_cy_tree where father_id = t.id and contract_id = #{contractId}) has_children
+        from vw_u_trial_cy_tree t
+        where project_id = #{projectId}
+        and father_id = #{parentId}
+        order by order_index
+    </select>
 </mapper>

+ 6 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialCyTestTypeServiceImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.business.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.business.entity.TrialCyTestType;
 import org.springblade.business.service.TrialCyTestTypeService;
@@ -19,6 +20,11 @@ public class TrialCyTestTypeServiceImpl extends ServiceImpl<TrialCyTestTypeMappe
     implements TrialCyTestTypeService {
     @Override
     public List<TrialCyTestType> getTree(Long projectId, String parentId, String contractId) {
+        //当前项目是否存在合同段单独的分类树
+        int count = baseMapper.selectTreeContractCount(projectId);
+        if(count == 0){
+            return baseMapper.getTree2(projectId, parentId);
+        }
         return baseMapper.getTree(projectId, parentId,contractId);
     }
 }