ソースを参照

搜索和非搜索的节点颜色状态不一致

lvy 1 ヶ月 前
コミット
b4ca3cbe27

+ 8 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -431,13 +431,15 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                             queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
                         } else {
                             if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
-                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
+                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? GROUP BY wbs_id ) as a)"
+                                        , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractId);
                                 if (queryInfoList.size() > 0) {
                                     JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
                                     redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1", JSON.toJSON(array).toString());
                                 }
                             } else {
-                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId + " and classify = " + tableOwner, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
+                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? AND classify = ? GROUP BY wbs_id) as a)"
+                                        , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractId,tableOwner);
                                 if (queryInfoList.size() > 0) {
                                     JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
                                     redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner, JSON.toJSON(array).toString());
@@ -576,13 +578,15 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                 queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
                             } else {
                                 if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
-                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractRelationJlyz.getContractIdSg(), new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
+                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? GROUP BY wbs_id) as a)"
+                                            , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractRelationJlyz.getContractIdSg());
                                     if (queryInfoList.size() > 0) {
                                         JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
                                         redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_1", JSON.toJSON(array).toString());
                                     }
                                 } else {
-                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractRelationJlyz.getContractIdSg() + " and classify = " + tableOwner, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
+                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? AND classify = ? GROUP BY wbs_id) as a)"
+                                            , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractRelationJlyz.getContractIdSg(), tableOwner);
                                     if (queryInfoList.size() > 0) {
                                         JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
                                         redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_" + tableOwner, JSON.toJSON(array).toString());