兼容Oracle
This commit is contained in:
parent
1318fc1aba
commit
e4d9d80fee
|
|
@ -10,19 +10,33 @@ vleader int;
|
|||
vdatebegin date;
|
||||
vplan int;
|
||||
vonjob int;
|
||||
vcnt int;
|
||||
begin
|
||||
if :new.companyname!=:old.companyname then
|
||||
select to_number(fvalue) into vleader from jcl_info where id=1;
|
||||
|
||||
select count(1) into vcnt from jcl_info where id=1;
|
||||
if vcnt=1 then
|
||||
select to_number(fvalue) into vleader from jcl_info where id=1;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmresource where id=vleader;
|
||||
if vcnt=1 then
|
||||
select messagerurl,lastname,jobtitle into vleaderimg,vleadername,vleaderjobid
|
||||
from hrmresource where id=vleader;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmjobtitles where id=vleaderjobid;
|
||||
if vcnt=1 then
|
||||
select jobtitlemark into vleaderjob from hrmjobtitles where id=vleaderjobid;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=vleader;
|
||||
if vcnt=1 then
|
||||
select nvl(field100008,''),nvl(field100007,'') into vleaderst,vleaderlv from cus_fielddata
|
||||
where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=vleader;
|
||||
end if;
|
||||
|
||||
vdatebegin:=sysdate;
|
||||
vdatebegin:=sysdate;
|
||||
|
||||
select sum(nvl(staff_num,0)) into vplan from JCL_ORG_STAFF
|
||||
where plan_id in (select id from JCL_ORG_STAFFPLAN where time_start<=vdatebegin and time_end>=vdatebegin);
|
||||
|
|
@ -60,6 +74,7 @@ vdatebegin date;
|
|||
vobjparentid int;
|
||||
vplan int;
|
||||
vonjob int;
|
||||
vcnt int;
|
||||
begin
|
||||
if :new.comp_name!=:old.comp_name or :new.comp_principal!=:old.comp_principal or :new.parent_company!=:old.parent_company
|
||||
or :new.forbidden_tag!=:old.forbidden_tag or :new.DELETE_TYPE!=:old.DELETE_TYPE then
|
||||
|
|
@ -68,13 +83,28 @@ begin
|
|||
vparentid:=nvl(:new.parent_company,0);
|
||||
vobjparentid:=nvl(:new.parent_company,0);
|
||||
|
||||
select count(1) into vcnt from HrmSubCompany where uuid=:new.uuid;
|
||||
if vcnt=1 then
|
||||
select id into vecid from HrmSubCompany where uuid=:new.uuid;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmresource where id=:new.comp_principal;
|
||||
if vcnt=1 then
|
||||
select messagerurl,lastname,jobtitle into vleaderimg,vleadername,vleaderjobid from hrmresource where id=:new.comp_principal;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmjobtitles where id=vleaderjobid;
|
||||
if vcnt=1 then
|
||||
select jobtitlemark into vleaderjob from hrmjobtitles where id=vleaderjobid;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.comp_principal;
|
||||
if vcnt=1 then
|
||||
select nvl(field100008,''),nvl(field100007,'') into vleaderst,vleaderlv from cus_fielddata
|
||||
where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.comp_principal;
|
||||
select sum(nvl(staff_num,0)) into vplan from JCL_ORG_STAFF
|
||||
where plan_id in (select id from JCL_ORG_STAFFPLAN where time_start<=vdatebegin and time_end>=vdatebegin) and comp_id=:new.id;
|
||||
end if;
|
||||
|
||||
select sum(nvl(staff_num,0)) into vplan from JCL_ORG_STAFF;
|
||||
select count(1) into vonjob from hrmresource where status<=3 and subcompanyid1=vecid;
|
||||
|
||||
delete from jcl_org_map where ftype=1 and fobjid=:new.id and fdatebegin=vdatebegin;
|
||||
|
|
@ -108,6 +138,7 @@ st int;
|
|||
vleaderlv VARCHAR2(255);
|
||||
vplan int;
|
||||
vonjob int;
|
||||
vcnt int;
|
||||
begin
|
||||
if :new.dept_name!=:old.dept_name or :new.dept_principal!=:old.dept_principal or :new.parent_comp!=:old.parent_comp
|
||||
or :new.parent_dept!=:old.parent_dept or :new.forbidden_tag!=:old.forbidden_tag or :new.DELETE_TYPE!=:old.DELETE_TYPE then
|
||||
|
|
@ -126,15 +157,28 @@ else
|
|||
vobjparentid:=:new.parent_dept+st;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from HrmDepartment where uuid=:new.uuid;
|
||||
if vcnt=1 then
|
||||
select id into vecid from HrmDepartment where uuid=:new.uuid;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmresource where id=:new.dept_principal;
|
||||
if vcnt=1 then
|
||||
select messagerurl,lastname,jobtitle into vleaderimg,vleadername,veaderjobid
|
||||
from hrmresource where id=:new.dept_principal;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmjobtitles where id=:new.dept_principal;
|
||||
if vcnt=1 then
|
||||
select jobtitlemark into vleaderjob from hrmjobtitles where id=:new.dept_principal;
|
||||
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.dept_principal;
|
||||
if vcnt=1 then
|
||||
select nvl(field100008,''),nvl(field100007,'') into vleaderst,vleaderlv from cus_fielddata
|
||||
where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.dept_principal;
|
||||
end if;
|
||||
|
||||
select sum(nvl(staff_num,0)) into vplan from JCL_ORG_STAFF
|
||||
where plan_id in (select id from JCL_ORG_STAFFPLAN where time_start<=vdatebegin and time_end>=vdatebegin) and dept_id=:new.id;
|
||||
|
|
@ -215,6 +259,7 @@ st int;
|
|||
vleaderlv VARCHAR2(255);
|
||||
vstr VARCHAR2(255);
|
||||
vwz int;
|
||||
vcnt int;
|
||||
begin
|
||||
if :new.lastname!=:old.lastname or :new.status!=:old.status then
|
||||
st:=100000000;
|
||||
|
|
@ -227,18 +272,30 @@ begin
|
|||
else
|
||||
vdelete:=1;
|
||||
end if;
|
||||
select jobtitlemark into vleaderjob from hrmjobtitles where id=:new.jobtitle;
|
||||
|
||||
select count(1) into vcnt from hrmjobtitles where id=:new.jobtitle;
|
||||
if vcnt=1 then
|
||||
select jobtitlemark into vleaderjob from hrmjobtitles where id=:new.jobtitle;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.id;
|
||||
if vcnt=1 then
|
||||
select nvl(field100008,''),nvl(field100007,'') into vleaderst,vleaderlv from cus_fielddata
|
||||
where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.id;
|
||||
end if;
|
||||
|
||||
delete from jcl_org_map where ftype=4 and fobjid=:new.id and fdatebegin=vdatebegin;
|
||||
|
||||
update jcl_org_map set fdateend=vdatebegin-1 where ftype=4 and fobjid=:new.id and fdateend>vdatebegin;
|
||||
|
||||
|
||||
select nvl(field100002,'') into vstr from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.id;
|
||||
vwz:=Instr(vstr,'_');
|
||||
|
||||
select count(1) into vcnt from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=:new.id;
|
||||
if vcnt=1 then
|
||||
select nvl(field100002,'') into vstr from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=:new.id;
|
||||
end if;
|
||||
|
||||
vwz:=Instr(vstr,'_');
|
||||
vobjparentid:=to_number(substr(vstr,vwz+1,length(vstr)-vwz));
|
||||
vparentid:=vobjparentid+sj;
|
||||
|
||||
|
|
@ -274,6 +331,7 @@ st int;
|
|||
vleaderlv VARCHAR2(255);
|
||||
vstr VARCHAR2(255);
|
||||
vwz int;
|
||||
vcnt int;
|
||||
begin
|
||||
if :new.field100002!=:old.field100002 then
|
||||
st:=100000000;
|
||||
|
|
@ -281,19 +339,28 @@ begin
|
|||
sk:=300000000;
|
||||
vdatebegin:=to_date(sysdate);
|
||||
|
||||
|
||||
select count(1) into vcnt from hrmresource where id=:new.id;
|
||||
if vcnt=1 then
|
||||
select workcode,lastname,case when status<=3 then 0 else 1 end,messagerurl,lastname,jobtitle,uuid
|
||||
into vnumber,vname,vdelete,vleaderimg,vleadername,vleaderjobid,vuuid from hrmresource where id=:new.id;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from hrmjobtitles where id=vleaderjobid;
|
||||
if vcnt=1 then
|
||||
select jobtitlemark into vleaderjob from hrmjobtitles where id=vleaderjobid;
|
||||
end if;
|
||||
|
||||
select count(1) into vcnt from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.id;
|
||||
if vcnt=1 then
|
||||
select nvl(field100008,''),nvl(field100007,'') into vleaderst,vleaderlv from cus_fielddata
|
||||
where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=:new.id;
|
||||
end if;
|
||||
|
||||
vstr:=nvl(:new.field100002,'');
|
||||
vstr:=nvl(:new.field100002,'');
|
||||
vwz:=Instr(vstr,'_');
|
||||
vobjparentid:=to_number(substr(vstr,vwz+1,length(vstr)-vwz));
|
||||
vparentid:=vobjparentid+sj;
|
||||
|
||||
delete from jcl_org_map where ftype=4 and fobjid=:new.id and fdatebegin=vdatebegin;
|
||||
update jcl_org_map set fdateend=vdatebegin-1 where ftype=4 and fobjid=:new.id and fdateend>vdatebegin;
|
||||
if vdelete=0 then
|
||||
|
|
|
|||
|
|
@ -317,8 +317,8 @@
|
|||
|
||||
<select id="listCompsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
comp_name as name
|
||||
id as "id",
|
||||
comp_name as "name"
|
||||
from jcl_org_comp t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@
|
|||
|
||||
<select id="listDeptsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
dept_name as name
|
||||
id as "id",
|
||||
dept_name as "name"
|
||||
from jcl_org_dept t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -396,8 +396,8 @@
|
|||
</select>
|
||||
<select id="listJobsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
job_name as name
|
||||
id as "id",
|
||||
job_name as "name"
|
||||
from jcl_org_job t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@
|
|||
|
||||
<select id="listPostInfosByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
post_info_name as name
|
||||
id as "id",
|
||||
post_info_name as "name"
|
||||
from jcl_org_post_info t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
<!-- 浏览按钮赋值、展示用 -->
|
||||
<select id="listPostsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
post_name as name
|
||||
id as "id",
|
||||
post_name as "name"
|
||||
from jcl_org_post t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@
|
|||
</select>
|
||||
<select id="listGradessByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
grade_name as name
|
||||
id as "id",
|
||||
grade_name as "name"
|
||||
from jcl_org_grade t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@
|
|||
|
||||
<select id="listLevelsByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
level_name as name
|
||||
id as "id",
|
||||
level_name as "name"
|
||||
from jcl_org_level t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@
|
|||
</select>
|
||||
<select id="listSchemesByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
scheme_name as name
|
||||
id as "id",
|
||||
scheme_name as "name"
|
||||
from jcl_org_scheme t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@
|
|||
|
||||
<select id="listSequencesByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
sequence_name as name
|
||||
id as "id",
|
||||
sequence_name as "name"
|
||||
from jcl_org_sequence t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@
|
|||
</select>
|
||||
<select id="listPlansByIds" resultType="java.util.Map">
|
||||
select
|
||||
id,
|
||||
plan_name as name
|
||||
id as "id",
|
||||
plan_name as "name"
|
||||
from jcl_org_staffplan t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateField;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.service.OrgChartService;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -31,7 +32,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
defaultItem.put("id", "0");
|
||||
defaultItem.put("companyname", "行政维度");
|
||||
fclasslist.add(defaultItem);
|
||||
while(rs.next()) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("companyname", rs.getString("companyname"));
|
||||
|
|
@ -42,7 +43,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
List<Map<String, Object>> companylist = new ArrayList<>();
|
||||
Map<String, Object> defaultCompanyItem = new HashMap<>();
|
||||
companylist.add(defaultCompanyItem);
|
||||
while(rs.next()) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("fnumber", rs.getString("fnumber"));
|
||||
|
|
@ -57,26 +58,29 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
private String companyDateWhereSql(Map<String, Object> request2Map) {
|
||||
String date = (String) request2Map.get("date"); // 数据日期
|
||||
if(StringUtils.isBlank(date)) {
|
||||
date = DateUtil.format( DateUtil.offset(new Date() , DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd");
|
||||
if (StringUtils.isBlank(date)) {
|
||||
date = DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
String fclass = (String) request2Map.get("fclass"); // 维度
|
||||
|
||||
|
||||
|
||||
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
|
||||
if(StringUtils.isBlank(fisvitual)) {
|
||||
if (StringUtils.isBlank(fisvitual)) {
|
||||
fisvitual = "0";
|
||||
}
|
||||
|
||||
String whereSql = " where 1 = 1 ";
|
||||
whereSql += " and ((fdatebegin <= '"+ date +"' and fdateend >= '"+ date +"') or (fdatebegin <= '"+ date +"' and fdateend is null )) ";
|
||||
whereSql += " and fclass = " + fclass +" ";
|
||||
if (DBType.isOracle()) {
|
||||
whereSql += " and ((fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and fdateend >= to_date('" + date + "','yyyy-MM-DD')) or (fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and fdateend is null )) ";
|
||||
} else {
|
||||
whereSql += " and ((fdatebegin <= '" + date + "' and fdateend >= '" + date + "') or (fdatebegin <= '" + date + "' and fdateend is null )) ";
|
||||
}
|
||||
whereSql += " and fclass = " + fclass + " ";
|
||||
|
||||
if("0".equals(fisvitual)) {
|
||||
if ("0".equals(fisvitual)) {
|
||||
whereSql += " and fisvitual = 0 ";
|
||||
}else {
|
||||
} else {
|
||||
whereSql += " and fisvitual in (0, 1) ";
|
||||
}
|
||||
|
||||
|
|
@ -89,16 +93,16 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
String root = (String) request2Map.get("root"); // 根节点
|
||||
String level = (String) request2Map.get("level"); // 显示层级
|
||||
if(StringUtils.isBlank(level)) {
|
||||
if (StringUtils.isBlank(level)) {
|
||||
level = "3";
|
||||
}
|
||||
String whereSql = companyDateWhereSql(request2Map);
|
||||
|
||||
String whereItemSql = " ";
|
||||
if("0".equals(root)) { // 集团的情况
|
||||
if ("0".equals(root)) { // 集团的情况
|
||||
whereItemSql += " and ftype = 0 ";
|
||||
} else {
|
||||
whereItemSql += " and id = '" + root +"' ";
|
||||
whereItemSql += " and id = '" + root + "' ";
|
||||
}
|
||||
|
||||
// 获取根节点
|
||||
|
|
@ -106,7 +110,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber from jcl_org_map " + whereSql + whereItemSql);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
String id = null;
|
||||
if(rs.next()) {
|
||||
if (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
id = rs.getString("id");
|
||||
item.put("id", rs.getString("id"));
|
||||
|
|
@ -120,7 +124,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
int currentLevel = 1;
|
||||
if(currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
if (currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
findCompanyItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, true);
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +137,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber from jcl_org_map " + whereSql + " and fparentid = " + id);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while(rs.next()) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("fname", rs.getString("fname"));
|
||||
|
|
@ -148,9 +152,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
list.addAll(currentList);
|
||||
|
||||
for (Map<String, Object> stringObjectMap : currentList) {
|
||||
if(currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
if (currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
findCompanyItemByParantId((String) stringObjectMap.get("id"), currentLevel + 1, level, rs, list, whereSql, true);
|
||||
} else if(currentLevel == Integer.parseInt(level)) {
|
||||
} else if (currentLevel == Integer.parseInt(level)) {
|
||||
findCompanyItemByParantId((String) stringObjectMap.get("id"), currentLevel + 1, level, rs, list, whereSql, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -159,25 +163,29 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
private String userWhereSql(Map<String, Object> request2Map) {
|
||||
String date = (String) request2Map.get("date"); // 数据日期
|
||||
if(StringUtils.isBlank(date)) {
|
||||
date = DateUtil.format( DateUtil.offset(new Date() , DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd");
|
||||
if (StringUtils.isBlank(date)) {
|
||||
date = DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, 1), "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
String fclass = (String) request2Map.get("fclass"); // 维度
|
||||
|
||||
|
||||
String fisvitual = (String) request2Map.get("fisvitual"); // 是否显示虚拟组织
|
||||
if(StringUtils.isBlank(fisvitual)) {
|
||||
if (StringUtils.isBlank(fisvitual)) {
|
||||
fisvitual = "0";
|
||||
}
|
||||
|
||||
String whereSql = " where 1 = 1 ";
|
||||
whereSql += " and ((t.fdatebegin <= '"+ date +"' and t.fdateend >= '"+ date +"') or (t.fdatebegin <= '"+ date +"' and t.fdateend is null )) ";
|
||||
whereSql += " and t.fclass = " + fclass +" ";
|
||||
if (DBType.isOracle()) {
|
||||
whereSql += " and ((t.fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and t.fdateend >= to_date('" + date + "','yyyy-MM-DD')) or (t.fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and t.fdateend is null )) ";
|
||||
} else {
|
||||
whereSql += " and ((t.fdatebegin <= '" + date + "' and t.fdateend >= '" + date + "') or (t.fdatebegin <= '" + date + "' and t.fdateend is null )) ";
|
||||
}
|
||||
whereSql += " and t.fclass = " + fclass + " ";
|
||||
|
||||
if("0".equals(fisvitual)) {
|
||||
if ("0".equals(fisvitual)) {
|
||||
whereSql += " and t.fisvitual = 0 ";
|
||||
}else {
|
||||
} else {
|
||||
whereSql += " and t.fisvitual in (0, 1) ";
|
||||
}
|
||||
return whereSql;
|
||||
|
|
@ -187,17 +195,17 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
public Map<String, Object> getUserData(Map<String, Object> request2Map, User user) {
|
||||
String root = (String) request2Map.get("root"); // 根节点
|
||||
String level = (String) request2Map.get("level"); // 显示层级
|
||||
if(StringUtils.isBlank(level)) {
|
||||
if (StringUtils.isBlank(level)) {
|
||||
level = "3";
|
||||
}
|
||||
|
||||
String whereSql = userWhereSql(request2Map);
|
||||
|
||||
String whereItemSql = " ";
|
||||
if("0".equals(root)) { // 集团的情况
|
||||
if ("0".equals(root)) { // 集团的情况
|
||||
whereItemSql += " and t.ftype = 0 ";
|
||||
} else {
|
||||
whereItemSql += " and t.id = '" + root +"' ";
|
||||
whereItemSql += " and t.id = '" + root + "' ";
|
||||
}
|
||||
|
||||
// 获取根节点
|
||||
|
|
@ -205,7 +213,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader from jcl_org_map t " + whereSql + whereItemSql);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
String id = null;
|
||||
if(rs.next()) {
|
||||
if (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
id = rs.getString("id");
|
||||
item.put("id", rs.getString("id"));
|
||||
|
|
@ -225,7 +233,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
int currentLevel = 1;
|
||||
if(currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
if (currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
findUserItemByParantId(id, currentLevel + 1, level, rs, list, whereSql, true);
|
||||
}
|
||||
|
||||
|
|
@ -240,12 +248,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
String ids = (String) request2Map.get("ids");
|
||||
String whereSql = userWhereSql(request2Map);
|
||||
|
||||
whereSql += " and fparentid in (" +ids+ ") ";
|
||||
whereSql += " and fparentid in (" + ids + ") ";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader from jcl_org_map t " + whereSql );
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fleader from jcl_org_map t " + whereSql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while(rs.next()) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("fname", rs.getString("fname"));
|
||||
|
|
@ -291,12 +299,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
String ids = (String) request2Map.get("ids");
|
||||
String whereSql = companyDateWhereSql(request2Map);
|
||||
|
||||
whereSql += " and fparentid in (" +ids+ ") ";
|
||||
whereSql += " and fparentid in (" + ids + ") ";
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id, fname, ftype, fparentid, fnumber from jcl_org_map " + whereSql);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while(rs.next()) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("fname", rs.getString("fname"));
|
||||
|
|
@ -316,7 +324,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
rs.executeQuery("select t.id, t.fname, t.ftype, t.fparentid, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber from jcl_org_map t " + whereSql + " and t.fparentid = " + id);
|
||||
List<Map<String, Object>> currentList = new ArrayList<>();
|
||||
while(rs.next()) {
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("fname", rs.getString("fname"));
|
||||
|
|
@ -334,9 +342,9 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
}
|
||||
|
||||
for (Map<String, Object> stringObjectMap : currentList) {
|
||||
if("4".equals(stringObjectMap.get("ftype"))) { // 员工信息
|
||||
if ("4".equals(stringObjectMap.get("ftype"))) { // 员工信息
|
||||
rs.executeQuery("select id, mobile, homeaddress from hrmresource where id = ? ", stringObjectMap.get("fnumber"));
|
||||
if(rs.next()) {
|
||||
if (rs.next()) {
|
||||
stringObjectMap.put("mobile", rs.getString("mobile"));
|
||||
stringObjectMap.put("address", rs.getString("homeaddress"));
|
||||
}
|
||||
|
|
@ -344,14 +352,14 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
"left join hrmdepartment d\n" +
|
||||
"on hrm.departmentid = d.id\n" +
|
||||
"where hrm.id = ? ", stringObjectMap.get("fnumber"));
|
||||
if(rs.next()) {
|
||||
if (rs.next()) {
|
||||
stringObjectMap.put("department", rs.getString("departmentname"));
|
||||
}
|
||||
|
||||
}
|
||||
if(currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
if (currentLevel + 1 <= Integer.parseInt(level)) {
|
||||
findUserItemByParantId((String) stringObjectMap.get("id"), currentLevel + 1, level, rs, list, whereSql, true);
|
||||
} else if(currentLevel == Integer.parseInt(level) ) { // 多查一层
|
||||
} else if (currentLevel == Integer.parseInt(level)) { // 多查一层
|
||||
findUserItemByParantId((String) stringObjectMap.get("id"), currentLevel + 1, level, rs, list, whereSql, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -360,12 +368,12 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
private boolean hasChildren(String id, boolean isCompany) {
|
||||
String whereSql = " where fparentid = " + id + " ";
|
||||
if(isCompany) {
|
||||
if (isCompany) {
|
||||
whereSql += " and ftype in (0, 1, 2) ";
|
||||
}
|
||||
grs.executeQuery("select count(1) as count from jcl_org_map " + whereSql);
|
||||
String count = "0";
|
||||
if(grs.next()) {
|
||||
if (grs.next()) {
|
||||
count = grs.getString("count");
|
||||
}
|
||||
return !"0".equals(count);
|
||||
|
|
|
|||
Loading…
Reference in New Issue