Merge pull request '切换维度 treeselect修复' (#230) from feature/cl into develop

Reviewed-on: #230
pull/231/head
liang.cheng 1 year ago
commit 4110238528

@ -98,14 +98,18 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
// 是否展示当前数据 // 是否展示当前数据
boolean isSearchCurrent = StringUtils.isBlank(id) || "0".equals(id); boolean isSearchCurrent = StringUtils.isBlank(id) || "0".equals(id);
String sql; String sql;
String judgeTreeLeafSql;
if (isSearchCurrent) { if (isSearchCurrent) {
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? "; sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? ";
boolean isRealDimension = StringUtils.isBlank(fclass) || "0".equals(fclass); boolean isRealDimension = StringUtils.isBlank(fclass) || "0".equals(fclass);
boolean isRealTime = StringUtils.isBlank(id) || "0".equals(id); boolean isRealTime = StringUtils.isBlank(id) || "0".equals(id);
judgeTreeLeafSql = sql;
if (isRealTime && user.getUID() != 1 && isRealDimension) { if (isRealTime && user.getUID() != 1 && isRealDimension) {
DetachUtil detachUtil = new DetachUtil(user); DetachUtil detachUtil = new DetachUtil(user);
String ids = detachUtil.getJclRoleLevels(); String ids = detachUtil.getJclRoleLevels();
sql = sql + " and id in ("+ids+")"; if ("0".equals(subcompany)) {
sql = sql + " and id in ("+ids+")";
}
} }
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) { if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? and companyid = '" + fclass + "'"; sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = ? and companyid = '" + fclass + "'";
@ -117,10 +121,11 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
} }
// 添加时间轴条件 // 添加时间轴条件
sql += " and versionid = " + id; sql += " and versionid = " + id;
judgeTreeLeafSql = sql;
} }
rs.executeQuery(sql,subcompany); rs.executeQuery(sql,subcompany);
while (rs.next()) { while (rs.next()) {
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(sql, rs.getString("id"))).build()); companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).isLeaf(judgeTreeLeaf(judgeTreeLeafSql, rs.getString("id"))).build());
} }
result.put("companyTree", companyTree); result.put("companyTree", companyTree);
return result; return result;

Loading…
Cancel
Save