模块管理分权

pull/29/head
Chengliang 3 years ago
parent 4c74b583bf
commit f6ea4425cf

@ -548,12 +548,12 @@ create table JCL_ORG_ITEM (
-- JCL_ORG_DETACH
create table JCL_ORG_DETACH (
id int auto_increment not null,
type int null,
manager_type int null,
ec_manager text not null,
jcl_manager text not null,
ec_rolelevel text not null,
jcl_rolelevel text not null,
module text not null,
manage_module text not null,
creator int null,
delete_type int null,
create_time date null,

@ -490,12 +490,12 @@ CREATE TABLE JCL_ORG_HRMRELATION (
-- JCL_ORG_DETACH
create table JCL_ORG_DETACH (
id number not null,
type number null,
manager_type number null,
ec_manager clob not null,
jcl_manager clob not null,
ec_rolelevel varchar(4000) not null,
jcl_rolelevel varchar(4000) not null,
module varchar(4000) not null,
manage_module varchar(4000) not null,
creator number null,
delete_type number null,
create_time date null,

@ -521,12 +521,12 @@ CREATE TABLE JCL_ORG_MAP (
-- JCL_ORG_DETACH
create table JCL_ORG_DETACH (
id int IDENTITY(1,1) not null,
type int null,
manager_type int null,
ec_manager text not null,
jcl_manager text not null,
ec_rolelevel text not null,
jcl_rolelevel text not null,
module text not null,
manage_module text not null,
creator int null,
delete_type int null,
create_time date null,

@ -0,0 +1,34 @@
package com.engine.organization.entity.detach.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/10/25
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ManagerDetachParam {
private Integer id;
private Integer managerType;
private String ecManager;
private String jclManager;
private String ecRolelevel;
private String jclRolelevel;
private String manageModule;
}

@ -26,27 +26,27 @@ public class ManagerDetachPO {
/**
*
*/
private Integer type;
private Integer managerType;
/**
* ec
*/
private String ec_manger;
private String ecManager;
/**
* jcl
*/
private String jcl_manger;
private String jclManager;
/**
* ec
*/
private String ec_rolelevel;
private String ecRolelevel;
/**
* jcl
*/
private String jcl_rolelevel;
private String jclRolelevel;
/**
*
*
*/
private String module;
private String manageModule;
/**
*
*/

@ -24,7 +24,7 @@ import lombok.NoArgsConstructor;
fields = "t.id," +
"t.ec_manager," +
"t.ec_rolelevel," +
"t.module," +
"t.manage_module," +
"t.creator," +
"t.delete_type," +
"t.create_time," +
@ -53,7 +53,7 @@ public class ManagerDetachVO {
private String ecRolelevel;
@OrganizationTableColumn(text = "可管理模块", width = "40%", column = "module")
private String module;
@OrganizationTableColumn(text = "可管理模块", width = "40%", column = "manage_module")
private String manageModule;
}

@ -1,5 +1,11 @@
package com.engine.organization.mapper.detach;
import com.engine.organization.entity.detach.po.ManagerDetachPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @Author weaver_cl
* @Description:
@ -8,4 +14,11 @@ package com.engine.organization.mapper.detach;
**/
public interface ManagerDetachMapper {
int insertIgnoreNull(ManagerDetachPO managerDetachPO);
int updateDetach(ManagerDetachPO managerDetachPO);
int deleteByIds(@Param("ids") Collection<Long> ids);
List<ManagerDetachPO> selectByIds(@Param("ids")Collection<Long> ids);
}

@ -1,99 +1,60 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.scheme.SchemeMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.scheme.po.SchemePO">
<mapper namespace="com.engine.organization.mapper.detach.ManagerDetachMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.detach.po.ManagerDetachPO">
<result column="id" property="id"/>
<result column="scheme_no" property="schemeNo"/>
<result column="scheme_name" property="schemeName"/>
<result column="scheme_description" property="schemeDescription"/>
<result column="forbidden_tag" property="forbiddenTag"/>
<result column="manager_type" property="managerType"/>
<result column="ec_manager" property="ecManager"/>
<result column="jcl_manager" property="jclManager"/>
<result column="ec_rolelevel" property="ecRolelevel"/>
<result column="jcl_rolelevel" property="jclRolelevel"/>
<result column="manage_module" property="manageModule"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<resultMap id="TreeResultMap" type="com.engine.organization.entity.TreeData">
<result column="id" property="key"/>
<result column="scheme_name" property="title"/>
<result column="forbidden_tag" property="status"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.scheme_no
, t.scheme_name
, t.scheme_description
, t.forbidden_tag
t.id
, t.manager_type
, t.ec_manager
, t.jcl_manager
, t.ec_rolelevel
, t.jcl_rolelevel
, t.manage_module
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="listByNo" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t where scheme_no = #{schemeNo} AND delete_type = 0
</select>
<select id="getSchemeByID" parameterType="com.engine.organization.entity.scheme.po.SchemePO"
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t where id = #{id} AND delete_type = 0
</select>
<select id="listSchemesByIds" resultType="java.util.Map">
select
id as "id",
scheme_name as "name"
from jcl_org_scheme t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listUsedId" resultType="java.lang.String">
select scheme_id
from jcl_org_level
where delete_type = 0
union
select scheme_id
from jcl_org_grade
where delete_type = 0
union
select scheme_id
from JCL_ORG_SEQUENCE
where delete_type = 0
union
select scheme_id
from JCL_ORG_JOB
where delete_type = 0
</select>
<select id="getTreeData" resultMap="TreeResultMap">
select id, scheme_name,forbidden_tag
from jcl_org_scheme
where delete_type = '0' and forbidden_tag = 0 order by scheme_no
</select>
<select id="getSchemesByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.SchemePO" keyProperty="id"
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_scheme
INSERT INTO jcl_org_detach
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="managerType != null ">
manager_type,
</if>
<if test="ecManager != null ">
ec_manager,
</if>
<if test="jclManager != null ">
jcl_manager,
</if>
<if test="ecRolelevel != null ">
ec_rolelevel,
</if>
<if test="jclRolelevel != null ">
jcl_rolelevel,
</if>
<if test="manageModule != null ">
manage_module,
</if>
<if test="creator != null">
creator,
</if>
@ -106,18 +67,26 @@
<if test="updateTime != null">
update_time,
</if>
<if test="schemeNo != null ">
scheme_no,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="managerType != null ">
#{managerType},
</if>
<if test="ecManager != null ">
#{ecManager},
</if>
<if test="schemeName != null ">
scheme_name,
<if test="jclManager != null ">
#{jclManager},
</if>
<if test="schemeDescription != null ">
scheme_description,
<if test="ecRolelevel != null ">
#{ecRolelevel},
</if>
<if test="jclRolelevel != null ">
#{jclRolelevel},
</if>
<if test="manageModule != null ">
#{manageModule},
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
@ -130,25 +99,33 @@
<if test="updateTime != null">
#{updateTime},
</if>
<if test="schemeNo != null ">
#{schemeNo},
</if>
<if test="schemeName != null ">
#{schemeName},
</if>
<if test="schemeDescription != null ">
#{schemeDescription},
</if>
0,
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.SchemePO" databaseId="oracle">
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_SCHEME_ID.currval from dual
select JCL_ORG_DETACH_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_scheme
INSERT INTO jcl_org_detach
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="managerType != null ">
manager_type,
</if>
<if test="ecManager != null ">
ec_manager,
</if>
<if test="jclManager != null ">
jcl_manager,
</if>
<if test="ecRolelevel != null ">
ec_rolelevel,
</if>
<if test="jclRolelevel != null ">
jcl_rolelevel,
</if>
<if test="manageModule != null ">
manage_module,
</if>
<if test="creator != null">
creator,
</if>
@ -161,18 +138,26 @@
<if test="updateTime != null">
update_time,
</if>
<if test="schemeNo != null ">
scheme_no,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="managerType != null ">
#{managerType},
</if>
<if test="ecManager != null ">
#{ecManager},
</if>
<if test="schemeName != null ">
scheme_name,
<if test="jclManager != null ">
#{jclManager},
</if>
<if test="schemeDescription != null ">
scheme_description,
<if test="ecRolelevel != null ">
#{ecRolelevel},
</if>
<if test="jclRolelevel != null ">
#{jclRolelevel},
</if>
<if test="manageModule != null ">
#{manageModule},
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
@ -185,41 +170,23 @@
<if test="updateTime != null">
#{updateTime},
</if>
<if test="schemeNo != null ">
#{schemeNo},
</if>
<if test="schemeName != null ">
#{schemeName},
</if>
<if test="schemeDescription != null ">
#{schemeDescription},
</if>
0,
</trim>
</insert>
<update id="updateScheme" parameterType="com.engine.organization.entity.scheme.po.SchemePO">
update jcl_org_scheme
<update id="updateDetach" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO">
update jcl_org_detach
<set>
creator=#{creator},
update_time=#{updateTime},
scheme_no=#{schemeNo},
scheme_name=#{schemeName},
scheme_description=#{schemeDescription},
ecManager=#{ecManager},
jclManager=#{jclManager},
ecRolelevel=#{ecRolelevel},
jclRolelevel=#{jclRolelevel}
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.scheme.po.SchemePO">
update jcl_org_scheme
<set>
forbidden_tag=#{forbiddenTag},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE jcl_org_scheme
UPDATE jcl_org_detach
SET delete_type = 1
WHERE delete_type = 0
AND id IN
@ -228,4 +195,15 @@
</foreach>
</update>
<select id="selectByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_detach t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

@ -1,5 +1,8 @@
package com.engine.organization.service;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import java.util.Collection;
import java.util.Map;
/**
@ -23,4 +26,18 @@ public interface ManagerDetachService {
* @return
*/
Map<String, Object> getForm(Integer id);
/**
*
* @param ids
* @return
*/
int deleteByIds(Collection<Long> ids);
/**
*
* @param param
* @return
*/
int save(ManagerDetachParam param);
}

@ -5,18 +5,20 @@ import com.api.browser.bean.SearchConditionItem;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
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.service.ManagerDetachService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @Author weaver_cl
@ -29,6 +31,14 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
private static final String RIGHT_NAME = "MangerDeatch:All";
public ManagerDetachMapper getMangeDetachMapper() {
return MapperProxyFactory.getProxy(ManagerDetachMapper.class);
}
public HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
@Override
public Map<String, Object> listPage(Map<String, Object> params) {
Map<String, Object> resultMap = new HashMap<>();
@ -69,6 +79,28 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
return apiDatas;
}
@Override
public int deleteByIds(Collection<Long> ids) {
return getMangeDetachMapper().deleteByIds(ids);
}
@Override
public int save(ManagerDetachParam param) {
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
.managerType(0)
.ecManager(param.getEcManager())
.jclManager(String.valueOf(getHrmResourceMapper().getJclResourceId(param.getEcManager())))
.ecRolelevel(param.getEcRolelevel())
.jclRolelevel(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()) != null ? String.valueOf(EcHrmRelationUtil.getJclCompanyId(param.getEcRolelevel()).getId()) : null)
.creator((long)user.getUID())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.build();
return getMangeDetachMapper().insertIgnoreNull(managerDetachPO);
}
private String buildSqlWhere(Map<String, Object> params) {
String sqlWhere = " where 1 = 1";
String lastName = (String) params.get("ecManager");

@ -3,6 +3,7 @@ package com.engine.organization.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.ManagerDetachWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -92,4 +93,29 @@ public class ManagerDetachController {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/save")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).save(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/updateScheme")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult updateScheme(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ManagerDetachParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getManagerDetachWrapper(user).updateDetach(param));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -1,16 +1,21 @@
package com.engine.organization.wrapper;
import com.alibaba.fastjson.JSON;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.annotation.Log;
import com.engine.organization.entity.detach.param.ManagerDetachParam;
import com.engine.organization.entity.detach.po.ManagerDetachPO;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.detach.ManagerDetachMapper;
import com.engine.organization.service.ManagerDetachService;
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.hrm.User;
import java.util.*;
@ -21,7 +26,7 @@ import java.util.*;
* @Date 2022/10/21
* @Version V1.0
**/
public class ManagerDetachWrapper extends Service {
public class ManagerDetachWrapper extends OrganizationWrapper {
public ManagerDetachService getManagerDetachService(User user) {
return ServiceUtil.getService(ManagerDetachServiceImpl.class,user);
@ -52,8 +57,33 @@ public class ManagerDetachWrapper extends Service {
return getManagerDetachService(user).getForm(id);
}
@Log(operateType = OperateTypeEnum.DELETE,operateModule = LogModuleNameEnum.OTHER,operateDesc = "删除")
@Log(operateType = OperateTypeEnum.DELETE,operateModule = LogModuleNameEnum.OTHER,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), "删除等级方案");
}
return deleteByIds;
}
@Log(operateType = OperateTypeEnum.ADD,operateModule = LogModuleNameEnum.OTHER,operateDesc = "新增分权管理员")
public int save(ManagerDetachParam param) {
int save = getManagerDetachService(user).save(param);
writeOperateLog(new Object() {
}.getClass(), param.getEcManager(), JSON.toJSONString(param), "新增分权管理员");
return save;
}
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.OTHER, operateDesc = "分权数据更新")
public int updateDetach(ManagerDetachParam param) {
// SchemePO schemeByID = getSchemeMapper().getSchemeByID(param.getId());
// int updateScheme = getManagerDetachService(user).updateDetach(param);
// writeOperateLog(new Object() {
// }.getClass(), schemeByID.getSchemeName(), JSON.toJSONString(param), schemeByID, getSchemeMapper().getSchemeByID(param.getId()));
// return updateScheme;
return -1;
}
}

Loading…
Cancel
Save