|
@@ -712,11 +712,23 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
throw new ServiceException("Param error,tableOwner cannot be empty");
|
|
|
}
|
|
|
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(contractId)) {
|
|
|
- ContractInfo contractInfo = jdbcTemplate.query("SELECT contract_name,contract_type FROM m_contract_info WHERE id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
+ ContractInfo contractInfo = jdbcTemplate.query("SELECT contract_name,contract_type FROM m_contract_info WHERE id = " + contractId,
|
|
|
+ new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (contractInfo != null) {
|
|
|
/* =========================== 施工合同段 =========================== */
|
|
|
if (new Integer(1).equals(contractInfo.getContractType())) {
|
|
|
- String sql = "select is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,is_concrete,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.node_type != 111 and a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (org.apache.commons.lang.StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + contractId + " ORDER BY a.sort,title,a.create_time";
|
|
|
+ String sql = "SELECT is_custom,p_key_id,contract_id," +
|
|
|
+ "(SELECT id FROM u_contract_tree_drawings WHERE process_id = p_key_id AND is_deleted = 0 limit 1) AS drawingsId," +
|
|
|
+ "id,parent_id,node_type,type,wbs_type,is_concrete,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node," +
|
|
|
+ "CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) " +
|
|
|
+ "WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 AND is_custom = 1) AS isCustomChild " +
|
|
|
+ "FROM m_wbs_tree_contract a WHERE a.node_type != 111 AND a.type = 1 AND a.status = 1 AND a.is_deleted = 0 " +
|
|
|
+ "AND parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " AND contract_id = " + contractId + " " +
|
|
|
+ "ORDER BY a.sort,title,a.create_time";
|
|
|
List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
if (lazyNodes.size() > 0) {
|
|
|
/*获取当前合同段节点本地缓存信息*/
|
|
@@ -815,7 +827,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
contractIds.add(contractIdRelation);
|
|
|
} else {
|
|
|
//根节点时默认加载所有施工合同段的树
|
|
|
- List<ContractRelationJlyz> query = jdbcTemplate.query("SELECT contract_id_sg FROM m_contract_relation_jlyz WHERE contract_id_jlyz = " + contractId, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
+ List<ContractRelationJlyz> query = jdbcTemplate.query("SELECT contract_id_sg FROM m_contract_relation_jlyz WHERE contract_id_jlyz = " + contractId,
|
|
|
+ new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
if (query.size() > 0) {
|
|
|
contractIds = query.stream().map(ContractRelationJlyz::getContractIdSg).map(String::valueOf).collect(Collectors.toList());
|
|
|
}
|
|
@@ -824,9 +837,22 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
return null;
|
|
|
}
|
|
|
for (String sgContractId : contractIds) {
|
|
|
- ContractInfo sgContractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + sgContractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
+ ContractInfo sgContractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + sgContractId,
|
|
|
+ new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (sgContractInfo != null) {
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.node_type != 111 and a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (org.apache.commons.lang.StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + sgContractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ String sql = "SELECT is_custom,p_key_id,contract_id," +
|
|
|
+ "(SELECT id FROM u_contract_tree_drawings WHERE process_id = p_key_id AND is_deleted = 0 limit 1) AS drawingsId," +
|
|
|
+ "id,parent_id,node_type,type,wbs_type,is_concrete,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node," +
|
|
|
+ "CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) " +
|
|
|
+ "WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 AND is_custom = 1) AS isCustomChild " +
|
|
|
+ "FROM m_wbs_tree_contract a WHERE a.node_type != 111 AND a.type = 1 AND a.status = 1 AND a.is_deleted = 0 " +
|
|
|
+ "AND parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " AND contract_id = " + sgContractId + " " +
|
|
|
+ "ORDER BY a.sort,title,a.create_time";
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
if (lazyNodes.size() > 0) {
|
|
|
List<WbsTreeContractLazyVO> nodesAll = this.getNodeAll(sgContractId);
|
|
|
List<WbsTreeContractLazyVO> distinctNodesAll = nodesAll.stream()
|
|
@@ -976,11 +1002,22 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
|
|
|
@Override
|
|
|
public List<WbsTreeContractLazyVO> queryContractWbsTreeByFirstInfo(String parentId, String contractId, String contractIdRelation) {
|
|
|
- ContractInfo contractInfo = jdbcTemplate.query("SELECT contract_name,contract_type FROM m_contract_info WHERE id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
+ ContractInfo contractInfo = jdbcTemplate.query("SELECT contract_name,contract_type FROM m_contract_info WHERE id = " + contractId,
|
|
|
+ new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (contractInfo != null) {
|
|
|
if (new Integer(1).equals(contractInfo.getContractType())) {
|
|
|
if (ObjectUtil.isEmpty(parentId)) {
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where parent_id = 0 AND contract_id = " + contractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("SELECT is_custom,p_key_id,contract_id," +
|
|
|
+ "(SELECT id FROM u_contract_tree_drawings WHERE process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId," +
|
|
|
+ "id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node," +
|
|
|
+ "CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) " +
|
|
|
+ "WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 " +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 AND is_custom = 1) AS isCustomChild " +
|
|
|
+ "FROM m_wbs_tree_contract a WHERE parent_id = 0 AND contract_id = " + contractId + " ORDER BY a.sort,title,a.create_time",
|
|
|
+ new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
for (WbsTreeContractLazyVO lazyNode : lazyNodes) {
|
|
|
lazyNode.setTitle(contractInfo.getContractName());
|
|
|
lazyNode.setType(lazyNode.getNodeType());
|
|
@@ -989,7 +1026,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
}
|
|
|
return lazyNodes;
|
|
|
}
|
|
|
- List<TreeContractFirst> query = jdbcTemplate.query("SELECT wbs_node_id FROM u_tree_contract_first WHERE is_deleted = 0 AND status = 1 AND contract_id = " + contractId, new BeanPropertyRowMapper<>(TreeContractFirst.class));
|
|
|
+ List<TreeContractFirst> query = jdbcTemplate.query("SELECT wbs_node_id FROM u_tree_contract_first WHERE is_deleted = 0 AND status = 1 " +
|
|
|
+ "AND contract_id = " + contractId, new BeanPropertyRowMapper<>(TreeContractFirst.class));
|
|
|
if (query.size() > 0) {
|
|
|
List<WbsTreeContractLazyVO> nodeAll = this.getNodeAll(contractId);
|
|
|
List<Long> nodeIds = query.stream().map(TreeContractFirst::getWbsNodeId).collect(Collectors.toList());
|
|
@@ -997,7 +1035,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
List<WbsTreeContractLazyVO> collect = firstNodes.stream().filter(f -> f.getParentId().equals(Long.parseLong(parentId))).collect(Collectors.toList());
|
|
|
List<Long> pKeyIds = collect.stream().map(WbsTreeContractLazyVO::getPKeyId).collect(Collectors.toList());
|
|
|
if (pKeyIds.size() > 0) {
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where p_key_id IN (" + StringUtils.join(pKeyIds, ",") + ") ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("SELECT is_custom,p_key_id,contract_id," +
|
|
|
+ "(SELECT id FROM u_contract_tree_drawings WHERE process_id = p_key_id AND is_deleted = 0 limit 1) AS drawingsId," +
|
|
|
+ "id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node," +
|
|
|
+ "CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) " +
|
|
|
+ "WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 " +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 ) AS hasChildren," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + contractId + " AND b.is_deleted = 0 AND is_custom = 1) AS isCustomChild " +
|
|
|
+ "FROM m_wbs_tree_contract a WHERE p_key_id IN (" + StringUtils.join(pKeyIds, ",") + ") ORDER BY a.sort,title,a.create_time",
|
|
|
+ new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
if (lazyNodes.size() > 0) {
|
|
|
for (WbsTreeContractLazyVO lazyNodeVO : lazyNodes) {
|
|
|
lazyNodeVO.setType(lazyNodeVO.getNodeType());
|
|
@@ -1015,7 +1063,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
if (ObjectUtil.isNotEmpty(contractIdRelation) && ObjectUtil.isNotEmpty(parentId)) {
|
|
|
contractIds.add(contractIdRelation);
|
|
|
} else {
|
|
|
- List<ContractRelationJlyz> query = jdbcTemplate.query("SELECT contract_id_sg FROM m_contract_relation_jlyz WHERE contract_id_jlyz = " + contractId, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
+ List<ContractRelationJlyz> query = jdbcTemplate.query("SELECT contract_id_sg FROM m_contract_relation_jlyz WHERE contract_id_jlyz = " + contractId,
|
|
|
+ new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
|
|
|
if (query.size() > 0) {
|
|
|
contractIds = query.stream().map(ContractRelationJlyz::getContractIdSg).map(String::valueOf).collect(Collectors.toList());
|
|
|
}
|
|
@@ -1024,10 +1073,12 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
return null;
|
|
|
}
|
|
|
for (String sgContractId : contractIds) {
|
|
|
- ContractInfo sgContractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + sgContractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
+ ContractInfo sgContractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + sgContractId,
|
|
|
+ new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (sgContractInfo != null) {
|
|
|
if (ObjectUtil.isNotEmpty(parentId)) {
|
|
|
- List<TreeContractFirst> query = jdbcTemplate.query("SELECT wbs_node_id FROM u_tree_contract_first WHERE is_deleted = 0 AND status = 1 AND contract_id = " + sgContractId, new BeanPropertyRowMapper<>(TreeContractFirst.class));
|
|
|
+ List<TreeContractFirst> query = jdbcTemplate.query("SELECT wbs_node_id FROM u_tree_contract_first WHERE is_deleted = 0 AND status = 1 " +
|
|
|
+ "AND contract_id = " + sgContractId, new BeanPropertyRowMapper<>(TreeContractFirst.class));
|
|
|
if (query.size() > 0) {
|
|
|
List<WbsTreeContractLazyVO> nodeAll = this.getNodeAll(sgContractId);
|
|
|
List<Long> nodeIds = query.stream().map(TreeContractFirst::getWbsNodeId).collect(Collectors.toList());
|
|
@@ -1035,7 +1086,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
List<WbsTreeContractLazyVO> collect = firstNodes.stream().filter(f -> f.getParentId().equals(Long.parseLong(parentId))).collect(Collectors.toList());
|
|
|
List<Long> pKeyIds = collect.stream().map(WbsTreeContractLazyVO::getPKeyId).collect(Collectors.toList());
|
|
|
if (pKeyIds.size() > 0) {
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where p_key_id IN (" + StringUtils.join(pKeyIds, ",") + ") ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("SELECT is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings " +
|
|
|
+ "WHERE process_id = p_key_id AND is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type," +
|
|
|
+ "partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf " +
|
|
|
+ "WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst," +
|
|
|
+ "IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 " +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 AND is_custom = 1) AS isCustomChild " +
|
|
|
+ "FROM m_wbs_tree_contract a WHERE p_key_id IN (" + StringUtils.join(pKeyIds, ",") + ") " +
|
|
|
+ "ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
if (lazyNodes.size() > 0) {
|
|
|
for (WbsTreeContractLazyVO lazyNodeVO : lazyNodes) {
|
|
|
lazyNodeVO.setType(lazyNodeVO.getNodeType());
|
|
@@ -1048,7 +1109,17 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id and is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 and b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where parent_id = 0 AND contract_id = " + sgContractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
+ List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("SELECT is_custom,p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings " +
|
|
|
+ "WHERE process_id = p_key_id AND is_deleted = 0 limit 1) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type," +
|
|
|
+ "partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf " +
|
|
|
+ "WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst," +
|
|
|
+ "IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1 " +
|
|
|
+ "AND b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren," +
|
|
|
+ "(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND b.type = 1" +
|
|
|
+ " AND b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 AND is_custom = 1) AS isCustomChild " +
|
|
|
+ "FROM m_wbs_tree_contract a WHERE parent_id = 0 AND contract_id = " + sgContractId + " ORDER BY a.sort,title,a.create_time",
|
|
|
+ new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
|
|
|
for (WbsTreeContractLazyVO lazyNode : lazyNodes) {
|
|
|
lazyNode.setTitle(sgContractInfo.getContractName());
|
|
|
lazyNode.setType(lazyNode.getNodeType());
|