模块管理分权
This commit is contained in:
parent
1be79b9698
commit
ef392f4d0a
|
|
@ -549,8 +549,8 @@ create table JCL_ORG_ITEM (
|
|||
create table JCL_ORG_DETACH (
|
||||
id int auto_increment not null,
|
||||
manager_type int null,
|
||||
ec_manager text not null,
|
||||
jcl_manager text not null,
|
||||
ec_manager int not null,
|
||||
jcl_manager int not null,
|
||||
ec_rolelevel text not null,
|
||||
jcl_rolelevel text not null,
|
||||
manage_module text not null,
|
||||
|
|
|
|||
|
|
@ -491,8 +491,8 @@ CREATE TABLE JCL_ORG_HRMRELATION (
|
|||
create table JCL_ORG_DETACH (
|
||||
id number not null,
|
||||
manager_type number null,
|
||||
ec_manager clob not null,
|
||||
jcl_manager clob not null,
|
||||
ec_manager NUMBER not null,
|
||||
jcl_manager NUMBER not null,
|
||||
ec_rolelevel varchar(4000) not null,
|
||||
jcl_rolelevel varchar(4000) not null,
|
||||
manage_module varchar(4000) not null,
|
||||
|
|
|
|||
|
|
@ -522,8 +522,8 @@ CREATE TABLE JCL_ORG_MAP (
|
|||
create table JCL_ORG_DETACH (
|
||||
id int IDENTITY(1,1) not null,
|
||||
manager_type int null,
|
||||
ec_manager text not null,
|
||||
jcl_manager text not null,
|
||||
ec_manager int not null,
|
||||
jcl_manager int not null,
|
||||
ec_rolelevel text not null,
|
||||
jcl_rolelevel text not null,
|
||||
manage_module text not null,
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ public class ManagerDetachParam {
|
|||
|
||||
private Integer managerType;
|
||||
|
||||
private String ecManager;
|
||||
private Integer ecManager;
|
||||
|
||||
private String jclManager;
|
||||
private Integer jclManager;
|
||||
|
||||
private String ecRolelevel;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ public class ManagerDetachPO {
|
|||
/**
|
||||
* ec管理员
|
||||
*/
|
||||
private String ecManager;
|
||||
private Integer ecManager;
|
||||
/**
|
||||
* jcl管理员
|
||||
*/
|
||||
private String jclManager;
|
||||
private Integer jclManager;
|
||||
/**
|
||||
* ec分部
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ public class ManagerDetachVO {
|
|||
private Long id;
|
||||
|
||||
|
||||
@OrganizationTableColumn(text = "管理员", width = "20%", column = "ec_manager" )
|
||||
private String ecManager;
|
||||
@OrganizationTableColumn(text = "管理员", width = "20%", column = "ec_manager", transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getManagerName")
|
||||
private Integer ecManager;
|
||||
|
||||
@OrganizationTableColumn(text = "可管理组织机构", width = "40%", column = "ec_rolelevel")
|
||||
@OrganizationTableColumn(text = "可管理组织机构", width = "40%", column = "ec_rolelevel",transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getRoleLevel")
|
||||
private String ecRolelevel;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public enum LogModuleNameEnum {
|
|||
RESOURCE("人员管理", 11),
|
||||
STAFFPLAN("编制方案", 12),
|
||||
STAFF("编制上报", 13),
|
||||
DETACH("模块管理分权", 14),
|
||||
OTHER("其他模块", 99);
|
||||
|
||||
private String name;
|
||||
|
|
|
|||
|
|
@ -176,10 +176,10 @@
|
|||
<update id="updateDetach" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO">
|
||||
update jcl_org_detach
|
||||
<set>
|
||||
ecManager=#{ecManager},
|
||||
jclManager=#{jclManager},
|
||||
ecRolelevel=#{ecRolelevel},
|
||||
jclRolelevel=#{jclRolelevel}
|
||||
ec_manager=#{ecManager},
|
||||
jcl_Manager=#{jclManager},
|
||||
ec_rolelevel=#{ecRolelevel},
|
||||
jcl_rolelevel=#{jclRolelevel}
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
|
@ -198,7 +198,7 @@
|
|||
<select id="selectByIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_detach
|
||||
from jcl_org_detach t
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
|
|
@ -210,7 +210,7 @@
|
|||
<select id="getDetachById" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_detach
|
||||
from jcl_org_detach t
|
||||
WHERE delete_type = 0
|
||||
AND id = #{id}
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.engine.organization.mapper.employee;
|
|||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -16,4 +18,6 @@ public interface EmployeeMapper {
|
|||
String getEmployeeNameById(@Param("employeeId") Long id);
|
||||
|
||||
List<Long> getResourceIds(@Param("lastName") String lastName);
|
||||
|
||||
List<Map<String,Object>> getBrowserDatas(@Param("ids") Collection<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,15 @@
|
|||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getBrowserDatas" resultType="java.util.Map">
|
||||
select
|
||||
lastname as "name",
|
||||
id as "id"
|
||||
from hrmresource
|
||||
WHERE id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -18,6 +19,8 @@ public interface SystemDataMapper {
|
|||
|
||||
String getScCompanyNameById(@Param("companyId") String companyId);
|
||||
|
||||
List<Map<String,Object>> getBrowserDatas(@Param("ids") Collection<Long> ids);
|
||||
|
||||
String getScDepartmentNameById(@Param("departmentId") String departmentId);
|
||||
|
||||
String getScHrmResourceNameById(@Param("managerId") String managerId);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,19 @@
|
|||
from hrmsubcompany
|
||||
where id = #{companyId}
|
||||
</select>
|
||||
|
||||
<select id="getBrowserDatas" resultType="java.util.Map">
|
||||
select
|
||||
subcompanyname as "name",
|
||||
id as "id"
|
||||
from hrmsubcompany
|
||||
where id in
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getScDepartmentNameById" resultType="java.lang.String">
|
||||
select departmentname
|
||||
from hrmdepartment
|
||||
|
|
|
|||
|
|
@ -1,23 +1,28 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
||||
import com.engine.organization.entity.detach.po.ManagerDetachPO;
|
||||
import com.engine.organization.entity.detach.vo.ManagerDetachVO;
|
||||
import com.engine.organization.mapper.detach.ManagerDetachMapper;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.service.ManagerDetachService;
|
||||
import com.engine.organization.util.HasRightUtil;
|
||||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -40,6 +45,14 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
public EmployeeMapper getEmployeeMapper() {
|
||||
return MapperProxyFactory.getProxy(EmployeeMapper.class);
|
||||
}
|
||||
|
||||
public SystemDataMapper getSystemDataMapper(){
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
|
@ -68,7 +81,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
SearchConditionOption moduleOption = new SearchConditionOption("0", "组织管理",true);
|
||||
selectOptions.add(moduleOption);
|
||||
|
||||
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "管理员", "1", "ecManager", "");
|
||||
SearchConditionItem ecManager = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, true, "管理员", "1", "ecManager", "");
|
||||
ecManager.setRules("required|string");
|
||||
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "可维护机构", "194", "ecRolelevel", "");
|
||||
ecRolelevel.setRules("required|string");
|
||||
|
|
@ -77,7 +90,13 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
module.setDetailtype(2);
|
||||
module.setHasBorder(true);
|
||||
if (id != null) {
|
||||
//todo
|
||||
ManagerDetachPO detachById = getMangeDetachMapper().getDetachById(id);
|
||||
BrowserBean manager = ecManager.getBrowserConditionParam();
|
||||
manager.setReplaceDatas(getEmployeeMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcManager())).build().getIds()));
|
||||
ecManager.setBrowserConditionParam(manager);
|
||||
BrowserBean roleLevel = ecRolelevel.getBrowserConditionParam();
|
||||
roleLevel.setReplaceDatas(getSystemDataMapper().getBrowserDatas(DeleteParam.builder().ids(String.valueOf(detachById.getEcRolelevel())).build().getIds()));
|
||||
ecRolelevel.setBrowserConditionParam(roleLevel);
|
||||
}
|
||||
selectItems.add(ecManager);
|
||||
selectItems.add(ecRolelevel);
|
||||
|
|
@ -97,7 +116,7 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||
.managerType(0)
|
||||
.ecManager(param.getEcManager())
|
||||
.jclManager(String.valueOf(getHrmResourceMapper().getJclResourceId(param.getEcManager())))
|
||||
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
||||
.ecRolelevel(param.getEcRolelevel())
|
||||
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()).getId()) : null)
|
||||
.manageModule("组织管理")
|
||||
|
|
@ -113,8 +132,9 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
@Override
|
||||
public int updateDetach(ManagerDetachParam param) {
|
||||
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||
.id(param.getId())
|
||||
.ecManager(param.getEcManager())
|
||||
.jclManager(String.valueOf(getHrmResourceMapper().getJclResourceId(param.getEcManager())))
|
||||
.jclManager(getHrmResourceMapper().getJclResourceId(String.valueOf(param.getEcManager())).intValue())
|
||||
.ecRolelevel(param.getEcRolelevel())
|
||||
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()).getId()) : null)
|
||||
.build();
|
||||
|
|
@ -122,16 +142,17 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
|
|||
}
|
||||
|
||||
private String buildSqlWhere(Map<String, Object> params) {
|
||||
String sqlWhere = " where 1 = 1";
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " where delete_type = 0";
|
||||
String lastName = (String) params.get("ecManager");
|
||||
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
|
||||
String ecManager = StringUtils.join(resourceIds,",");
|
||||
if (StringUtils.isNotBlank(ecManager)) {
|
||||
if (StringUtils.isNotBlank(lastName)) {
|
||||
sqlWhere += " AND ec_manager in ("+ecManager+") ";
|
||||
}
|
||||
String ecRolelevel = (String) params.get("ecRolelevel");
|
||||
if (StringUtils.isNotBlank(ecRolelevel)) {
|
||||
sqlWhere += " AND ec_rolelevel in ("+ecRolelevel+")";
|
||||
sqlWhere += " AND ec_rolelevel " +dbType.like(ecRolelevel);
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.mapper.employee.EmployeeMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description:
|
||||
* @Date 2022/10/26
|
||||
* @Version V1.0
|
||||
**/
|
||||
public class ManagerDetachTransMethod {
|
||||
|
||||
public static String getManagerName(String ecManager) {
|
||||
String managerName = MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.valueOf(ecManager));
|
||||
return managerName;
|
||||
}
|
||||
|
||||
|
||||
public static String getRoleLevel(String ecRolelevel) {
|
||||
List<Map<String, Object>> maps = MapperProxyFactory.getProxy(SystemDataMapper.class).getBrowserDatas(DeleteParam.builder().ids(ecRolelevel).build().getIds());
|
||||
String names = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ public class ManagerDetachWrapper extends OrganizationWrapper {
|
|||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
SearchConditionItem ecManager = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "管理员名称", "ecManager");
|
||||
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "可管理组织机构", "194", "ecRolelevel", "");
|
||||
SearchConditionItem ecRolelevel = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "可管理组织机构", "164", "ecRolelevel", "");
|
||||
conditionItems.add(ecManager);
|
||||
conditionItems.add(ecRolelevel);
|
||||
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||
|
|
@ -57,32 +57,32 @@ public class ManagerDetachWrapper extends OrganizationWrapper {
|
|||
return getManagerDetachService(user).getForm(id);
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.DELETE,operateModule = LogModuleNameEnum.OTHER,operateDesc = "删除分权数据")
|
||||
@Log(operateType = OperateTypeEnum.DELETE,operateModule = LogModuleNameEnum.DETACH,operateDesc = "删除分权数据")
|
||||
public int deleteByIds(Collection<Long> ids) {
|
||||
List<ManagerDetachPO> managerDetachPOS = MapperProxyFactory.getProxy(ManagerDetachMapper.class).selectByIds(ids);
|
||||
int deleteByIds = getManagerDetachService(user).deleteByIds(ids);
|
||||
for (ManagerDetachPO managerDetachPO : managerDetachPOS) {
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), managerDetachPO.getEcManager(), JSON.toJSONString(ids), "删除等级方案");
|
||||
}.getClass(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(ids), "删除等级方案");
|
||||
}
|
||||
return deleteByIds;
|
||||
}
|
||||
|
||||
|
||||
@Log(operateType = OperateTypeEnum.ADD,operateModule = LogModuleNameEnum.OTHER,operateDesc = "新增分权管理员")
|
||||
@Log(operateType = OperateTypeEnum.ADD,operateModule = LogModuleNameEnum.DETACH,operateDesc = "新增分权管理员")
|
||||
public int save(ManagerDetachParam param) {
|
||||
int save = getManagerDetachService(user).save(param);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), param.getEcManager(), JSON.toJSONString(param), "新增分权管理员");
|
||||
}.getClass(), String.valueOf(param.getEcManager()), JSON.toJSONString(param), "新增分权管理员");
|
||||
return save;
|
||||
}
|
||||
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.OTHER, operateDesc = "分权数据更新")
|
||||
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.DETACH, operateDesc = "分权数据更新")
|
||||
public int updateDetach(ManagerDetachParam param) {
|
||||
ManagerDetachPO managerDetachPO = MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId());
|
||||
int result = getManagerDetachService(user).updateDetach(param);
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), managerDetachPO.getEcManager(), JSON.toJSONString(param), managerDetachPO, MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId()));
|
||||
}.getClass(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(param), managerDetachPO, MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId()));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue