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