组织管理,架构图树排序、BUG修复
This commit is contained in:
parent
ea4a3201aa
commit
9a6f0a845e
|
|
@ -34,4 +34,8 @@ public class CompanyTreePO {
|
|||
public String getKey() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.entity.chart;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -25,12 +26,16 @@ public class TreeSelect {
|
|||
public static final String SUB_COMPANY = "1";
|
||||
public static final String DEPARTMENT = "2";
|
||||
|
||||
@JSONField(ordinal = 1)
|
||||
private String key;
|
||||
private String id;
|
||||
@JSONField(ordinal = 2)
|
||||
private String title;
|
||||
@JSONField(ordinal = 3)
|
||||
private String id;
|
||||
@JSONField(ordinal = 4)
|
||||
private List<TreeSelect> children;
|
||||
private String type;
|
||||
private String canceled;
|
||||
private List<TreeSelect> children;
|
||||
private boolean disabled;
|
||||
|
||||
private String cancelSql;
|
||||
|
|
@ -42,24 +47,24 @@ public class TreeSelect {
|
|||
children = new ArrayList<>();
|
||||
RecordSet rs = new RecordSet();
|
||||
if (COMPANY.equals(type)) {
|
||||
String sql = "select id ,subcompanyname ,canceled from hrmsubcompany where " + getCancelSqlStr() + " and (supsubcomid is null or supsubcomid = 0) and companyid = ? order by showorder";
|
||||
String sql = "select id ,subcompanyname ,canceled from hrmsubcompany where " + getCancelSqlStr() + " and (supsubcomid is null or supsubcomid = 0) and companyid = ? order by showorder,id";
|
||||
rs.executeQuery(sql, key);
|
||||
while (rs.next()) {
|
||||
children.add(TreeSelect.builder().key(rs.getString("id")).title(rs.getString("subcompanyname")).canceled(rs.getString("canceled")).type(SUB_COMPANY).cancelSql(cancelSql).build());
|
||||
}
|
||||
} else if (SUB_COMPANY.equals(type)) {
|
||||
String sql = "select id ,subcompanyname ,canceled from hrmsubcompany where " + getCancelSqlStr() + " and supsubcomid = ? order by showorder";
|
||||
String sql = "select id ,subcompanyname ,canceled from hrmsubcompany where " + getCancelSqlStr() + " and supsubcomid = ? order by showorder,id";
|
||||
rs.executeQuery(sql, key);
|
||||
while (rs.next()) {
|
||||
children.add(TreeSelect.builder().key(rs.getString("id")).title(rs.getString("subcompanyname")).canceled(rs.getString("canceled")).type(SUB_COMPANY).cancelSql(cancelSql).build());
|
||||
}
|
||||
sql = "select id,departmentname ,canceled from hrmdepartment where " + getCancelSqlStr() + " and (supdepid is null or supdepid =0) and subcompanyid1 = ? order by showorder";
|
||||
sql = "select id,departmentname ,canceled from hrmdepartment where " + getCancelSqlStr() + " and (supdepid is null or supdepid =0) and subcompanyid1 = ? order by showorder,id";
|
||||
rs.executeQuery(sql, key);
|
||||
while (rs.next()) {
|
||||
children.add(TreeSelect.builder().key(rs.getString("id")).title(rs.getString("departmentname")).canceled(rs.getString("canceled")).type(DEPARTMENT).cancelSql(cancelSql).build());
|
||||
}
|
||||
} else if (DEPARTMENT.equals(type)) {
|
||||
String sql = "select id,departmentname ,canceled from hrmdepartment where " + getCancelSqlStr() + " and supdepid = ? order by showorder";
|
||||
String sql = "select id,departmentname ,canceled from hrmdepartment where " + getCancelSqlStr() + " and supdepid = ? order by showorder,id";
|
||||
rs.executeQuery(sql, key);
|
||||
while (rs.next()) {
|
||||
children.add(TreeSelect.builder().key(rs.getString("id")).title(rs.getString("departmentname")).canceled(rs.getString("canceled")).type(DEPARTMENT).cancelSql(cancelSql).build());
|
||||
|
|
@ -83,7 +88,7 @@ public class TreeSelect {
|
|||
}
|
||||
|
||||
public String getId() {
|
||||
return key;
|
||||
return getKey();
|
||||
}
|
||||
|
||||
public String getCanceled() {
|
||||
|
|
|
|||
|
|
@ -476,15 +476,17 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
@Override
|
||||
public Map<String, Object> getMovingTree(Map<String, Object> params) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id,companyname from hrmcompany");
|
||||
TreeSelect companyTree = null;
|
||||
List<String> expandedKeys = new ArrayList<>();
|
||||
String canceled = Util.null2String(params.get("canceled"));
|
||||
rs.executeQuery("select id,subcompanyname,canceled from hrmsubcompany where (canceled is null or canceled != 1) and (supsubcomid is null or supsubcomid = 0) order by showorder");
|
||||
List<TreeSelect> movingTrees = new ArrayList<>();
|
||||
while(rs.next()){
|
||||
movingTrees.add(TreeSelect.builder().key(rs.getString("id")).title(rs.getString("subcompanyname")).type(TreeSelect.SUB_COMPANY).cancelSql(canceled).build());
|
||||
if(rs.next()){
|
||||
companyTree = TreeSelect.builder().key(rs.getString("id")).title(rs.getString("companyname")).type(TreeSelect.COMPANY).cancelSql(canceled).build();
|
||||
expandedKeys.add(companyTree.getKey());
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("movingTree", movingTrees);
|
||||
result.put("expandedKeys", movingTrees.stream().filter(item -> CollectionUtils.isNotEmpty(item.getChildren())).map(TreeSelect::getKey).collect(Collectors.toList()));
|
||||
result.put("movingTree", Collections.singletonList(companyTree));
|
||||
result.put("expandedKeys", expandedKeys);
|
||||
result.put("api_status", true);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1288,6 +1290,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
if (isCurrentDimension) {
|
||||
sql = "select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, " + dbType.concat("d", "supdepid") + " as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepid", "0") + " = " + subCompany;
|
||||
}
|
||||
sql += " order by showorder,id ";
|
||||
} else {
|
||||
sql = "select " + dbType.concat("d", "departmentid") + "as id, departmentid as value, departmentname as title, " + dbType.concat("d", "supdepartmentid") + " as pId from jcl_chart_department where (canceled is null or canceled != '1') and " + dbType.ifNull("supdepartmentid", "0") + " = " + subCompany;
|
||||
if (isCurrentDimension) {
|
||||
|
|
@ -1298,18 +1301,19 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
}
|
||||
} else {
|
||||
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.ifNull("supsubcomid", "0") + " = " + subCompany +
|
||||
" union select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartment where (canceled is null or canceled != '1') and " + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
|
||||
sql = "select id as id, id as value, subcompanyname as title, supsubcomid as pId, showorder from hrmsubcompany where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcomid", "0") + " = " + subCompany +
|
||||
" union select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, subcompanyid1 as pId, showorder from hrmdepartment where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and " + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
|
||||
if (isCurrentDimension) {
|
||||
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.ifNull("supsubcomid", "0") + " = " + subCompany + " and companyid = '" + dimension + "' " +
|
||||
" union select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
|
||||
" union select " + dbType.concat("d", "id") + "as id, id as value, departmentname as title, subcompanyid1 as pId from hrmdepartmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" + dbType.ifNull("subcompanyid1", "0") + " = " + subCompany;
|
||||
}
|
||||
sql += " order by showorder,id ";
|
||||
} else {
|
||||
sql = "select subcompanyid as id, subcompanyid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompany where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcompanyid", "0") + " = " + subCompany +
|
||||
" union select " + dbType.concat("d", "subcompanyid") + "as id, subcompanyid as value, departmentname as title, subcompanyid as pId from jcl_chart_department where (canceled is null or canceled != '1') and " + dbType.ifNull("subcompanyid", "0") + " = " + subCompany;
|
||||
" union select " + dbType.concat("d", "subcompanyid") + "as id, subcompanyid as value, departmentname as title, subcompanyid as pId from jcl_chart_department where (canceled is null or canceled != '1') and (supdepartmentid is null or supdepartmentid =0) and " + dbType.ifNull("subcompanyid", "0") + " = " + subCompany;
|
||||
if (isCurrentDimension) {
|
||||
sql = "select subcompanyvirtualid as id, subcompanyvirtualid as value, subcompanyname as title, supsubcompanyid as pId from jcl_chart_subcompanyvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("supsubcompanyid", "0") + " = " + subCompany + " and companyid = '" + dimension + "' " +
|
||||
" union select " + dbType.concat("d", "departmentvirtualid") + "as id, departmentvirtualid as value, departmentname as title, subcompanyid as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and " + dbType.ifNull("subcompanyid", "0") + " = " + subCompany;
|
||||
" union select " + dbType.concat("d", "departmentvirtualid") + "as id, departmentvirtualid as value, departmentname as title, subcompanyid as pId from jcl_chart_departmentvirtual where (canceled is null or canceled != '1') and (supdepid is null or supdepid =0) and" + dbType.ifNull("subcompanyid", "0") + " = " + subCompany;
|
||||
}
|
||||
// 添加时间轴条件
|
||||
sql += " and versionid = " + versionId;
|
||||
|
|
|
|||
Loading…
Reference in New Issue