Procházet zdrojové kódy

新增单位权限

4.0
FLYPHT před 2 roky
rodič
revize
517fdd41b5
5 změnil soubory, kde provedl 169 přidání a 0 odebrání
  1. +67
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/AbsTreeDataRightHandler.java
  2. +34
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/DataRightGroupItem.java
  3. +24
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/DataRightHelper.java
  4. +16
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/IDataRightHandler.java
  5. +28
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/impl/PartyDataRightHandler.java

+ 67
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/AbsTreeDataRightHandler.java Zobrazit soubor

@@ -0,0 +1,67 @@
package cc.smtweb.system.bpm.web.sys.user.dataRightGroup;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.common.BpmConst;

import java.util.Map;

/**
* Created by Akmm at 2017/5/17 15:31
* 数据权限计算处理抽象类
*/
public abstract class AbsTreeDataRightHandler implements IDataRightHandler{
protected final static String menuIdKey = "_menuId";
//权限查找结果常量定义
protected final static int RIGHT_RET_NONE = 0; //未找到
protected final static int RIGHT_RET_IN_CHILD = 1;//找到,包含,且含下级
protected final static int RIGHT_RET_IN_NOCHILD = 2;//找到,包含,不含下级
protected final static int RIGHT_RET_EX = 3;//找到,不包含
protected boolean isByRight = false;//是否需要计算权限
// 用户session
protected UserSession us = null;
// 参数对象
protected SwMap params = new SwMap();

//权限组设置
protected Map<String, DataRightGroupItem> mapRight = null;

public AbsTreeDataRightHandler() {
}

public AbsTreeDataRightHandler(UserSession us,SwMap params) {
init(us,params);
}
@Override
public void init(UserSession us,SwMap params) {
this.isByRight = true;
this.us = us;
this.params = params;
String menuId = params.readString("_menuId");
if (us == null) return;
mapRight = DataRightHelper.getDataRightItemMap(getDataRightType(), menuId, us);
if (mapRight == null) return;
//将本单位处理下
DataRightGroupItem drgi = mapRight.remove(BpmConst.DataRight.CUR_VALUE);
if (drgi != null) {
DataRightGroupItem d = new DataRightGroupItem();
d.getData().putAll(drgi.getData());
final String curValue = getCurValue();
if (StringUtil.isEmpty(curValue)) return;
d.setValue(curValue);
mapRight.put(curValue, d);
}
}

/**
* 获取权限设置中CUR_VALUE对应的值
*/
protected abstract String getCurValue();

/**
* 权限类别
*/
protected abstract String getDataRightType();

}

+ 34
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/DataRightGroupItem.java Zobrazit soubor

@@ -0,0 +1,34 @@
package cc.smtweb.system.bpm.web.sys.user.dataRightGroup;

import cc.smtweb.framework.core.db.impl.BaseBean;

/**
* @Author: tanghp
* @Date: 2022-09-22 12:23
* @Desc: 数据权限分组明细项
*/
public class DataRightGroupItem extends BaseBean {
public int getKind() {
return getInt("kind");
}
// 类别 0-包含 1-排除
public void setKind(int kind) {
put("kind",kind);
}
// 权限值
public String getValue() {
return getStr("value");
}

public void setValue(String value) {
put("value",value);
}
// 树形结构有效:0-仅本级 1-含下级
public int getType() {
return getInt("type");
}

public void setType(int type) {
put("type",type);
}
}

+ 24
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/DataRightHelper.java Zobrazit soubor

@@ -0,0 +1,24 @@
package cc.smtweb.system.bpm.web.sys.user.dataRightGroup;

import cc.smtweb.framework.core.session.UserSession;

import java.util.Map;

/**
* @Author: tanghp
* @Date: 2022-09-22 11:34
* @Desc: 数据权限辅助类
*/
public class DataRightHelper {

/**
* 获取数据权限组明细
* @param dType 数据权限类型
* @param menuId 菜单ID
* @param us 用户session
* @return
*/
public static Map<String,DataRightGroupItem> getDataRightItemMap(String dType, String menuId, UserSession us ){
return null;
}
}

+ 16
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/IDataRightHandler.java Zobrazit soubor

@@ -0,0 +1,16 @@
package cc.smtweb.system.bpm.web.sys.user.dataRightGroup;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.session.UserSession;

import java.util.List;

/**
* Created by Akmm at 2017/6/17 15:01
* 数据权限处理接口
*/
public interface IDataRightHandler {
void init(UserSession us,SwMap params);
//构建sql
boolean buildSqlWhere(boolean where, String sqlField, String value, StringBuilder sql, List<Object> args);
}

+ 28
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/dataRightGroup/impl/PartyDataRightHandler.java Zobrazit soubor

@@ -0,0 +1,28 @@
package cc.smtweb.system.bpm.web.sys.user.dataRightGroup.impl;

import cc.smtweb.system.bpm.web.sys.user.dataRightGroup.AbsTreeDataRightHandler;

import java.util.*;

/**
* @Author: tanghp
* @Date: 2022-09-22 15:17
* @Desc:
*/
public class PartyDataRightHandler extends AbsTreeDataRightHandler {
@Override
protected String getCurValue() {
long partyId = us.getPartyId();
return partyId<=0L? "": String.valueOf(partyId);
}

@Override
protected String getDataRightType() {
return "partyId";
}

@Override
public boolean buildSqlWhere(boolean where, String sqlField, String value, StringBuilder sql, List<Object> args) {
return false;
}
}

Načítá se…
Zrušit
Uložit