diff --git a/src/com/engine/organization/entity/company/bo/CompBO.java b/src/com/engine/organization/entity/company/bo/CompBO.java index c8ea0946..d81bfb6d 100644 --- a/src/com/engine/organization/entity/company/bo/CompBO.java +++ b/src/com/engine/organization/entity/company/bo/CompBO.java @@ -5,6 +5,8 @@ import com.engine.organization.entity.company.dto.CompListDTO; import com.engine.organization.entity.company.param.CompSearchParam; import com.engine.organization.entity.company.po.CompPO; import com.engine.organization.entity.searchtree.SearchTree; +import com.engine.organization.mapper.comp.CompMapper; +import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.collections.CollectionUtils; import weaver.crm.Maint.SectorInfoComInfo; import weaver.general.StringUtil; @@ -21,47 +23,54 @@ import java.util.stream.Collectors; */ public class CompBO { - public static List buildCompDTOList(Collection list) { + public static List buildCompDTOList(Collection list) { - Map poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item)); + Map poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item)); List dtoList = list.stream().map(e -> CompListDTO.builder().id(e.getId()).compNo(e.getCompNo()).compName(e.getCompName()).compNameShort(e.getCompNameShort()).parentCompany(e.getParentCompany()).parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName()).orgCode(e.getOrgCode()).industry(new SectorInfoComInfo().getSectorInfoname(e.getIndustry() + "")).compPrincipal(getUserNameById(e.getCompPrincipal() + "")).forbiddenTag(e.getForbiddenTag()).build()).collect(Collectors.toList()); Map> collects = dtoList.stream().filter(item -> null != item.getParentCompany() && 0 != item.getParentCompany()).collect(Collectors.groupingBy(CompListDTO::getParentCompany)); - return dtoList.stream().map(e -> { - e.setChildren(collects.get(e.getId())); - return e; + // 处理被引用数据 + List usedIds = MapperProxyFactory.getProxy(CompMapper.class).listUsedId(); + List collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); + return dtoList.stream().peek(e -> { + List childList = collects.get(e.getId()); + if (CollectionUtils.isNotEmpty(childList)) { + e.setChildren(childList); + e.setIsUsed(1); + } else { + if (collect.contains(e.getId() + "")) { + e.setIsUsed(1); + } else { + e.setIsUsed(0); + } + } }).filter(item -> null == item.getParentCompany() || 0 == item.getParentCompany()).collect(Collectors.toList()); } - public static List buildCompDTOList(Collection list, List filterList) { + public static List buildCompDTOList(Collection list, List filterList) { // 搜索结果为空,直接返回空 if (CollectionUtils.isEmpty(filterList)) { return Collections.emptyList(); } // 递归添加父级数据 - Map poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item)); - List addedList = new ArrayList<>(); - for (com.engine.organization.entity.company.po.CompPO po : filterList) { + Map poMaps = list.stream().collect(Collectors.toMap(CompPO::getId, item -> item)); + List addedList = new ArrayList<>(); + for (CompPO po : filterList) { dealParentData(addedList, po, poMaps); } - List dtoList = addedList.stream().map(e -> CompListDTO.builder().id(e.getId()).compNo(e.getCompNo()).compName(e.getCompName()).compNameShort(e.getCompNameShort()).parentCompany(e.getParentCompany()).parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName()).orgCode(e.getOrgCode()).industry(new SectorInfoComInfo().getSectorInfoname(e.getIndustry() + "")).compPrincipal(getUserNameById(e.getCompPrincipal() + "")).forbiddenTag(e.getForbiddenTag()).build()).collect(Collectors.toList()); - Map> collects = dtoList.stream().filter(item -> null != item.getParentCompany() && 0 != item.getParentCompany()).collect(Collectors.groupingBy(CompListDTO::getParentCompany)); - return dtoList.stream().map(e -> { - e.setChildren(collects.get(e.getId())); - return e; - }).filter(item -> null == item.getParentCompany() || 0 == item.getParentCompany()).collect(Collectors.toList()); + return buildCompDTOList(addedList); } - public static com.engine.organization.entity.company.po.CompPO convertParamToPO(CompSearchParam param, Long employeeId) { + public static CompPO convertParamToPO(CompSearchParam param, Long employeeId) { if (null == param) { return null; } - return com.engine.organization.entity.company.po.CompPO.builder().id(param.getId() == null ? 0 : param.getId()).compNo(param.getCompNo()).compName(param.getCompName()).compNameShort(param.getCompNameShort()).parentCompany(param.getParentCompany()).orgCode(param.getOrgCode()).industry(param.getIndustry()).compPrincipal(param.getCompPrincipal()).description(param.getDescription()).forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1).deleteType(0).createTime(new Date()).updateTime(new Date()).creator(employeeId).build(); + return CompPO.builder().id(param.getId() == null ? 0 : param.getId()).compNo(param.getCompNo()).compName(param.getCompName()).compNameShort(param.getCompNameShort()).parentCompany(param.getParentCompany()).orgCode(param.getOrgCode()).industry(param.getIndustry()).compPrincipal(param.getCompPrincipal()).description(param.getDescription()).forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1).deleteType(0).createTime(new Date()).updateTime(new Date()).creator(employeeId).build(); } - public static List buildSetToSearchTree(Set comps) { + public static List buildSetToSearchTree(Set comps) { return comps.stream().map(item -> { SearchTree tree = new SearchTree(); tree.setCanClick(true); @@ -85,7 +94,7 @@ public class CompBO { * @param po * @param poMaps */ - private static void dealParentData(List addedList, com.engine.organization.entity.company.po.CompPO po, Map poMaps) { + private static void dealParentData(List addedList, CompPO po, Map poMaps) { if (!addedList.contains(po)) { addedList.add(po); } diff --git a/src/com/engine/organization/entity/company/dto/CompListDTO.java b/src/com/engine/organization/entity/company/dto/CompListDTO.java index ab102b77..c456611a 100644 --- a/src/com/engine/organization/entity/company/dto/CompListDTO.java +++ b/src/com/engine/organization/entity/company/dto/CompListDTO.java @@ -1,6 +1,5 @@ package com.engine.organization.entity.company.dto; -import com.cloudstore.eccom.pc.table.WeaTableType; import com.engine.organization.annotation.OrganizationTable; import com.engine.organization.annotation.OrganizationTableOperate; import com.engine.organization.annotation.TableTitle; @@ -22,9 +21,8 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @OrganizationTable(pageId = "2c66b3a4-d4f8-11ec-9774-00ffcbed7508", - tableType = WeaTableType.NONE, operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除"), @OrganizationTableOperate(index = "2", text = "查看部门") }) @@ -33,7 +31,10 @@ public class CompListDTO { * 主键id */ private Long id; - + /** + * 是否被引用 + */ + private Integer isUsed; /** * 名称 */ diff --git a/src/com/engine/organization/entity/department/bo/DepartmentBO.java b/src/com/engine/organization/entity/department/bo/DepartmentBO.java index ff36bbfc..be59ed1e 100644 --- a/src/com/engine/organization/entity/department/bo/DepartmentBO.java +++ b/src/com/engine/organization/entity/department/bo/DepartmentBO.java @@ -25,7 +25,6 @@ public class DepartmentBO { // 递归添加父级数据 Map poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item)); - List dtoList = list.stream().map(e -> DepartmentListDTO .builder() @@ -41,7 +40,22 @@ public class DepartmentBO { .forbiddenTag(e.getForbiddenTag()) .build()).collect(Collectors.toList()); Map> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept)); - return dtoList.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList()); + // 处理被引用数据 + List usedIds = MapperProxyFactory.getProxy(DepartmentMapper.class).listUsedId(); + List collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); + return dtoList.stream().peek(e -> { + List childList = collects.get(e.getId()); + if (CollectionUtils.isNotEmpty(childList)) { + e.setChildren(childList); + e.setIsUsed(1); + } else { + if (collect.contains(e.getId() + "")) { + e.setIsUsed(1); + } else { + e.setIsUsed(0); + } + } + }).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList()); } public static List buildDeptDTOList(Collection list, List filterList) { @@ -90,10 +104,7 @@ public class DepartmentBO { //获取非一级部门 Map> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getParentComp()) && null != item.getParentDept()).collect(Collectors.groupingBy(SingleDeptTreeVO::getParentDept)); - return singleDeptTreeVOS.stream().map(e -> { - e.setChildren(collects.get(e.getId())); - return e; - }).filter(item -> parentComp.equals(item.getParentComp())).collect(Collectors.toList()); + return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getParentComp())).collect(Collectors.toList()); } diff --git a/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java b/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java index 27f4ad5a..5ea3a8f0 100644 --- a/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java +++ b/src/com/engine/organization/entity/department/dto/DepartmentListDTO.java @@ -24,7 +24,7 @@ import java.util.List; @OrganizationTable(pageId = "96f2bb0d-da73-11ec-a0da-00ffcbed7508", tableType = WeaTableType.NONE, operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除"), @OrganizationTableOperate(index = "2", text = "合并"), @OrganizationTableOperate(index = "3", text = "转移"), @@ -34,7 +34,10 @@ import java.util.List; public class DepartmentListDTO { private Long id; - + /** + * 是否被引用 + */ + private Integer isUsed; /** * 编号 */ diff --git a/src/com/engine/organization/entity/job/bo/JobBO.java b/src/com/engine/organization/entity/job/bo/JobBO.java index e3aaadfd..89f50305 100644 --- a/src/com/engine/organization/entity/job/bo/JobBO.java +++ b/src/com/engine/organization/entity/job/bo/JobBO.java @@ -3,7 +3,9 @@ package com.engine.organization.entity.job.bo; import com.engine.organization.entity.job.dto.JobListDTO; import com.engine.organization.entity.job.param.JobSearchParam; import com.engine.organization.entity.job.po.JobPO; +import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.transmethod.JobTransMethod; +import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.collections.CollectionUtils; import java.util.*; @@ -64,7 +66,22 @@ public class JobBO { .forbiddenTag(e.getForbiddenTag()) .build()).collect(Collectors.toList()); Map> collects = dtoList.stream().filter(item -> null != item.getParentJob() && 0 != item.getParentJob()).collect(Collectors.groupingBy(JobListDTO::getParentJob)); - return dtoList.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); + // 处理被引用数据 + List usedIds = MapperProxyFactory.getProxy(JobMapper.class).listUsedId(); + List collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); + return dtoList.stream().peek(e -> { + List childList = collects.get(e.getId()); + if (CollectionUtils.isNotEmpty(childList)) { + e.setChildren(childList); + e.setIsUsed(1); + } else { + if (collect.contains(e.getId() + "")) { + e.setIsUsed(1); + } else { + e.setIsUsed(0); + } + } + }).filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); } diff --git a/src/com/engine/organization/entity/job/dto/JobListDTO.java b/src/com/engine/organization/entity/job/dto/JobListDTO.java index d524a033..040b3279 100644 --- a/src/com/engine/organization/entity/job/dto/JobListDTO.java +++ b/src/com/engine/organization/entity/job/dto/JobListDTO.java @@ -24,7 +24,7 @@ import java.util.List; @OrganizationTable(pageId = "0efea835-dfc5-11ec-a09e-00e04c680716", tableType = WeaTableType.NONE, operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除"), @OrganizationTableOperate(index = "2", text = "合并"), @OrganizationTableOperate(index = "3", text = "转移"), @@ -36,7 +36,10 @@ public class JobListDTO { * 主键 */ private Long id; - + /** + * 是否被引用 + */ + private Integer isUsed; /** * 编号 */ diff --git a/src/com/engine/organization/entity/scheme/vo/GradeTableVO.java b/src/com/engine/organization/entity/scheme/vo/GradeTableVO.java index cc11aa94..6f61a22e 100644 --- a/src/com/engine/organization/entity/scheme/vo/GradeTableVO.java +++ b/src/com/engine/organization/entity/scheme/vo/GradeTableVO.java @@ -1,8 +1,7 @@ package com.engine.organization.entity.scheme.vo; -import com.engine.organization.annotation.OrganizationTable; -import com.engine.organization.annotation.OrganizationTableColumn; -import com.engine.organization.annotation.OrganizationTableOperate; +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -25,14 +24,19 @@ import lombok.NoArgsConstructor; " t.description ," + " a.scheme_name ," + " t.level_id ," + - " t.forbidden_tag", + " t.forbidden_tag," + + "t.is_used", fromSql = "from jcl_org_grade t inner join jcl_org_scheme a on t.scheme_id = a.id ", orderby = "id desc", primarykey = "id", operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除") - } + }, + tableType = WeaTableType.CHECKBOX, + operatePopedom = @OperatePopedom(transmethod = "com.engine.organization.util.ConfigTrans.formatSourceOperates", otherpara = "column:is_used"), + checkboxPopedom = @CheckboxPopedom(showmethod = "com.engine.organization.util.ConfigTrans.getCheckBoxPopedom", popedompara = "column:is_used") + ) public class GradeTableVO { /** @@ -40,6 +44,11 @@ public class GradeTableVO { */ @OrganizationTableColumn(column = "id", display = false) private Long id; + /** + * 是否被引用 + */ + @OrganizationTableColumn(column = "isUsed", display = false) + private Integer isUsed; /** * 编号 */ @@ -67,7 +76,7 @@ public class GradeTableVO { /** * 职等 */ - @OrganizationTableColumn(text = "职等", width = "20%", column = "level_id",transmethod = "com.engine.organization.transmethod.LevelTransMethod.getLevelId") + @OrganizationTableColumn(text = "职等", width = "20%", column = "level_id", transmethod = "com.engine.organization.transmethod.LevelTransMethod.getLevelId") private String levelId; /** diff --git a/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java b/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java index 8b6a841e..f33db78a 100644 --- a/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java +++ b/src/com/engine/organization/entity/scheme/vo/LevelTableVO.java @@ -1,8 +1,7 @@ package com.engine.organization.entity.scheme.vo; -import com.engine.organization.annotation.OrganizationTable; -import com.engine.organization.annotation.OrganizationTableColumn; -import com.engine.organization.annotation.OrganizationTableOperate; +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,6 +20,7 @@ import lombok.NoArgsConstructor; "s.scheme_name," + "t.scheme_id," + "t.forbidden_tag," + + "t.is_used," + "t.creator," + "t.delete_type," + "t.create_time," + @@ -29,9 +29,11 @@ import lombok.NoArgsConstructor; orderby = "id desc", primarykey = "id", operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除") - } + }, tableType = WeaTableType.CHECKBOX, + operatePopedom = @OperatePopedom(transmethod = "com.engine.organization.util.ConfigTrans.formatSourceOperates", otherpara = "column:is_used"), + checkboxPopedom = @CheckboxPopedom(showmethod = "com.engine.organization.util.ConfigTrans.getCheckBoxPopedom", popedompara = "column:is_used") ) public class LevelTableVO { /** @@ -39,6 +41,11 @@ public class LevelTableVO { */ @OrganizationTableColumn(column = "id", display = false) private Long id; + /** + * 是否被引用 + */ + @OrganizationTableColumn(column = "isUsed", display = false) + private Integer isUsed; /** * 编号 @@ -56,11 +63,6 @@ public class LevelTableVO { */ @OrganizationTableColumn(text = "描述说明", width = "20%", column = "description") private String description; - /** - * 等级方案 - */ - // @OrganizationTableColumn(text = "等级方案", width = "20%", column = "level_scheme") - private String schemeId; /** * 等级方案 diff --git a/src/com/engine/organization/entity/sequence/vo/SequenceTableVO.java b/src/com/engine/organization/entity/sequence/vo/SequenceTableVO.java index 0bd10ec5..0c1b404b 100644 --- a/src/com/engine/organization/entity/sequence/vo/SequenceTableVO.java +++ b/src/com/engine/organization/entity/sequence/vo/SequenceTableVO.java @@ -1,8 +1,7 @@ package com.engine.organization.entity.sequence.vo; -import com.engine.organization.annotation.OrganizationTable; -import com.engine.organization.annotation.OrganizationTableColumn; -import com.engine.organization.annotation.OrganizationTableOperate; +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -25,6 +24,7 @@ import lombok.NoArgsConstructor; "t.description," + "s.scheme_name," + "t.forbidden_tag," + + "t.is_used," + "t.creator," + "t.delete_type," + "t.create_time," + @@ -33,9 +33,13 @@ import lombok.NoArgsConstructor; orderby = "id desc", primarykey = "id", operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除") - } + }, + tableType = WeaTableType.CHECKBOX, + operatePopedom = @OperatePopedom(transmethod = "com.engine.organization.util.ConfigTrans.formatSourceOperates", otherpara = "column:is_used"), + checkboxPopedom = @CheckboxPopedom(showmethod = "com.engine.organization.util.ConfigTrans.getCheckBoxPopedom", popedompara = "column:is_used") + ) public class SequenceTableVO { @@ -44,7 +48,11 @@ public class SequenceTableVO { */ @OrganizationTableColumn(column = "id", display = false) private Long id; - + /** + * 是否被引用 + */ + @OrganizationTableColumn(column = "isUsed", display = false) + private Integer isUsed; /** * 编号 */ diff --git a/src/com/engine/organization/entity/staff/vo/StaffPlanTableVO.java b/src/com/engine/organization/entity/staff/vo/StaffPlanTableVO.java index bd8a9a7a..68f3ef9e 100644 --- a/src/com/engine/organization/entity/staff/vo/StaffPlanTableVO.java +++ b/src/com/engine/organization/entity/staff/vo/StaffPlanTableVO.java @@ -1,8 +1,7 @@ package com.engine.organization.entity.staff.vo; -import com.engine.organization.annotation.OrganizationTable; -import com.engine.organization.annotation.OrganizationTableColumn; -import com.engine.organization.annotation.OrganizationTableOperate; +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,15 +20,18 @@ import java.util.Date; @AllArgsConstructor @NoArgsConstructor @OrganizationTable(pageId = "e04abd72-dbd6-11ec-b69e-00ffcbed7508", - fields = "t.id, t.plan_no, t.plan_name, t.plan_year, t.time_start, t.time_end, t.forbidden_tag", + fields = "t.id,t.is_used, t.plan_no, t.plan_name, t.plan_year, t.time_start, t.time_end, t.forbidden_tag", fromSql = "FROM jcl_org_staffplan t ", orderby = "id desc", primarykey = "id", operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除"), @OrganizationTableOperate(index = "2", text = "发起编制流程") - } + }, tableType = WeaTableType.CHECKBOX, + operatePopedom = @OperatePopedom(transmethod = "com.engine.organization.util.ConfigTrans.formatStaffOperates", otherpara = "column:is_used"), + checkboxPopedom = @CheckboxPopedom(showmethod = "com.engine.organization.util.ConfigTrans.getCheckBoxPopedom", popedompara = "column:is_used") + ) public class StaffPlanTableVO { @@ -38,6 +40,11 @@ public class StaffPlanTableVO { */ @OrganizationTableColumn(column = "id", display = false) private Long id; + /** + * 是否被引用 + */ + @OrganizationTableColumn(column = "isUsed", display = false) + private Integer isUsed; /** * 编号 */ diff --git a/src/com/engine/organization/entity/staff/vo/StaffTableVO.java b/src/com/engine/organization/entity/staff/vo/StaffTableVO.java index 41780e8d..c8fab370 100644 --- a/src/com/engine/organization/entity/staff/vo/StaffTableVO.java +++ b/src/com/engine/organization/entity/staff/vo/StaffTableVO.java @@ -1,8 +1,7 @@ package com.engine.organization.entity.staff.vo; -import com.engine.organization.annotation.OrganizationTable; -import com.engine.organization.annotation.OrganizationTableColumn; -import com.engine.organization.annotation.OrganizationTableOperate; +import com.cloudstore.eccom.pc.table.WeaTableType; +import com.engine.organization.annotation.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -19,15 +18,18 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @OrganizationTable(pageId = "0cdfd5bb-dc09-11ec-b69e-00ffcbed7508", - fields = "id,plan_id,comp_id,dept_id,job_id,staff_num,permanent_num,freeze_num,lack_status,staff_desc", + fields = "id,is_used,plan_id,comp_id,dept_id,job_id,staff_num,permanent_num,freeze_num,lack_status,staff_desc", fromSql = "FROM jcl_org_staff t ", orderby = "id desc", primarykey = "id", operates = { - @OrganizationTableOperate(index = "0", text = "编辑"), + @OrganizationTableOperate(text = "编辑"), @OrganizationTableOperate(index = "1", text = "删除"), @OrganizationTableOperate(index = "2", text = "变更") - } + }, tableType = WeaTableType.CHECKBOX, + operatePopedom = @OperatePopedom(transmethod = "com.engine.organization.util.ConfigTrans.formatStaffOperates", otherpara = "column:is_used"), + checkboxPopedom = @CheckboxPopedom(showmethod = "com.engine.organization.util.ConfigTrans.getCheckBoxPopedom", popedompara = "column:is_used") + ) public class StaffTableVO { /** @@ -35,6 +37,11 @@ public class StaffTableVO { */ @OrganizationTableColumn(column = "id", display = false) private Long id; + /** + * 是否被引用 + */ + @OrganizationTableColumn(column = "isUsed", display = false) + private Integer isUsed; /** * 方案id */ diff --git a/src/com/engine/organization/mapper/common/RefreshUseMapper.java b/src/com/engine/organization/mapper/common/RefreshUseMapper.java new file mode 100644 index 00000000..8d34418b --- /dev/null +++ b/src/com/engine/organization/mapper/common/RefreshUseMapper.java @@ -0,0 +1,17 @@ +package com.engine.organization.mapper.common; + +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/06/01 + * @version: 1.0 + */ +public interface RefreshUseMapper { + int updateIsUsedByIds(@Param("tableName") String tableName, @Param("ids") Collection ids, @Param("isUsed") int isUsed); + + int initIsUseStatus(@Param("tableName") String tableName); +} diff --git a/src/com/engine/organization/mapper/common/RefreshUseMapper.xml b/src/com/engine/organization/mapper/common/RefreshUseMapper.xml new file mode 100644 index 00000000..dd84e80c --- /dev/null +++ b/src/com/engine/organization/mapper/common/RefreshUseMapper.xml @@ -0,0 +1,20 @@ + + + + + + update ${tableName} set is_used = #{isUsed} where delete_type = 0 and id + + not + + in + + #{id} + + + + update ${tableName} + set is_used = 0 + where delete_type = 0 + + \ No newline at end of file diff --git a/src/com/engine/organization/mapper/comp/CompMapper.java b/src/com/engine/organization/mapper/comp/CompMapper.java index f4b9f268..55c8e024 100644 --- a/src/com/engine/organization/mapper/comp/CompMapper.java +++ b/src/com/engine/organization/mapper/comp/CompMapper.java @@ -21,6 +21,13 @@ public interface CompMapper { */ List list(); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); + /** * 根据搜索条件查询数据 * diff --git a/src/com/engine/organization/mapper/comp/CompMapper.xml b/src/com/engine/organization/mapper/comp/CompMapper.xml index ed03538d..042a8b3f 100644 --- a/src/com/engine/organization/mapper/comp/CompMapper.xml +++ b/src/com/engine/organization/mapper/comp/CompMapper.xml @@ -176,7 +176,8 @@ from jcl_org_comp t where comp_no = #{compNo} AND delete_type = 0 - SELECT FROM @@ -233,6 +234,23 @@ #{id} + update jcl_org_comp diff --git a/src/com/engine/organization/mapper/department/DepartmentMapper.java b/src/com/engine/organization/mapper/department/DepartmentMapper.java index 0f3fa4e1..84569713 100644 --- a/src/com/engine/organization/mapper/department/DepartmentMapper.java +++ b/src/com/engine/organization/mapper/department/DepartmentMapper.java @@ -98,4 +98,11 @@ public interface DepartmentMapper { * @param ids */ int deleteByIds(@Param("ids") Collection ids); + + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); } diff --git a/src/com/engine/organization/mapper/department/DepartmentMapper.xml b/src/com/engine/organization/mapper/department/DepartmentMapper.xml index c8c40bfd..1e5b00a9 100644 --- a/src/com/engine/organization/mapper/department/DepartmentMapper.xml +++ b/src/com/engine/organization/mapper/department/DepartmentMapper.xml @@ -115,6 +115,15 @@ where delete_type = 0 and parent_dept = #{pid} + ids); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); } diff --git a/src/com/engine/organization/mapper/job/JobMapper.xml b/src/com/engine/organization/mapper/job/JobMapper.xml index 458ddc53..214f8d5d 100644 --- a/src/com/engine/organization/mapper/job/JobMapper.xml +++ b/src/com/engine/organization/mapper/job/JobMapper.xml @@ -276,6 +276,11 @@ where delete_type = 0 and parent_job = #{pid} + diff --git a/src/com/engine/organization/mapper/scheme/GradeMapper.java b/src/com/engine/organization/mapper/scheme/GradeMapper.java index 3b9db7f1..0cc97450 100644 --- a/src/com/engine/organization/mapper/scheme/GradeMapper.java +++ b/src/com/engine/organization/mapper/scheme/GradeMapper.java @@ -77,4 +77,6 @@ public interface GradeMapper { * @return */ int getCountByTag(@Param("tag") int tag); + + List listUsedId(); } diff --git a/src/com/engine/organization/mapper/scheme/GradeMapper.xml b/src/com/engine/organization/mapper/scheme/GradeMapper.xml index 68466e2a..00ef24cf 100644 --- a/src/com/engine/organization/mapper/scheme/GradeMapper.xml +++ b/src/com/engine/organization/mapper/scheme/GradeMapper.xml @@ -38,14 +38,14 @@ from jcl_org_grade t where id = #{id} AND delete_type = 0 - select from jcl_org_grade t where grade_no = #{gradeNo} AND delete_type = 0 @@ -54,6 +54,11 @@ from jcl_org_grade t where delete_type = 0 and scheme_id = #{schemeId} + update jcl_org_grade @@ -96,7 +101,8 @@ scheme_id, - + + level_id, forbidden_tag, @@ -125,7 +131,8 @@ #{schemeId}, - + + #{levelId}, 0, diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.java b/src/com/engine/organization/mapper/scheme/LevelMapper.java index 81f4dca1..95f2fc6e 100644 --- a/src/com/engine/organization/mapper/scheme/LevelMapper.java +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.java @@ -25,6 +25,13 @@ public interface LevelMapper { */ List listByNo(@Param("levelNo") String levelNo); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); + /** * 获取职等根据ID * @param id diff --git a/src/com/engine/organization/mapper/scheme/LevelMapper.xml b/src/com/engine/organization/mapper/scheme/LevelMapper.xml index 2f597ead..5a57cf73 100644 --- a/src/com/engine/organization/mapper/scheme/LevelMapper.xml +++ b/src/com/engine/organization/mapper/scheme/LevelMapper.xml @@ -36,14 +36,14 @@ from jcl_org_level t where id = #{id} AND delete_type = 0 - select from jcl_org_level t where level_no = #{levelNo} AND delete_type = 0 @@ -59,6 +59,15 @@ #{id} + update jcl_org_level diff --git a/src/com/engine/organization/mapper/scheme/SchemeMapper.java b/src/com/engine/organization/mapper/scheme/SchemeMapper.java index 260f9294..080af6ba 100644 --- a/src/com/engine/organization/mapper/scheme/SchemeMapper.java +++ b/src/com/engine/organization/mapper/scheme/SchemeMapper.java @@ -26,6 +26,12 @@ public interface SchemeMapper { */ List listByNo(@Param("schemeNo") String schemeNo); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); /** * 根据ID查询登记方案 * @@ -41,7 +47,7 @@ public interface SchemeMapper { * @return */ @MapKey("id") - List> listSchemesByIds(@Param("ids") Collection ids); + List> listSchemesByIds(@Param("ids") Collection ids); /** * 新增,忽略null字段 diff --git a/src/com/engine/organization/mapper/scheme/SchemeMapper.xml b/src/com/engine/organization/mapper/scheme/SchemeMapper.xml index aca1edcf..b43994d7 100644 --- a/src/com/engine/organization/mapper/scheme/SchemeMapper.xml +++ b/src/com/engine/organization/mapper/scheme/SchemeMapper.xml @@ -51,6 +51,23 @@ #{id} + diff --git a/src/com/engine/organization/mapper/sequence/SequenceMapper.java b/src/com/engine/organization/mapper/sequence/SequenceMapper.java index 4bcfa336..d65c01fd 100644 --- a/src/com/engine/organization/mapper/sequence/SequenceMapper.java +++ b/src/com/engine/organization/mapper/sequence/SequenceMapper.java @@ -25,6 +25,13 @@ public interface SequenceMapper { */ List listByNo(@Param("sequenceNo") String sequenceNo); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); + /** * 获取岗位根据ID * @param id @@ -77,4 +84,5 @@ public interface SequenceMapper { * @return */ int getCountByTag(@Param("tag") int tag); + } diff --git a/src/com/engine/organization/mapper/sequence/SequenceMapper.xml b/src/com/engine/organization/mapper/sequence/SequenceMapper.xml index ca6a0d38..a764662f 100644 --- a/src/com/engine/organization/mapper/sequence/SequenceMapper.xml +++ b/src/com/engine/organization/mapper/sequence/SequenceMapper.xml @@ -36,14 +36,15 @@ from jcl_org_sequence t where id = #{id} AND delete_type = 0 - select from jcl_org_sequence t where sequence_no = #{sequenceNo} AND delete_type = 0 @@ -59,6 +60,10 @@ #{id} + update jcl_org_sequence diff --git a/src/com/engine/organization/mapper/staff/StaffMapper.java b/src/com/engine/organization/mapper/staff/StaffMapper.java index 0eaf7f07..0d39e82c 100644 --- a/src/com/engine/organization/mapper/staff/StaffMapper.java +++ b/src/com/engine/organization/mapper/staff/StaffMapper.java @@ -5,6 +5,7 @@ import com.engine.organization.entity.staff.po.StaffPO; import org.apache.ibatis.annotations.Param; import java.util.Collection; +import java.util.List; /** * @Author dxfeng @@ -16,6 +17,7 @@ public interface StaffMapper { /** * 根据ID查询编制方案 + * * @param id * @return */ @@ -23,6 +25,7 @@ public interface StaffMapper { /** * 插入编制方案 + * * @param staffPO * @return */ @@ -44,4 +47,10 @@ public interface StaffMapper { */ int deleteByIds(@Param("ids") Collection ids); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); } diff --git a/src/com/engine/organization/mapper/staff/StaffMapper.xml b/src/com/engine/organization/mapper/staff/StaffMapper.xml index a069bcd7..137f2b2e 100644 --- a/src/com/engine/organization/mapper/staff/StaffMapper.xml +++ b/src/com/engine/organization/mapper/staff/StaffMapper.xml @@ -43,6 +43,11 @@ from jcl_org_staff t where id = #{id} AND delete_type = 0 + update jcl_org_staff diff --git a/src/com/engine/organization/mapper/staff/StaffPlanMapper.java b/src/com/engine/organization/mapper/staff/StaffPlanMapper.java index cb754135..e9046142 100644 --- a/src/com/engine/organization/mapper/staff/StaffPlanMapper.java +++ b/src/com/engine/organization/mapper/staff/StaffPlanMapper.java @@ -25,10 +25,11 @@ public interface StaffPlanMapper { List listByNo(@Param("planNo") String planNo); - List> listPlansByIds(@Param("ids") Collection ids); + List> listPlansByIds(@Param("ids") Collection ids); /** * 根据ID查询编制方案 + * * @param id * @return */ @@ -36,6 +37,7 @@ public interface StaffPlanMapper { /** * 插入编制方案 + * * @param staffPlanPO * @return */ @@ -64,4 +66,10 @@ public interface StaffPlanMapper { */ int deleteByIds(@Param("ids") Collection ids); + /** + * 查询所有被引用的ID + * + * @return + */ + List listUsedId(); } diff --git a/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml b/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml index c99f3685..8b58e308 100644 --- a/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml +++ b/src/com/engine/organization/mapper/staff/StaffPlanMapper.xml @@ -59,6 +59,11 @@ #{id} + update jcl_org_staffplan diff --git a/src/com/engine/organization/service/impl/GradeServiceImpl.java b/src/com/engine/organization/service/impl/GradeServiceImpl.java index 6e95382c..7210ea90 100644 --- a/src/com/engine/organization/service/impl/GradeServiceImpl.java +++ b/src/com/engine/organization/service/impl/GradeServiceImpl.java @@ -19,6 +19,7 @@ import com.engine.organization.service.GradeService; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.RefreshIsUsedUtil; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; @@ -51,6 +52,8 @@ public class GradeServiceImpl extends Service implements GradeService { @Override public Map listPage(Map params) { + // 刷新引用状态 + RefreshIsUsedUtil.RefreshGrade("jcl_org_grade"); OrganizationWeaTable table = new OrganizationWeaTable<>(user, GradeTableVO.class); String sqlWhere = buildSqlWhere(params); table.setSqlwhere(sqlWhere); diff --git a/src/com/engine/organization/service/impl/LevelServiceImpl.java b/src/com/engine/organization/service/impl/LevelServiceImpl.java index 3ea178ce..66ecfbfa 100644 --- a/src/com/engine/organization/service/impl/LevelServiceImpl.java +++ b/src/com/engine/organization/service/impl/LevelServiceImpl.java @@ -18,6 +18,7 @@ import com.engine.organization.service.LevelService; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.RefreshIsUsedUtil; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; @@ -46,6 +47,8 @@ public class LevelServiceImpl extends Service implements LevelService { @Override public Map listPage(Map params) { + // 刷新引用状态 + RefreshIsUsedUtil.RefreshLevel("jcl_org_level"); OrganizationWeaTable table = new OrganizationWeaTable<>(user, LevelTableVO.class); String sqlWhere = buildSqlWhere(params); table.setSqlwhere(sqlWhere); diff --git a/src/com/engine/organization/service/impl/SchemeServiceImpl.java b/src/com/engine/organization/service/impl/SchemeServiceImpl.java index b626502f..8175fc31 100644 --- a/src/com/engine/organization/service/impl/SchemeServiceImpl.java +++ b/src/com/engine/organization/service/impl/SchemeServiceImpl.java @@ -2,10 +2,6 @@ package com.engine.organization.service.impl; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; -import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom; -import com.cloudstore.eccom.pc.table.WeaTableOperate; -import com.cloudstore.eccom.pc.table.WeaTableOperates; -import com.cloudstore.eccom.pc.table.WeaTablePopedom; import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.core.impl.Service; import com.engine.organization.component.OrganizationWeaTable; @@ -18,13 +14,13 @@ import com.engine.organization.service.SchemeService; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.RefreshIsUsedUtil; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.general.StringUtil; import weaver.general.Util; -import weaver.systeminfo.SystemEnv; import java.util.*; @@ -42,8 +38,9 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map listPage(Map params) { + // 刷新引用状态 + RefreshIsUsedUtil.RefreshScheme("jcl_org_scheme"); OrganizationWeaTable table = new OrganizationWeaTable<>(user, SchemeTableVO.class); - String sqlWhere = buildSqlWhere(params); table.setSqlwhere(sqlWhere); WeaResultMsg result = new WeaResultMsg(false); @@ -54,7 +51,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map save(SchemeSearchParam param) { - Map apidatas = new HashMap(16); + Map apidatas = new HashMap<>(16); List list = getSchemeMapper().listByNo(Util.null2String(param.getSchemeNo())); OrganizationAssert.isEmpty(list, "编号不允许重复"); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); @@ -64,7 +61,7 @@ public class SchemeServiceImpl extends Service implements SchemeService { @Override public Map updateScheme(SchemeSearchParam param) { - Map apidatas = new HashMap(); + Map apidatas = new HashMap<>(); SchemePO schemePO = SchemeDTO.convertParamToPO(param, (long) user.getUID()); getSchemeMapper().updateScheme(schemePO); return apidatas; diff --git a/src/com/engine/organization/service/impl/SequenceServiceImpl.java b/src/com/engine/organization/service/impl/SequenceServiceImpl.java index 58e22368..866f0e51 100644 --- a/src/com/engine/organization/service/impl/SequenceServiceImpl.java +++ b/src/com/engine/organization/service/impl/SequenceServiceImpl.java @@ -18,6 +18,7 @@ import com.engine.organization.service.SequenceService; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.RefreshIsUsedUtil; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; @@ -46,6 +47,8 @@ public class SequenceServiceImpl extends Service implements SequenceService { @Override public Map listPage(Map params) { + // 刷新引用状态 + RefreshIsUsedUtil.RefreshSequence("jcl_org_sequence"); OrganizationWeaTable table = new OrganizationWeaTable<>(user, SequenceTableVO.class); String sqlWhere = buildSqlWhere(params); table.setSqlwhere(sqlWhere); diff --git a/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java b/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java index 92f081c2..df0a0aba 100644 --- a/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java +++ b/src/com/engine/organization/service/impl/StaffPlanServiceImpl.java @@ -18,6 +18,7 @@ import com.engine.organization.service.StaffPlanService; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.RefreshIsUsedUtil; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; @@ -45,6 +46,8 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService { @Override public Map listPage(StaffPlanSearchParam params) { + // 刷新引用状态 + RefreshIsUsedUtil.RefreshStaffPlan("jcl_org_staffplan"); OrganizationWeaTable table = new OrganizationWeaTable<>(user, StaffPlanTableVO.class); StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(params, (long) user.getUID()); String sqlWhere = buildSqlWhere(staffPlanPO); diff --git a/src/com/engine/organization/service/impl/StaffServiceImpl.java b/src/com/engine/organization/service/impl/StaffServiceImpl.java index 5c092374..e9185701 100644 --- a/src/com/engine/organization/service/impl/StaffServiceImpl.java +++ b/src/com/engine/organization/service/impl/StaffServiceImpl.java @@ -21,6 +21,7 @@ import com.engine.organization.service.StaffService; import com.engine.organization.util.MenuBtn; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationFormItemUtil; +import com.engine.organization.util.RefreshIsUsedUtil; import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; @@ -60,6 +61,8 @@ public class StaffServiceImpl extends Service implements StaffService { @Override public Map listPage(StaffSearchParam params) { + // 刷新引用状态 + RefreshIsUsedUtil.RefreshStaff("jcl_org_staff"); OrganizationWeaTable table = new OrganizationWeaTable<>(user, StaffTableVO.class); StaffPO staffPO = StaffBO.convertParamToPO(params, (long) user.getUID()); String sqlWhere = buildSqlWhere(staffPO); diff --git a/src/com/engine/organization/util/ConfigTrans.java b/src/com/engine/organization/util/ConfigTrans.java index b54e82d2..f97eb711 100644 --- a/src/com/engine/organization/util/ConfigTrans.java +++ b/src/com/engine/organization/util/ConfigTrans.java @@ -19,7 +19,7 @@ public class ConfigTrans { return "false"; } - public static List formatSourceOperates(String id,String isDefault) { + public static List formatSourceOperates(String id, String isDefault) { List list = Lists.newArrayList(); list.add(true); if ("0".equals(isDefault)) { @@ -30,4 +30,16 @@ public class ConfigTrans { return list; } + public static List formatStaffOperates(String id, String isDefault) { + List list = Lists.newArrayList(); + list.add(true); + if ("0".equals(isDefault)) { + list.add(true); + } else { + list.add(false); + } + list.add(true); + return list; + } + } diff --git a/src/com/engine/organization/util/RefreshIsUsedUtil.java b/src/com/engine/organization/util/RefreshIsUsedUtil.java new file mode 100644 index 00000000..c37cbc3d --- /dev/null +++ b/src/com/engine/organization/util/RefreshIsUsedUtil.java @@ -0,0 +1,115 @@ +package com.engine.organization.util; + +import com.engine.organization.mapper.common.RefreshUseMapper; +import com.engine.organization.mapper.scheme.GradeMapper; +import com.engine.organization.mapper.scheme.LevelMapper; +import com.engine.organization.mapper.scheme.SchemeMapper; +import com.engine.organization.mapper.sequence.SequenceMapper; +import com.engine.organization.mapper.staff.StaffMapper; +import com.engine.organization.mapper.staff.StaffPlanMapper; +import com.engine.organization.util.db.MapperProxyFactory; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @description: TODO + * @author:dxfeng + * @createTime: 2022/06/01 + * @version: 1.0 + */ +public class RefreshIsUsedUtil { + + private static RefreshUseMapper getRefreshUseMapper() { + return MapperProxyFactory.getProxy(RefreshUseMapper.class); + } + + + /** + * 刷新等级方案表 引用状态 + *

+ * JCL_ORG_LEVEL,JCL_ORG_GRADE,JCL_ORG_SEQUENCE,JCL_ORG_JOB + */ + public static void RefreshScheme(String tableName) { + List usedIds = MapperProxyFactory.getProxy(SchemeMapper.class).listUsedId(); + usedIds.removeIf(Objects::isNull); + RefreshIsUsedStatus(tableName, usedIds); + } + + /** + * 刷新职等表 引用状态 + *

+ * JCL_ORG_GRADE,JCL_ORG_JOBDT + */ + public static void RefreshLevel(String tableName) { + List usedIds = MapperProxyFactory.getProxy(LevelMapper.class).listUsedId(); + usedIds.removeIf(Objects::isNull); + RefreshIsUsedStatus(tableName, usedIds); + } + + /** + * 刷新职级表 引用状态 + *

+ * JCL_ORG_JOBDT + */ + public static void RefreshGrade(String tableName) { + List usedIds = MapperProxyFactory.getProxy(GradeMapper.class).listUsedId(); + usedIds.removeIf(Objects::isNull); + RefreshIsUsedStatus(tableName, usedIds); + } + + /** + * 刷新岗位序列表 引用状态 + *

+ * JCL_ORG_JOB + */ + public static void RefreshSequence(String tableName) { + List usedIds = MapperProxyFactory.getProxy(SequenceMapper.class).listUsedId(); + usedIds.removeIf(Objects::isNull); + RefreshIsUsedStatus(tableName, usedIds); + } + + /** + * 刷新编制方案列表 引用状态 + *

+ * JCL_ORG_JOB + */ + public static void RefreshStaffPlan(String tableName) { + List usedIds = MapperProxyFactory.getProxy(StaffPlanMapper.class).listUsedId(); + usedIds.removeIf(Objects::isNull); + RefreshIsUsedStatus(tableName, usedIds); + } + + /** + * 刷新编制表列表 引用状态 + *

+ * JCL_ORG_JOB + */ + public static void RefreshStaff(String tableName) { + List usedIds = MapperProxyFactory.getProxy(StaffMapper.class).listUsedId(); + usedIds.removeIf(Objects::isNull); + RefreshIsUsedStatus(tableName, usedIds); + } + + + /** + * 更新指定表的引用状态 + * + * @param tableName + * @param usedIds + */ + private static void RefreshIsUsedStatus(String tableName, List usedIds) { + if (CollectionUtils.isNotEmpty(usedIds)) { + List collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); + getRefreshUseMapper().updateIsUsedByIds(tableName, collect, 0); + getRefreshUseMapper().updateIsUsedByIds(tableName, collect, 1); + }else{ + getRefreshUseMapper().initIsUseStatus(tableName); + } + } + + +}