Merge pull request 'feature/detach' (#29) from feature/detach into develop
Reviewed-on: #29pull/30/head
commit
19cccb9345
@ -0,0 +1,13 @@
|
|||||||
|
package com.api.organization.web;
|
||||||
|
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
@Path("/bs/hrmorganization/detach")
|
||||||
|
public class ManagerDetachController extends com.engine.organization.web.ManagerDetachController {
|
||||||
|
}
|
@ -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 Integer ecManager;
|
||||||
|
|
||||||
|
private Integer jclManager;
|
||||||
|
|
||||||
|
private String ecRolelevel;
|
||||||
|
|
||||||
|
private String jclRolelevel;
|
||||||
|
|
||||||
|
private String manageModule;
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.engine.organization.entity.detach.po;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ManagerDetachPO {
|
||||||
|
/**
|
||||||
|
* 自增主键
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 管理员类型
|
||||||
|
*/
|
||||||
|
private Integer managerType;
|
||||||
|
/**
|
||||||
|
* ec管理员
|
||||||
|
*/
|
||||||
|
private Integer ecManager;
|
||||||
|
/**
|
||||||
|
* jcl管理员
|
||||||
|
*/
|
||||||
|
private Integer jclManager;
|
||||||
|
/**
|
||||||
|
* ec分部
|
||||||
|
*/
|
||||||
|
private String ecRolelevel;
|
||||||
|
/**
|
||||||
|
* jcl分部
|
||||||
|
*/
|
||||||
|
private String jclRolelevel;
|
||||||
|
/**
|
||||||
|
* 可管理模块
|
||||||
|
*/
|
||||||
|
private String manageModule;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private Long creator;
|
||||||
|
/**
|
||||||
|
* 删除标记
|
||||||
|
*/
|
||||||
|
private int deleteType;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.engine.organization.entity.detach.vo;
|
||||||
|
|
||||||
|
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||||
|
import com.engine.organization.annotation.OrganizationTable;
|
||||||
|
import com.engine.organization.annotation.OrganizationTableColumn;
|
||||||
|
import com.engine.organization.annotation.OrganizationTableOperate;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@OrganizationTable(pageId = "0bf9b7bc-c8b0-4225-bf28-4cd015d96e98",
|
||||||
|
fields = "t.id," +
|
||||||
|
"t.ec_manager," +
|
||||||
|
"t.ec_rolelevel," +
|
||||||
|
"t.manage_module," +
|
||||||
|
"t.creator," +
|
||||||
|
"t.delete_type," +
|
||||||
|
"t.create_time," +
|
||||||
|
"t.update_time",
|
||||||
|
fromSql = "FROM jcl_org_detach t ",
|
||||||
|
orderby = "id",
|
||||||
|
sortway = "asc",
|
||||||
|
primarykey = "id",
|
||||||
|
operates = {
|
||||||
|
@OrganizationTableOperate(index = "0", text = "编辑"),
|
||||||
|
@OrganizationTableOperate(index = "1", text = "删除")
|
||||||
|
},
|
||||||
|
tableType = WeaTableType.CHECKBOX
|
||||||
|
)
|
||||||
|
public class ManagerDetachVO {
|
||||||
|
|
||||||
|
|
||||||
|
@OrganizationTableColumn(column = "id", display = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
@OrganizationTableColumn(text = "管理员", width = "20%", column = "ec_manager", transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getManagerName")
|
||||||
|
private Integer ecManager;
|
||||||
|
|
||||||
|
@OrganizationTableColumn(text = "可管理组织机构", width = "40%", column = "ec_rolelevel",transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getRoleLevel")
|
||||||
|
private String ecRolelevel;
|
||||||
|
|
||||||
|
|
||||||
|
@OrganizationTableColumn(text = "可管理模块", width = "40%", column = "manage_module")
|
||||||
|
private String manageModule;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
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:
|
||||||
|
* @Date 2022/10/24
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
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);
|
||||||
|
|
||||||
|
ManagerDetachPO getDetachById(@Param("id") Integer id);
|
||||||
|
}
|
@ -0,0 +1,217 @@
|
|||||||
|
<?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.detach.ManagerDetachMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.engine.organization.entity.detach.po.ManagerDetachPO">
|
||||||
|
<result column="id" property="id"/>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 表字段 -->
|
||||||
|
<sql id="baseColumns">
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO" keyProperty="id"
|
||||||
|
keyColumn="id" useGeneratedKeys="true">
|
||||||
|
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>
|
||||||
|
<if test="deleteType != null">
|
||||||
|
delete_type,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="managerType != null ">
|
||||||
|
#{managerType},
|
||||||
|
</if>
|
||||||
|
<if test="ecManager != null ">
|
||||||
|
#{ecManager},
|
||||||
|
</if>
|
||||||
|
<if test="jclManager != null ">
|
||||||
|
#{jclManager},
|
||||||
|
</if>
|
||||||
|
<if test="ecRolelevel != null ">
|
||||||
|
#{ecRolelevel},
|
||||||
|
</if>
|
||||||
|
<if test="jclRolelevel != null ">
|
||||||
|
#{jclRolelevel},
|
||||||
|
</if>
|
||||||
|
<if test="manageModule != null ">
|
||||||
|
#{manageModule},
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
#{creator},
|
||||||
|
</if>
|
||||||
|
<if test="deleteType != null">
|
||||||
|
#{deleteType},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO" databaseId="oracle">
|
||||||
|
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||||
|
select JCL_ORG_DETACH_ID.currval from dual
|
||||||
|
</selectKey>
|
||||||
|
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>
|
||||||
|
<if test="deleteType != null">
|
||||||
|
delete_type,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="managerType != null ">
|
||||||
|
#{managerType},
|
||||||
|
</if>
|
||||||
|
<if test="ecManager != null ">
|
||||||
|
#{ecManager},
|
||||||
|
</if>
|
||||||
|
<if test="jclManager != null ">
|
||||||
|
#{jclManager},
|
||||||
|
</if>
|
||||||
|
<if test="ecRolelevel != null ">
|
||||||
|
#{ecRolelevel},
|
||||||
|
</if>
|
||||||
|
<if test="jclRolelevel != null ">
|
||||||
|
#{jclRolelevel},
|
||||||
|
</if>
|
||||||
|
<if test="manageModule != null ">
|
||||||
|
#{manageModule},
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
#{creator},
|
||||||
|
</if>
|
||||||
|
<if test="deleteType != null">
|
||||||
|
#{deleteType},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDetach" parameterType="com.engine.organization.entity.detach.po.ManagerDetachPO">
|
||||||
|
update jcl_org_detach
|
||||||
|
<set>
|
||||||
|
ec_manager=#{ecManager},
|
||||||
|
jcl_Manager=#{jclManager},
|
||||||
|
ec_rolelevel=#{ecRolelevel},
|
||||||
|
jcl_rolelevel=#{jclRolelevel}
|
||||||
|
</set>
|
||||||
|
WHERE id = #{id} AND delete_type = 0
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="deleteByIds">
|
||||||
|
UPDATE jcl_org_detach
|
||||||
|
SET delete_type = 1
|
||||||
|
WHERE delete_type = 0
|
||||||
|
AND id IN
|
||||||
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</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>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getDetachById" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="baseColumns"/>
|
||||||
|
from jcl_org_detach t
|
||||||
|
WHERE delete_type = 0
|
||||||
|
AND id = #{id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.engine.organization.service;
|
||||||
|
|
||||||
|
import com.engine.organization.entity.detach.param.ManagerDetachParam;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public interface ManagerDetachService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取table列表
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> listPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建编辑表单
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> getForm(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deleteByIds(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int save(ManagerDetachParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateDetach(ManagerDetachParam param);
|
||||||
|
}
|
@ -0,0 +1,159 @@
|
|||||||
|
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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public class ManagerDetachServiceImpl extends Service implements ManagerDetachService {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String RIGHT_NAME = "MangerDeatch:All";
|
||||||
|
|
||||||
|
public ManagerDetachMapper getMangeDetachMapper() {
|
||||||
|
return MapperProxyFactory.getProxy(ManagerDetachMapper.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HrmResourceMapper getHrmResourceMapper() {
|
||||||
|
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<>();
|
||||||
|
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
||||||
|
resultMap.put("hasRight", hasRight);
|
||||||
|
if (!hasRight) {
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
OrganizationWeaTable<ManagerDetachVO> table = new OrganizationWeaTable<>(user, ManagerDetachVO.class);
|
||||||
|
String sqlWhere = buildSqlWhere(params);
|
||||||
|
table.setSqlwhere(sqlWhere);
|
||||||
|
WeaResultMsg result = new WeaResultMsg(false);
|
||||||
|
result.putAll(table.makeDataResult());
|
||||||
|
result.success();
|
||||||
|
resultMap.putAll(result.getResultMap());
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getForm(Integer id) {
|
||||||
|
Map<String, Object> apiDatas = new HashMap<>();
|
||||||
|
List<SearchConditionItem> selectItems = new ArrayList<>();
|
||||||
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||||
|
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
||||||
|
SearchConditionOption moduleOption = new SearchConditionOption("0", "组织管理",true);
|
||||||
|
selectOptions.add(moduleOption);
|
||||||
|
|
||||||
|
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");
|
||||||
|
SearchConditionItem module = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "可管理模块", "module");
|
||||||
|
module.setViewAttr(1);
|
||||||
|
module.setDetailtype(2);
|
||||||
|
module.setHasBorder(true);
|
||||||
|
if (id != null) {
|
||||||
|
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);
|
||||||
|
selectItems.add(module);
|
||||||
|
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
||||||
|
apiDatas.put("condition", addGroups);
|
||||||
|
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(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("组织管理")
|
||||||
|
.creator((long)user.getUID())
|
||||||
|
.deleteType(0)
|
||||||
|
.createTime(new Date())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return getMangeDetachMapper().insertIgnoreNull(managerDetachPO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateDetach(ManagerDetachParam param) {
|
||||||
|
ManagerDetachPO managerDetachPO = ManagerDetachPO.builder()
|
||||||
|
.id(param.getId())
|
||||||
|
.ecManager(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();
|
||||||
|
return getMangeDetachMapper().updateDetach(managerDetachPO);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildSqlWhere(Map<String, Object> params) {
|
||||||
|
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(lastName)) {
|
||||||
|
sqlWhere += " AND ec_manager in ("+ecManager+") ";
|
||||||
|
}
|
||||||
|
String ecRolelevel = (String) params.get("ecRolelevel");
|
||||||
|
if (StringUtils.isNotBlank(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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
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;
|
||||||
|
import weaver.hrm.HrmUserVarify;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description: 模块管理分权
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public class ManagerDetachController {
|
||||||
|
|
||||||
|
public ManagerDetachWrapper getManagerDetachWrapper(User user) {
|
||||||
|
return ServiceUtil.getService(ManagerDetachWrapper.class,user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/getTable")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public ReturnResult listScheme(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||||
|
return ReturnResult.successed(getManagerDetachWrapper(user).listPage(map));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ReturnResult.exceptionHandle(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/getTableBtn")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public ReturnResult getTableBtn(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return ReturnResult.successed(getManagerDetachWrapper(user).getTableBtn());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ReturnResult.exceptionHandle(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/getSearchCondition")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public ReturnResult getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return ReturnResult.successed(getManagerDetachWrapper(user).getSearchCondition());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ReturnResult.exceptionHandle(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/getForm")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public ReturnResult getForm(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
|
@QueryParam("id") Integer id) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return ReturnResult.successed(getManagerDetachWrapper(user).getForm(id));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ReturnResult.exceptionHandle(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/deleteByIds")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public ReturnResult deleteByIds(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeleteParam param) {
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
return ReturnResult.successed(getManagerDetachWrapper(user).deleteByIds(param.getIds()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
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("/update")
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
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.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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/10/21
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public class ManagerDetachWrapper extends OrganizationWrapper {
|
||||||
|
|
||||||
|
public ManagerDetachService getManagerDetachService(User user) {
|
||||||
|
return ServiceUtil.getService(ManagerDetachServiceImpl.class,user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||||
|
return getManagerDetachService(user).listPage(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, List<MenuBtn>> getTableBtn() {
|
||||||
|
return MenuBtn.getCommonBtnDatas();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getSearchCondition() {
|
||||||
|
Map<String, Object> apiDatas = new HashMap<>();
|
||||||
|
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, "可管理组织机构", "164", "ecRolelevel", "");
|
||||||
|
conditionItems.add(ecManager);
|
||||||
|
conditionItems.add(ecRolelevel);
|
||||||
|
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
||||||
|
apiDatas.put("conditions", addGroups);
|
||||||
|
return apiDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getForm(Integer id) {
|
||||||
|
return getManagerDetachService(user).getForm(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(ids), "删除等级方案");
|
||||||
|
}
|
||||||
|
return deleteByIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(operateType = OperateTypeEnum.ADD,operateModule = LogModuleNameEnum.DETACH,operateDesc = "新增分权管理员")
|
||||||
|
public int save(ManagerDetachParam param) {
|
||||||
|
int save = getManagerDetachService(user).save(param);
|
||||||
|
writeOperateLog(new Object() {
|
||||||
|
}.getClass(), String.valueOf(param.getEcManager()), JSON.toJSONString(param), "新增分权管理员");
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(), String.valueOf(managerDetachPO.getEcManager()), JSON.toJSONString(param), managerDetachPO, MapperProxyFactory.getProxy(ManagerDetachMapper.class).getDetachById(param.getId()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue