等级方案、职等分权

pull/204/head
dxfeng 2 years ago
parent acccc9537c
commit 79b395fc37

@ -0,0 +1,20 @@
package com.engine.organization.entity.scheme;
import com.engine.organization.entity.TreeData;
/**
* @author:dxfeng
* @createTime: 2023/08/17
* @version: 1.0
*/
public class SchemeTreeData extends TreeData {
private String subCompanyId;
public String getSubCompanyId() {
return subCompanyId;
}
public void setSubCompanyId(String subCompanyId) {
this.subCompanyId = subCompanyId;
}
}

@ -84,6 +84,7 @@ public class SchemeDTO {
.schemeName(param.getSchemeName() == null ? null : param.getSchemeName())
.schemeDescription(param.getSchemeDescription() == null ? null : param.getSchemeDescription())
.forbiddenTag(param.getForbiddenTag() == null ? 0 : param.getForbiddenTag() ? 0 : 1)
.subCompanyId(param.getSubcompanyid())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())

@ -38,4 +38,6 @@ public class SchemeSearchParam {
*/
private Boolean forbiddenTag;
private Integer subcompanyid;
}

@ -53,4 +53,6 @@ public class SchemePO {
*/
private Date updateTime;
private Integer subCompanyId;
}

@ -18,6 +18,7 @@ import lombok.NoArgsConstructor;
"t.scheme_name," +
"t.scheme_description," +
"t.forbidden_tag," +
"t.subcompanyid," +
"t.is_used," +
"t.creator," +
"t.delete_type," +
@ -58,6 +59,9 @@ public class SchemeTableVO {
@OrganizationTableColumn(text = "方案名称", width = "25%", column = "scheme_name")
private String schemeName;
@OrganizationTableColumn(text = "所属分部", width = "25%", column = "subcompanyid",transmethod = "com.engine.organization.transmethod.CompTransMethod.getSpanById")
private String subCompanyName;
/**
*
*/

@ -1,7 +1,7 @@
package com.engine.organization.mapper.scheme;
import com.engine.organization.entity.TreeData;
import com.engine.organization.entity.scheme.SchemeTreeData;
import com.engine.organization.entity.scheme.po.SchemePO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
@ -95,7 +95,7 @@ public interface SchemeMapper {
*
* @return
*/
ArrayList<TreeData> getTreeData();
ArrayList<SchemeTreeData> getTreeData();
List<SchemePO> getSchemesByIds(@Param("ids")Collection<Long> ids);
}

@ -12,12 +12,14 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="is_used" property="isUsed"/>
<result column="subcompanyid" property="subCompanyId"/>
</resultMap>
<resultMap id="TreeResultMap" type="com.engine.organization.entity.TreeData">
<resultMap id="TreeResultMap" type="com.engine.organization.entity.scheme.SchemeTreeData">
<result column="id" property="key"/>
<result column="scheme_name" property="title"/>
<result column="forbidden_tag" property="status"/>
<result column="subcompanyid" property="subCompanyId"/>
</resultMap>
<!-- 表字段 -->
@ -34,6 +36,7 @@
, t.create_time
, t.update_time
, t.is_used
, t.subcompanyid
</sql>
<select id="listByNo" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
@ -41,7 +44,8 @@
<include refid="baseColumns"/>
from jcl_org_scheme t where scheme_no = #{schemeNo} AND delete_type = 0
</select>
<select id="getSchemeByNo" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
<select id="getSchemeByNo" 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
@ -82,9 +86,11 @@
where delete_type = 0
</select>
<select id="getTreeData" resultMap="TreeResultMap">
select id, scheme_name,forbidden_tag
select id, scheme_name, forbidden_tag, subcompanyid
from jcl_org_scheme
where delete_type = '0' and forbidden_tag = 0 order by scheme_no
where delete_type = '0'
and forbidden_tag = 0
order by scheme_no
</select>
<select id="getSchemesByIds" resultMap="BaseResultMap">
select
@ -125,6 +131,9 @@
<if test="isUsed != null ">
is_used,
</if>
<if test="subCompanyId != null ">
subcompanyid,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -152,12 +161,15 @@
<if test="isUsed != null ">
#{isUsed},
</if>
<if test="subCompanyId != null ">
#{subCompanyId},
</if>
0,
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.SchemePO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_SCHEME_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_scheme
@ -186,6 +198,9 @@
<if test="isUsed != null ">
is_used,
</if>
<if test="subCompanyId != null ">
subcompanyid,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -213,6 +228,9 @@
<if test="isUsed != null ">
#{isUsed},
</if>
<if test="subCompanyId != null ">
#{subCompanyId},
</if>
0,
</trim>
</insert>
@ -225,6 +243,7 @@
scheme_no=#{schemeNo},
scheme_name=#{schemeName},
scheme_description=#{schemeDescription},
subcompanyid = #{subCompanyId},
</set>
WHERE id = #{id} AND delete_type = 0
</update>

@ -19,6 +19,7 @@ import com.engine.organization.service.GradeService;
import com.engine.organization.util.*;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
@ -245,6 +246,12 @@ public class GradeServiceImpl extends Service implements GradeService {
if (StringUtils.isNotBlank(viewCondition) && !"-1".equalsIgnoreCase(viewCondition)) {
sqlWhere += " AND t.forbidden_tag = '" + viewCondition + "'";
}
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
String jclRoleLevels = detachUtil.getJclRoleLevels();
sqlWhere += " and a.subcompanyid in (" + jclRoleLevels + ")";
}
return sqlWhere;
}

@ -5,8 +5,8 @@ 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.TreeData;
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
import com.engine.organization.entity.scheme.SchemeTreeData;
import com.engine.organization.entity.scheme.dto.SchemeDTO;
import com.engine.organization.entity.scheme.param.SchemeSearchParam;
import com.engine.organization.entity.scheme.po.SchemePO;
@ -14,8 +14,10 @@ import com.engine.organization.entity.scheme.vo.SchemeTableVO;
import com.engine.organization.mapper.scheme.SchemeMapper;
import com.engine.organization.service.SchemeService;
import com.engine.organization.util.*;
import com.engine.organization.util.browser.OrganizationBrowserUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.detach.DetachUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
@ -122,6 +124,7 @@ public class SchemeServiceImpl extends Service implements SchemeService {
schemeNameCondition.setRules("required|string");
SearchConditionItem schemeNoCondition = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "方案编号", "schemeNo");
schemeNoCondition.setRules("required|string");
SearchConditionItem subCompanyIdItem = OrganizationFormItemUtil.browserItem(user, 2, 17, 2, false, "所属分部", "164", "subCompanyId", "");
SearchConditionItem textareaItem = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 200, "方案说明", "schemeDescription");
// 编辑状态下赋值操作
@ -132,6 +135,7 @@ public class SchemeServiceImpl extends Service implements SchemeService {
schemeNameCondition.setValue(schemePO.getSchemeName());
schemeNoCondition.setValue(schemePO.getSchemeNo());
textareaItem.setValue(schemePO.getSchemeDescription());
OrganizationBrowserUtil.assignBrowser(user, Util.null2String(schemePO.getSubCompanyId()), 164, subCompanyIdItem);
// 编辑状态下,编号只读
// schemeNoCondition.setViewAttr(1);
@ -139,6 +143,7 @@ public class SchemeServiceImpl extends Service implements SchemeService {
selectItems.add(schemeNoCondition);
selectItems.add(schemeNameCondition);
selectItems.add(subCompanyIdItem);
selectItems.add(textareaItem);
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
apiDatas.put("condition", addGroups);
@ -152,18 +157,15 @@ public class SchemeServiceImpl extends Service implements SchemeService {
@Override
public List<TypeTreeVO> getTreeData() {
ArrayList<TreeData> treeDataList = getSchemeMapper().getTreeData();
TypeTreeVO build = TypeTreeVO.builder()
.childs(treeDataList.stream().map(e ->
TypeTreeVO.builder()
.domid(e.getKey())
.key(Long.parseLong(e.getKey()))
.name(e.getStatus() == 0 ? e.getTitle() : e.getTitle()+"(已禁用)")
.build()).collect(Collectors.toList()))
.haschild(true)
.domid("-1")
.key(-1L)
.name("全部方案").build();
List<SchemeTreeData> treeDataList = getSchemeMapper().getTreeData();
DetachUtil detachUtil = new DetachUtil(user);
if(detachUtil.isDETACH()){
String jclRoleLevels = detachUtil.getJclRoleLevels();
List<String> asList = Arrays.asList(jclRoleLevels.split(","));
treeDataList = treeDataList.stream().filter(item->asList.contains(item.getSubCompanyId())).collect(Collectors.toList());
}
List<TypeTreeVO> childList = treeDataList.stream().map(e -> TypeTreeVO.builder().domid(e.getKey()).key(Long.parseLong(e.getKey())).name(e.getStatus() == 0 ? e.getTitle() : e.getTitle() + "(已禁用)").build()).collect(Collectors.toList());
TypeTreeVO build = TypeTreeVO.builder().childs(childList).haschild(true).domid("-1").key(-1L).name("全部方案").build();
List<TypeTreeVO> typeTreeVOS = new ArrayList<>();
typeTreeVOS.add(build);
return typeTreeVOS;
@ -188,6 +190,13 @@ public class SchemeServiceImpl extends Service implements SchemeService {
if (StringUtils.isNotBlank(no)) {
sqlWhere += " AND scheme_no " + dbType.like(no);
}
DetachUtil detachUtil = new DetachUtil(user);
if (detachUtil.isDETACH()) {
String jclRoleLevels = detachUtil.getJclRoleLevels();
sqlWhere += " and subcompanyid in (" + jclRoleLevels + ")";
}
return sqlWhere;
}

Loading…
Cancel
Save