update
This commit is contained in:
parent
57cde9c15d
commit
f198fc96ae
|
|
@ -2,6 +2,9 @@ package com.smallchill.common.beetl;
|
||||||
|
|
||||||
import org.beetl.core.GroupTemplate;
|
import org.beetl.core.GroupTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板注册
|
||||||
|
*/
|
||||||
public class BeetlRegister {
|
public class BeetlRegister {
|
||||||
|
|
||||||
public static void registerTemplate(GroupTemplate groupTemplate) {
|
public static void registerTemplate(GroupTemplate groupTemplate) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
package com.smallchill.common.beetl;
|
package com.smallchill.common.beetl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* beetl自定义函数注册
|
||||||
|
*/
|
||||||
public class BeetlTools {
|
public class BeetlTools {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端使用 : ${tool.hello()}
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public String hello() {
|
||||||
|
return "hello";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.constant.ConstShiro;
|
import com.smallchill.core.constant.ConstShiro;
|
||||||
import com.smallchill.core.intercept.QueryInterceptor;
|
import com.smallchill.core.intercept.QueryInterceptor;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
|
||||||
|
|
||||||
public class SelectDeptIntercept extends QueryInterceptor {
|
public class SelectDeptIntercept extends QueryInterceptor {
|
||||||
|
|
||||||
public void queryBefore(AopContext ac) {
|
public void queryBefore(AopContext ac) {
|
||||||
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
||||||
String depts = ShiroKit.getUser().getSuperDepts() + "," + ShiroKit.getUser().getDeptId() + "," + ShiroKit.getUser().getSubDepts();
|
String depts = ShiroKit.getUser().getSuperDepts() + "," + ShiroKit.getUser().getDeptId() + "," + ShiroKit.getUser().getSubDepts();
|
||||||
String condition = "where id in (" + StrKit.removeSuffix(depts, ",") + ")";
|
String condition = "where id in (#{join(ids)})";
|
||||||
ac.setCondition(condition);
|
ac.setCondition(condition);
|
||||||
|
ac.getParam().put("ids", depts.split(","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.constant.ConstShiro;
|
import com.smallchill.core.constant.ConstShiro;
|
||||||
import com.smallchill.core.intercept.QueryInterceptor;
|
import com.smallchill.core.intercept.QueryInterceptor;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
|
||||||
|
|
||||||
public class SelectRoleIntercept extends QueryInterceptor {
|
public class SelectRoleIntercept extends QueryInterceptor {
|
||||||
|
|
||||||
public void queryBefore(AopContext ac) {
|
public void queryBefore(AopContext ac) {
|
||||||
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
||||||
String roles = ShiroKit.getUser().getRoles() + "," + ShiroKit.getUser().getSubRoles();
|
String roles = ShiroKit.getUser().getRoles() + "," + ShiroKit.getUser().getSubRoles();
|
||||||
String condition = "where id in (" + StrKit.removeSuffix(roles, ",") + ")";
|
String condition = "where id in (#{join(ids)})";
|
||||||
ac.setCondition(condition);
|
ac.setCondition(condition);
|
||||||
|
ac.getParam().put("ids", roles.split(","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import com.smallchill.core.base.controller.BladeController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务拦截器上下文
|
* 业务拦截器上下文
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AopContext {
|
public class AopContext {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ import com.smallchill.core.annotation.Before;
|
||||||
import com.smallchill.core.interfaces.Interceptor;
|
import com.smallchill.core.interfaces.Interceptor;
|
||||||
import com.smallchill.core.toolbox.kit.HttpKit;
|
import com.smallchill.core.toolbox.kit.HttpKit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* before拦截
|
* before拦截
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ import com.smallchill.core.toolbox.support.Convert;
|
||||||
import com.smallchill.core.toolbox.support.WafRequestWrapper;
|
import com.smallchill.core.toolbox.support.WafRequestWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Chill Zhuang
|
* Blade控制器封装类
|
||||||
*/
|
*/
|
||||||
public class BladeController {
|
public class BladeController {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,7 @@ import java.util.Map;
|
||||||
import com.smallchill.core.toolbox.kit.FileKit;
|
import com.smallchill.core.toolbox.kit.FileKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Beetl静态化生成
|
* Beetl静态化生成工具类
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2015-11-6下午5:17:55
|
|
||||||
* @copyright 2015
|
|
||||||
*/
|
*/
|
||||||
public abstract class BeetlMaker {
|
public abstract class BeetlMaker {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,7 @@ import com.smallchill.core.constant.ConstConfig;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Beetl模板绑值
|
* Beetl模板绑值
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2015-11-17上午9:02:38
|
|
||||||
* @copyright 2015
|
|
||||||
*/
|
*/
|
||||||
public class BeetlTemplate {
|
public class BeetlTemplate {
|
||||||
private static GroupTemplate gt;
|
private static GroupTemplate gt;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,7 @@ import org.beetl.sql.core.NameConversion;
|
||||||
import org.beetl.sql.core.annotatoin.Table;
|
import org.beetl.sql.core.annotatoin.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 适用于oracle字段全部小写的NameConversion
|
* 适用于oracle字段全部小写的NameConversion
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2015-12-25下午2:20:14
|
|
||||||
* @copyright 2015
|
|
||||||
*/
|
*/
|
||||||
public class LowerNameConversion extends NameConversion {
|
public class LowerNameConversion extends NameConversion {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,7 @@ import com.smallchill.core.constant.Cst;
|
||||||
import com.smallchill.core.toolbox.kit.DateKit;
|
import com.smallchill.core.toolbox.kit.DateKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 重写beetlsql输出的sql语句格式
|
* 重写beetlsql输出的sql语句格式
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-28下午5:01:02
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class ReportInterceptor extends DebugInterceptor {
|
public class ReportInterceptor extends DebugInterceptor {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,7 @@ import org.beetl.sql.core.SQLManager;
|
||||||
import com.smallchill.core.interfaces.IConfig;
|
import com.smallchill.core.interfaces.IConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title blade配置
|
* blade配置
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-26上午9:40:18
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class BladeConfig {
|
public class BladeConfig {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ import com.smallchill.core.toolbox.file.IFileProxy;
|
||||||
import com.smallchill.core.toolbox.grid.JqGridFactory;
|
import com.smallchill.core.toolbox.grid.JqGridFactory;
|
||||||
import com.smallchill.core.toolbox.log.BladeLogFactory;
|
import com.smallchill.core.toolbox.log.BladeLogFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blade系统配置类
|
||||||
|
*/
|
||||||
public class Cst {
|
public class Cst {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package com.smallchill.core.intercept;
|
||||||
import com.smallchill.core.aop.AopContext;
|
import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.interfaces.IQuery;
|
import com.smallchill.core.interfaces.IQuery;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用查询拦截器工厂类
|
* 通用查询拦截器工厂类
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package com.smallchill.core.intercept;
|
||||||
import com.smallchill.core.interfaces.IQuery;
|
import com.smallchill.core.interfaces.IQuery;
|
||||||
import com.smallchill.core.interfaces.ISelect;
|
import com.smallchill.core.interfaces.ISelect;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* select查询拦截器工厂类
|
* select查询拦截器工厂类
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ package com.smallchill.core.interfaces;
|
||||||
|
|
||||||
import com.smallchill.core.constant.Cst;
|
import com.smallchill.core.constant.Cst;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blade配置型接口
|
* Blade配置型接口
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.smallchill.core.interfaces;
|
package com.smallchill.core.interfaces;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* select aop
|
* select aop
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动监听器
|
* 启动监听器
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class StartupListener implements ApplicationListener<ContextRefreshedEvent> {
|
public class StartupListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import com.smallchill.core.plugins.PluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭监听器
|
* 关闭监听器
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class StopListener implements ApplicationListener<ContextStoppedEvent> {
|
public class StopListener implements ApplicationListener<ContextStoppedEvent> {
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,11 @@ import com.smallchill.core.interfaces.IRender;
|
||||||
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 业务curd拦截器<br>
|
* 业务curd拦截器<br>
|
||||||
* 可以在增删改查前后进行操作<br>
|
* 可以在增删改查前后进行操作<br>
|
||||||
* (适用于后端校验、多表操作等)<br>
|
* (适用于后端校验、多表操作等)<br>
|
||||||
* 已自带事务回滚机制,无需自行设置<br>
|
* 已自带事务回滚机制,无需自行设置<br>
|
||||||
* 如果出错直接抛异常即可回滚<br>
|
* 如果出错直接抛异常即可回滚<br>
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-22下午1:54:21
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class MetaIntercept extends MetaTool implements IQuery, IRender, ICURD{
|
public class MetaIntercept extends MetaTool implements IQuery, IRender, ICURD{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@ import org.beetl.sql.core.annotatoin.Table;
|
||||||
import com.smallchill.core.base.model.BaseModel;
|
import com.smallchill.core.base.model.BaseModel;
|
||||||
|
|
||||||
public class MetaTool {
|
public class MetaTool {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取javabean对应的表名
|
* 获取javabean对应的表名
|
||||||
*
|
* @param clazz javabean.class
|
||||||
* @param clazz
|
|
||||||
* javabean.class
|
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getTableName(Class<? extends BaseModel> clazz) {
|
public String getTableName(Class<? extends BaseModel> clazz) {
|
||||||
return clazz.getAnnotation(Table.class).name();
|
return clazz.getAnnotation(Table.class).name();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,7 @@ import com.smallchill.core.toolbox.kit.CollectionKit;
|
||||||
import com.smallchill.core.toolbox.kit.HttpKit;
|
import com.smallchill.core.toolbox.kit.HttpKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 权限自定义检查
|
* 权限自定义检查
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-26上午8:48:52
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class PermissionCheckFactory implements ICheck {
|
public class PermissionCheckFactory implements ICheck {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,7 @@ import com.smallchill.core.constant.Cst;
|
||||||
import com.smallchill.core.interfaces.ICheck;
|
import com.smallchill.core.interfaces.ICheck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 权限检查工厂
|
* 权限检查工厂
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-26上午8:49:06
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class PermissionCheckManager {
|
public class PermissionCheckManager {
|
||||||
private final static PermissionCheckManager me = new PermissionCheckManager();
|
private final static PermissionCheckManager me = new PermissionCheckManager();
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,7 @@ import com.smallchill.core.toolbox.kit.JsonKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title grid工厂基类,封装通用分页方法
|
* grid工厂基类,封装通用分页方法
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-23上午9:41:48
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public abstract class BaseGridFactory implements IGrid{
|
public abstract class BaseGridFactory implements IGrid{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,7 @@ package com.smallchill.core.toolbox.grid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title EasyGrid封装bean
|
* EasyGrid封装bean
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-18下午4:07:50
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class EasyGrid<E> {
|
public class EasyGrid<E> {
|
||||||
/** 总记录 **/
|
/** 总记录 **/
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,7 @@ package com.smallchill.core.toolbox.grid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title JqGrid封装bean
|
* JqGrid封装bean
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-18下午4:07:57
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class JqGrid<E> {
|
public class JqGrid<E> {
|
||||||
/** 返回结果集 **/
|
/** 返回结果集 **/
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,7 @@ package com.smallchill.core.toolbox.grid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title LigerGrid封装bean
|
* LigerGrid封装bean
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-18下午4:08:06
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public final class LigerGrid<E> {
|
public final class LigerGrid<E> {
|
||||||
/** 当前页号 **/
|
/** 当前页号 **/
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义常用的 sql关键字
|
* 定义常用的 sql关键字
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SqlKeyword {
|
public class SqlKeyword {
|
||||||
private static final String EQUAL = "_equal";
|
private static final String EQUAL = "_equal";
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import com.smallchill.system.model.OperationLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统默认日志记录
|
* 系统默认日志记录
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BladeLogFactory implements ILog {
|
public class BladeLogFactory implements ILog {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,7 @@ import com.smallchill.core.interfaces.ILog;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 日志工厂
|
* 日志工厂
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-26上午10:01:06
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class BladeLogManager {
|
public class BladeLogManager {
|
||||||
private final static BladeLogManager me = new BladeLogManager();
|
private final static BladeLogManager me = new BladeLogManager();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* javabean 、 paras映射
|
* javabean 、 paras映射
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class BeanInjector {
|
public class BeanInjector {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,7 @@ import com.smallchill.core.toolbox.kit.ClassKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 单例对象创建
|
* 单例对象集合
|
||||||
* @author zhuangqian
|
|
||||||
* @email smallchill@163.com
|
|
||||||
* @date 2016-1-18上午11:13:59
|
|
||||||
* @copyright 2016
|
|
||||||
*/
|
*/
|
||||||
public class Singleton {
|
public class Singleton {
|
||||||
private static Map<Class<?>, Object> pool = new ConcurrentHashMap<Class<?>, Object>();
|
private static Map<Class<?>, Object> pool = new ConcurrentHashMap<Class<?>, Object>();
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.constant.ConstShiro;
|
import com.smallchill.core.constant.ConstShiro;
|
||||||
import com.smallchill.core.meta.PageIntercept;
|
import com.smallchill.core.meta.PageIntercept;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
|
||||||
|
|
||||||
public class DeptIntercept extends PageIntercept {
|
public class DeptIntercept extends PageIntercept {
|
||||||
|
|
||||||
public void queryBefore(AopContext ac) {
|
public void queryBefore(AopContext ac) {
|
||||||
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
||||||
String depts = ShiroKit.getUser().getDeptId() + "," + ShiroKit.getUser().getSubDepts();
|
String depts = ShiroKit.getUser().getDeptId() + "," + ShiroKit.getUser().getSubDepts();
|
||||||
String condition = "and id in (" + StrKit.removeSuffix(depts, ",") + ")";
|
String condition = "and id in (#{join(ids)})";
|
||||||
ac.setCondition(condition);
|
ac.setCondition(condition);
|
||||||
|
ac.getParam().put("ids", depts.split(","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.constant.ConstShiro;
|
import com.smallchill.core.constant.ConstShiro;
|
||||||
import com.smallchill.core.meta.PageIntercept;
|
import com.smallchill.core.meta.PageIntercept;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
|
||||||
|
|
||||||
public class RoleIntercept extends PageIntercept {
|
public class RoleIntercept extends PageIntercept {
|
||||||
|
|
||||||
public void queryBefore(AopContext ac) {
|
public void queryBefore(AopContext ac) {
|
||||||
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
if (ShiroKit.lacksRole(ConstShiro.ADMINISTRATOR)) {
|
||||||
String roles = ShiroKit.getUser().getRoles() + "," + ShiroKit.getUser().getSubRoles();
|
String roles = ShiroKit.getUser().getRoles() + "," + ShiroKit.getUser().getSubRoles();
|
||||||
String condition = "and id in (" + StrKit.removeSuffix(roles, ",") + ")";
|
String condition = "and id in (#{join(ids)})";
|
||||||
ac.setCondition(condition);
|
ac.setCondition(condition);
|
||||||
|
ac.getParam().put("ids", roles.split(","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user