|
@@ -5,7 +5,12 @@ import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
|
import com.jfinal.server.undertow.UndertowServer;
|
|
import com.jfinal.server.undertow.UndertowServer;
|
|
|
import com.jfinal.template.Engine;
|
|
import com.jfinal.template.Engine;
|
|
|
|
|
+import common.interceptor.AuthInterceptor;
|
|
|
|
|
+import common.interceptor.ExceptionInterceptor;
|
|
|
|
|
+import common.interceptor.empty.EmptyInterceptor;
|
|
|
|
|
+import common.model._MappingKit;
|
|
|
import modules.hello.HelloController;
|
|
import modules.hello.HelloController;
|
|
|
|
|
+import modules.user.UserController;
|
|
|
|
|
|
|
|
public class AppConfig extends JFinalConfig {
|
|
public class AppConfig extends JFinalConfig {
|
|
|
static String DB_URL = System.getenv("DB_URL");
|
|
static String DB_URL = System.getenv("DB_URL");
|
|
@@ -30,6 +35,8 @@ public class AppConfig extends JFinalConfig {
|
|
|
@Override
|
|
@Override
|
|
|
public void configRoute(Routes routes) {
|
|
public void configRoute(Routes routes) {
|
|
|
routes.add("/", HelloController.class);
|
|
routes.add("/", HelloController.class);
|
|
|
|
|
+
|
|
|
|
|
+ routes.add("/user", UserController.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -46,15 +53,20 @@ public class AppConfig extends JFinalConfig {
|
|
|
// 是否打印SQL
|
|
// 是否打印SQL
|
|
|
arp.setShowSql(DEV_MODE.equals("1"));
|
|
arp.setShowSql(DEV_MODE.equals("1"));
|
|
|
// 加载sql模板
|
|
// 加载sql模板
|
|
|
-// arp.addSqlTemplate("/common/all.sqlt");
|
|
|
|
|
|
|
+ arp.addSqlTemplate("/common/all.sqlt");
|
|
|
// 映射实体
|
|
// 映射实体
|
|
|
-// _MappingKit.mapping(arp);
|
|
|
|
|
|
|
+ _MappingKit.mapping(arp);
|
|
|
plugins.add(arp);
|
|
plugins.add(arp);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void configInterceptor(Interceptors interceptors) {
|
|
public void configInterceptor(Interceptors interceptors) {
|
|
|
-
|
|
|
|
|
|
|
+ // 配置全局异常拦截器
|
|
|
|
|
+ interceptors.addGlobalActionInterceptor(new ExceptionInterceptor());
|
|
|
|
|
+ // 配置全局参数拦截校验器
|
|
|
|
|
+ interceptors.addGlobalActionInterceptor(new EmptyInterceptor());
|
|
|
|
|
+ // 配置全局权限校验拦截器
|
|
|
|
|
+ interceptors.addGlobalActionInterceptor(new AuthInterceptor());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|