@@ -323,7 +323,8 @@ public class ModelFormHelper { | |||
ret.put("idField", dataSet.idField); | |||
ret.put("lazy", dataSet.lazy); | |||
ret.put("canEdit", dataSet.canEdit); | |||
ret.put("virtual", dataSet.virtual); | |||
ret.put("linkClob", model.get("linkClob")); | |||
ret.put("fields", model.get("fields")); | |||
ret.put("filters", model.get("filters")); | |||
@@ -13,13 +13,18 @@ import cc.smtweb.framework.core.mvc.service.AbstractCompService; | |||
import cc.smtweb.framework.core.mvc.service.AbstractHandler; | |||
import cc.smtweb.framework.core.mvc.service.DefaultListHandler; | |||
import cc.smtweb.framework.core.session.UserSession; | |||
import cc.smtweb.framework.core.util.CommUtil; | |||
import cc.smtweb.framework.core.util.SqlUtil; | |||
import cc.smtweb.system.bpm.util.CodeGenerator; | |||
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache; | |||
import cc.smtweb.system.bpm.web.sys.user.dataRight.DataRightDefine; | |||
import cc.smtweb.system.bpm.web.sys.user.dataRight.DataRightDefineCache; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.sql.ResultSetMetaData; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Set; | |||
/** | |||
* Created by Akmm at 2022/3/22 9:12 | |||
@@ -204,4 +209,35 @@ public class ModelFormService extends AbstractCompService { | |||
return R.error("操作失败!", e); | |||
} | |||
} | |||
// 获取数据权限类型 | |||
public R loadDataRightType(@SwBody SwMap params, UserSession us) { | |||
try { | |||
long prj_id = params.readLong("prj_id"); | |||
List<SwMap> rtData = new ArrayList<>(); | |||
if(prj_id<=0){ | |||
return R.success(rtData); | |||
} | |||
// 查项目所依赖的项目 | |||
Set<Long> ids = ModelProjectCache.getInstance().getDependsPrjIds(prj_id); | |||
if(CommUtil.isEmpty(ids)){ | |||
return R.success(rtData); | |||
} | |||
ids.forEach(id -> { | |||
// 取数据权限定义 | |||
Set<DataRightDefine> dfs = DataRightDefineCache.getInstance().getByMp(id.toString()); | |||
if(!CommUtil.isEmpty(dfs)){ | |||
dfs.forEach(bean -> { | |||
SwMap map = new SwMap(); | |||
map.put("value",bean.getId()); | |||
map.put("label",bean.getName()); | |||
map.put("bean",bean); | |||
rtData.add(map); | |||
}); | |||
} | |||
}); | |||
return R.success(rtData); | |||
} catch (Exception e) { | |||
return R.error("操作失败!", e); | |||
} | |||
} | |||
} |
@@ -10,4 +10,6 @@ public class PageDatasetFilter extends BaseDatasetField { | |||
// 触发类型 click按钮触发;change监听触发 | |||
public String trigger; | |||
public boolean required = false; | |||
// 数据权限类型ID | |||
public long dataRightType; | |||
} |
@@ -34,17 +34,18 @@ public class LoginHelper { | |||
if (StringUtils.isBlank(loginPO.getUsername())) { | |||
throw new BizException("账号不能为空"); | |||
} | |||
if (StringUtils.isBlank(loginPO.getPassword())) { | |||
throw new BizException("密码不能为空"); | |||
} | |||
if (StringUtils.isBlank(loginPO.getVerifyCode())) { | |||
throw new BizException("验证码不能为空"); | |||
} | |||
if (!loginPO.getVerifyCode().equalsIgnoreCase(verifyCode)) { | |||
throw new BizException("验证码错误"); | |||
if(!SwConsts.SysParam.SYS_DEBUG){ | |||
if (StringUtils.isBlank(loginPO.getPassword())) { | |||
throw new BizException("密码不能为空"); | |||
} | |||
if (StringUtils.isBlank(loginPO.getVerifyCode())) { | |||
throw new BizException("验证码不能为空"); | |||
} | |||
if (!loginPO.getVerifyCode().equalsIgnoreCase(verifyCode)) { | |||
throw new BizException("验证码错误"); | |||
} | |||
} | |||
//查询数据库 | |||
@@ -57,15 +58,15 @@ public class LoginHelper { | |||
// if (user == null) { | |||
// throw new BizException("账号或者密码出错"); | |||
// } | |||
if (!verifyPwd(user, loginPO.getPassword())) { | |||
throw new BizException("账号或者密码出错"); | |||
if(!SwConsts.SysParam.SYS_DEBUG){ | |||
if (!verifyPwd(user, loginPO.getPassword())) { | |||
throw new BizException("账号或者密码出错"); | |||
} | |||
if (SwEnum.UserStatu.NORMAL.value != user.getStatu()) { | |||
throw new BizException("账户状态异常"); | |||
} | |||
} | |||
if (SwEnum.UserStatu.NORMAL.value != user.getStatu()) { | |||
throw new BizException("账户状态异常"); | |||
} | |||
return user; | |||
} | |||
@@ -4,7 +4,7 @@ import cc.smtweb.framework.core.annotation.SwTable; | |||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||
/** | |||
* Created by 1 at 2022-08-03 16:27:55 | |||
* Created by 1 at 2022-09-19 16:55:23 | |||
* 实体【[数据权限定义](SYS_DATA_RIGHT_DEFINE)】的Entity类 | |||
*/ | |||
@SwTable("SYS_DATA_RIGHT_DEFINE") | |||
@@ -15,59 +15,67 @@ public class DataRightDefine extends DefaultEntity { | |||
super(ENTITY_NAME); | |||
} | |||
/** | |||
* 主键 | |||
*/ | |||
/** 主键 */ | |||
public long getId() { | |||
return getLong("sdrd_id"); | |||
} | |||
/** | |||
* 主键 | |||
*/ | |||
/** 主键 */ | |||
public void setId(long sdrd_id) { | |||
put("sdrd_id", sdrd_id); | |||
} | |||
/** | |||
* 编码 | |||
*/ | |||
/** 编码 */ | |||
public String getCode() { | |||
return getStr("sdrd_code"); | |||
} | |||
/** | |||
* 编码 | |||
*/ | |||
/** 编码 */ | |||
public void setCode(String sdrd_code) { | |||
put("sdrd_code", sdrd_code); | |||
} | |||
/** | |||
* 名称 | |||
*/ | |||
/** 名称 */ | |||
public String getName() { | |||
return getStr("sdrd_name"); | |||
} | |||
/** | |||
* 名称 | |||
*/ | |||
/** 名称 */ | |||
public void setName(String sdrd_name) { | |||
put("sdrd_name", sdrd_name); | |||
} | |||
/** | |||
* 备注 | |||
*/ | |||
/** 备注 */ | |||
public String getRemark() { | |||
return getStr("sdrd_remark"); | |||
} | |||
/** | |||
* 备注 | |||
*/ | |||
/** 备注 */ | |||
public void setRemark(String sdrd_remark) { | |||
put("sdrd_remark", sdrd_remark); | |||
} | |||
/** 控件模型 */ | |||
public long getWidget() { | |||
return getLong("sdrd_widget"); | |||
} | |||
/** 控件模型 */ | |||
public void setWidget(long sdrd_widget) { | |||
put("sdrd_widget", sdrd_widget); | |||
} | |||
/** 所属项目 */ | |||
public long getMpId() { | |||
return getLong("sdrd_mp_id"); | |||
} | |||
/** 所属项目 */ | |||
public void setMpId(long sdrd_mp_id) { | |||
put("sdrd_mp_id", sdrd_mp_id); | |||
} | |||
/** 所属目录 */ | |||
public long getMcId() { | |||
return getLong("sdrd_mc_id"); | |||
} | |||
/** 所属目录 */ | |||
public void setMcId(long sdrd_mc_id) { | |||
put("sdrd_mc_id", sdrd_mc_id); | |||
} | |||
} |
@@ -4,14 +4,18 @@ import cc.smtweb.framework.core.annotation.SwCache; | |||
import cc.smtweb.framework.core.cache.AbstractEntityCache; | |||
import cc.smtweb.framework.core.cache.CacheManager; | |||
import java.util.Set; | |||
/** | |||
* Created by 1 at 2022-08-03 16:27:55 | |||
* Created by 1 at 2022-09-19 16:55:23 | |||
* 实体【[数据权限定义](SYS_DATA_RIGHT_DEFINE)】的缓存类 | |||
*/ | |||
@SwCache(ident = "SYS_DATA_RIGHT_DEFINE", title = "数据权限定义") | |||
public class DataRightDefineCache extends AbstractEntityCache<DataRightDefine> { | |||
//缓存key:按编码 | |||
public final static String mk_code = "code"; | |||
//缓存key:按所属项目 | |||
public final static String mk_mp = "mp"; | |||
public static DataRightDefineCache getInstance() { | |||
return CacheManager.getIntance().getCache(DataRightDefineCache.class); | |||
@@ -20,10 +24,16 @@ public class DataRightDefineCache extends AbstractEntityCache<DataRightDefine> { | |||
public DataRightDefineCache() { | |||
//缓存key:按编码 | |||
regMap(mk_code, "sdrd_code"); | |||
//缓存key:按所属项目 | |||
regList(mk_mp, "sdrd_mp_id"); | |||
} | |||
//缓存key:按编码 | |||
public final DataRightDefine getByCode(String key) { | |||
return getByKey(mk_code, key); | |||
} | |||
//缓存key:按所属项目 | |||
public final Set<DataRightDefine> getByMp(String key) { | |||
return getListByKey(mk_mp, key); | |||
} | |||
} |