├── .classpath ├── .gitignore ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── README.MD ├── config ├── app.properties ├── beetl.properties ├── config.properties ├── ehcache-shiro.xml ├── log4j.properties ├── shiro.ini └── urlrules.properties ├── database └── db.sql ├── jfinal └── com │ └── jfinal │ └── ext │ └── plugin │ └── shiro │ ├── AbstractAuthzHandler.java │ ├── AuthenticatedAuthzHandler.java │ ├── AuthzHandler.java │ ├── ClearShiro.java │ ├── CompositeAuthzHandler.java │ ├── GuestAuthzHandler.java │ ├── PermissionAuthzHandler.java │ ├── RoleAuthzHandler.java │ ├── ShiroInterceptor.java │ ├── ShiroKit.java │ ├── ShiroMethod.java │ ├── ShiroPlugin.java │ └── UserAuthzHandler.java ├── src └── com │ └── cnvp │ └── paladin │ ├── controller │ ├── DeptController.java │ ├── GeneratorController.java │ ├── IndexController.java │ ├── PassportController.java │ ├── ResourceController.java │ ├── RoleController.java │ ├── SystemController.java │ └── UserController.java │ ├── core │ ├── BaseController.java │ ├── BaseModel.java │ ├── MysqlBuilder.java │ ├── TypeConverter.java │ ├── appConfig.java │ └── criteria.txt │ ├── handler │ ├── CookieHandler.java │ ├── RewriteHandler.java │ └── SessionHandler.java │ ├── interceptor │ ├── Global.java │ └── Shiro.java │ ├── kit │ ├── ClassKit.java │ ├── ConfigKit.java │ ├── JstreeKit.java │ ├── JstreeNode.java │ ├── JstreeNodeState.java │ ├── PropertyKit.java │ ├── StringKit.java │ └── tree │ │ ├── TreeKit.java │ │ └── TreeNode.java │ ├── model │ ├── SysDept.java │ ├── SysNav.java │ ├── SysRes.java │ ├── SysRole.java │ ├── SysRoleRes.java │ ├── SysUser.java │ └── SysUserRole.java │ ├── plugin │ ├── AutoTableBindPlugin.java │ ├── TableBind.java │ ├── TableNameStyle.java │ └── shiro │ │ ├── AuthorizationFilter4Shiro.java │ │ └── ShiroDbRealm.java │ ├── service │ ├── DbService.java │ ├── GeneratoService.java │ └── NavService.java │ └── utils │ ├── AutoRoutes.java │ └── beetl │ ├── BeetlRender.java │ ├── BeetlRenderFactory.java │ ├── BeetlShiro.java │ └── fn │ ├── DateFormat.java │ └── FileSize.java └── wwwroot ├── META-INF └── MANIFEST.MF ├── Static ├── css │ ├── admin.css │ └── pintuer.css ├── images │ ├── face.jpg │ ├── icons │ │ ├── back.png │ │ ├── blank.gif │ │ ├── cancel.png │ │ ├── clearup.png │ │ ├── coins.png │ │ ├── config.png │ │ ├── cut.png │ │ ├── data_config.png │ │ ├── edit_add.png │ │ ├── edit_remove.png │ │ ├── export.png │ │ ├── filesave.png │ │ ├── filter.png │ │ ├── group_key.png │ │ ├── help.png │ │ ├── import.png │ │ ├── key.png │ │ ├── large_chart.png │ │ ├── large_clipart.png │ │ ├── large_picture.png │ │ ├── large_shapes.png │ │ ├── large_smartart.png │ │ ├── logout.png │ │ ├── member1.png │ │ ├── member2.png │ │ ├── member3.png │ │ ├── mini_add.png │ │ ├── mini_edit.png │ │ ├── mini_refresh.png │ │ ├── no.png │ │ ├── ok.png │ │ ├── pencil.png │ │ ├── print.png │ │ ├── redo.png │ │ ├── reload.png │ │ ├── search.png │ │ ├── sum.png │ │ ├── tip.png │ │ └── undo.png │ ├── index.jpg │ ├── login.jpg │ ├── logo.bak.png │ ├── logo.png │ └── passcode.jpg └── js │ ├── admin.js │ ├── icon.js │ ├── jquery.form.js │ ├── jquery.js │ ├── jquery.tmpl.js │ ├── jstree │ ├── jstree.js │ ├── jstree.min.js │ └── themes │ │ ├── default-dark │ │ ├── 32px.png │ │ ├── 40px.png │ │ ├── style.css │ │ ├── style.min.css │ │ └── throbber.gif │ │ └── default │ │ ├── 32px.png │ │ ├── 40px.png │ │ ├── style.css │ │ ├── style.min.css │ │ └── throbber.gif │ ├── pintuer.js │ ├── respond.js │ └── ztree │ ├── .gitignore │ ├── css │ ├── demo.css │ └── zTreeStyle │ │ ├── img │ │ ├── diy │ │ │ ├── 1_close.png │ │ │ ├── 1_open.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ ├── 8.png │ │ │ └── 9.png │ │ ├── line_conn.gif │ │ ├── loading.gif │ │ ├── zTreeStandard.gif │ │ └── zTreeStandard.png │ │ └── zTreeStyle.css │ └── js │ ├── jquery.ztree.all-3.5.js │ ├── jquery.ztree.all-3.5.min.js │ ├── jquery.ztree.core-3.5.js │ ├── jquery.ztree.core-3.5.min.js │ ├── jquery.ztree.excheck-3.5.js │ ├── jquery.ztree.excheck-3.5.min.js │ ├── jquery.ztree.exedit-3.5.js │ ├── jquery.ztree.exedit-3.5.min.js │ ├── jquery.ztree.exedit.js │ ├── jquery.ztree.exhide-3.5.js │ └── jquery.ztree.exhide-3.5.min.js ├── Template ├── Dept │ ├── form.html │ └── index.html ├── Generator │ ├── controller_code.html │ ├── controller_code_normal.html │ ├── model_code.html │ ├── model_code_normal.html │ ├── tables.html │ ├── view_code.html │ ├── view_code_form.html │ └── view_code_index.html ├── Passport │ └── login.html ├── Resource │ ├── form.html │ ├── index.html │ └── indexbak.html ├── Role │ ├── form.html │ └── index.html ├── common │ ├── close.html │ └── paginate.html ├── index.html ├── layout │ ├── default.html │ └── page.html ├── password.html ├── profile.html ├── system │ ├── index.html │ ├── nav.html │ └── nav_form.html ├── user │ ├── form.html │ └── index.html └── welcome.html └── WEB-INF ├── .gitignore ├── config.properties ├── lib ├── activation-1.1.jar ├── beetl-core-2.1.3-sources.jar ├── beetl-core-2.1.3.jar ├── commons-beanutils-1.9.2.jar ├── commons-collections-3.2.jar ├── commons-logging-1.2.jar ├── druid-1.0.9.jar ├── ehcache-2.9.0.jar ├── jetty-server-8.1.8.jar ├── jfinal-1.9-bin-with-src.jar ├── log4j-1.2.17.jar ├── mysql-connector-java-5.1.26-bin.jar ├── shiro-all-1.2.3.jar ├── slf4j-api-1.6.6.jar └── slf4j-log4j12-1.7.10.jar └── web.xml /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | /.idea/* 3 | Paladin.iml 4 | /out/* -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Paladin 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.compliance=1.6 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.6 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | ##Paladin是啥? 2 | 3 | 它是一个以JFinal为底层的java`基础后台框架`。 4 | 5 | 结合了以下第三方组件: 6 | 7 | `Beetl`、`Druid`、`Shiro`、`Ehcache`(JFinal自带有工具类)。 8 | 9 | 界面使用的[`拼图`](http://www.pintuer.com/)的后台模板,自己做了些优化和更改。 10 | 11 | 12 | 13 | `最初目的`:为了学习jfinal,通过一点点的摸索,把它建立起来了。 14 | 15 | `最终理想`:形成一个工作中比较通用的基础后台框架。 16 | 17 | `适用人群` 18 | 19 | * 刚入门JFinal的同学,可以拿过去做个参考 20 | 21 | * 各种大牛,看过、路过,给点指导,求虐求喷 22 | 23 | ##部署方式 24 | 25 | 1、还原数据库文件;在app.properties中修改数据库配置 26 | 27 | 2、项目导入Eclipse,按照JFinal手册中的方式配置Java Applcation,使用jetty启动项目。 28 | 29 | 3、默认账号/密码:superadmin/asdasd 30 | 31 | 32 | ##交流 33 | QQ群:240452848 34 | 35 | 欢迎大家前来交流,给予宝贵的建议。 36 | 37 | 希望能在社区的力量下(高人指点、建议;喷子鄙视、虐待)下,逐步完善,让众人受益。 38 | 39 | 现在项目的难度还不是很高,功能、操作、代码都还有很大的提升空间。 40 | 41 | 所以有兴趣的兄弟,可以多多提交`Pull Requests`。 42 | 43 | 同一个功能,同一个操作,每个人都有自己的解决方案;可以拿出来聊一聊,比一比,哪种更加科学、实用。 44 | 45 | 就当是一场游戏,大家一起打怪,各路神仙,各显神通。让我们一起享受其中的乐趣吧^_^ 46 | 47 | ##目前初步已经完成的功能,很多还需要完善、改进 48 | * 基础功能 49 | * 登陆、注销 50 | * 访问页面时,更具ActionKey获取WildcardPermission并进行权限判断 51 | * 开始 52 | * 欢迎使用 53 | * 个人资料 54 | * 修改密码 55 | * 系统 56 | * 系统设置 57 | * 组织机构 58 | * 用户管理 59 | * 角色管理 60 | * 资源管理 61 | * 导航管理 62 | * 开发 63 | * 模型代码模板预览 64 | * 控制器代码模板预览 65 | * 视图代码模板预览 66 | 67 | ## 为啥要叫它Paladin? 68 | 69 | Paladin翻译过来貌似是游侠、圣骑士的意思。感觉这个名字挺酷的,所以它就叫这个吧。 -------------------------------------------------------------------------------- /config/app.properties: -------------------------------------------------------------------------------- 1 | #config.devModel = flase 2 | app.devModel = true 3 | app.name = website 4 | default_contorller = Index 5 | #default_action = index 6 | jdbc.driverClassName=com.mysql.jdbc.Driver 7 | jdbc.url=jdbc:mysql://127.0.0.1:3306/cjf?characterEncoding=utf-8&autoReconnect=true 8 | jdbc.username=root 9 | jdbc.password=root 10 | jdbc.dbName=cjf 11 | jdbc.dbPrefix=cnvp_ -------------------------------------------------------------------------------- /config/beetl.properties: -------------------------------------------------------------------------------- 1 | RESOURCE.root=/Template 2 | DELIMITER_STATEMENT_START= 3 | DELIMITER_STATEMENT_END=?> 4 | 5 | FN.fileSize = com.cnvp.paladin.utils.beetl.fn.FileSize 6 | FT.dateFormat = com.cnvp.paladin.utils.beetl.fn.DateFormat 7 | #shiro\u81ea\u5b9a\u4e49\u51fd\u6570 8 | FNP.shiro = com.cnvp.paladin.utils.beetl.BeetlShiro -------------------------------------------------------------------------------- /config/config.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/config/config.properties -------------------------------------------------------------------------------- /config/ehcache-shiro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 22 | 23 | 24 | 32 | -------------------------------------------------------------------------------- /config/log4j.properties: -------------------------------------------------------------------------------- 1 | #\u53ef\u4ee5\u8bbe\u7f6e\u7ea7\u522b\uff1adebug>info>error 2 | #debug\uff1a\u663e\u793adebug\u3001info\u3001error 3 | #info\uff1a\u663e\u793ainfo\u3001error 4 | #error\uff1a\u53eaerror 5 | #log4j.rootLogger=debug,appender1 6 | #log4j.rootLogger=info,appender1 7 | log4j.rootLogger=error,appender1 8 | 9 | #\u8f93\u51fa\u5230\u63a7\u5236\u53f0 10 | log4j.appender.appender1=org.apache.log4j.ConsoleAppender 11 | #\u6837\u5f0f\u4e3aTTCCLayout 12 | log4j.appender.appender1.layout=org.apache.log4j.TTCCLayout -------------------------------------------------------------------------------- /config/shiro.ini: -------------------------------------------------------------------------------- 1 | [main] 2 | #********************realm******************** 3 | DbRealm = com.cnvp.paladin.plugin.shiro.ShiroDbRealm 4 | #----------------------------------------------------- 5 | securityManager.realm = $DbRealm 6 | #********************cache******************** 7 | shiroCacheManager = org.apache.shiro.cache.ehcache.EhCacheManager 8 | shiroCacheManager.cacheManagerConfigFile = classpath:ehcache-shiro.xml 9 | #----------------------------------------------------- 10 | securityManager.cacheManager = $shiroCacheManager 11 | #********************session******************** 12 | sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO 13 | sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager 14 | sessionDAO.activeSessionsCacheName = shiro-activeSessionCache 15 | sessionManager.sessionDAO = $sessionDAO 16 | #----------------------------------------------------- 17 | securityManager.sessionManager = $sessionManager 18 | securityManager.sessionManager.globalSessionTimeout = 360000 19 | #************************************************************ 20 | #这里的规则,web.xml中的配置的ShiroFilter会使用到。 21 | [filters] 22 | app_auth=com.cnvp.paladin.plugin.shiro.AuthorizationFilter4Shiro 23 | app_auth.loginUrl = /Passport/login 24 | [urls] 25 | /Static/** = anon 26 | /Passport/* = anon 27 | /** = app_auth -------------------------------------------------------------------------------- /config/urlrules.properties: -------------------------------------------------------------------------------- 1 | #/aaaa = /login -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/AbstractAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.SecurityUtils; 19 | import org.apache.shiro.subject.Subject; 20 | 21 | /** 22 | * 访问控制抽象基类 23 | * @author dafei 24 | */ 25 | abstract class AbstractAuthzHandler implements AuthzHandler { 26 | 27 | /** 28 | * 获得Shiro的Subject对象。 29 | * @return 30 | */ 31 | protected Subject getSubject() { 32 | return SecurityUtils.getSubject(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/AuthenticatedAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.authz.AuthorizationException; 19 | import org.apache.shiro.authz.UnauthenticatedException; 20 | 21 | /** 22 | * 已认证通过访问控制处理器 23 | * 单例模式运行。 24 | * 25 | * @author dafei 26 | * 27 | */ 28 | class AuthenticatedAuthzHandler extends AbstractAuthzHandler { 29 | 30 | private static AuthenticatedAuthzHandler aah = new AuthenticatedAuthzHandler(); 31 | 32 | private AuthenticatedAuthzHandler(){} 33 | 34 | public static AuthenticatedAuthzHandler me(){ 35 | return aah; 36 | } 37 | 38 | @Override 39 | public void assertAuthorized() throws AuthorizationException { 40 | if (!getSubject().isAuthenticated() ) { 41 | throw new UnauthenticatedException( "The current Subject is not authenticated. Access denied." ); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/AuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.authz.AuthorizationException; 19 | 20 | /** 21 | * 访问控制处理器接口 22 | * @author dafei 23 | * 24 | */ 25 | interface AuthzHandler { 26 | /** 27 | * 访问控制检查 28 | * @throws AuthorizationException 授权异常 29 | */ 30 | public void assertAuthorized()throws AuthorizationException; 31 | } 32 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/ClearShiro.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Inherited; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * 用来清除所有的Shiro访问控制注解,适合于Controller绝大部分方法都需要做访问控制,个别不需要做访问控制的场合。 26 | * 仅能用在方法上。 27 | * @author dafei 28 | */ 29 | @Inherited 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ElementType.METHOD}) 32 | public @interface ClearShiro { 33 | } 34 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/CompositeAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import java.util.List; 19 | 20 | import org.apache.shiro.authz.AuthorizationException; 21 | 22 | /** 23 | * 组合模式访问控制处理器 24 | * @author dafei 25 | * 26 | */ 27 | class CompositeAuthzHandler implements AuthzHandler { 28 | 29 | private final List authzHandlers; 30 | 31 | public CompositeAuthzHandler(List authzHandlers){ 32 | this.authzHandlers = authzHandlers; 33 | } 34 | 35 | @Override 36 | public void assertAuthorized() throws AuthorizationException { 37 | for(AuthzHandler authzHandler : authzHandlers){ 38 | authzHandler.assertAuthorized(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/GuestAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.authz.AuthorizationException; 19 | import org.apache.shiro.authz.UnauthenticatedException; 20 | 21 | /** 22 | * 访客访问控制处理器 23 | * @author dafei 24 | * 25 | */ 26 | class GuestAuthzHandler extends AbstractAuthzHandler { 27 | private static GuestAuthzHandler gah = new GuestAuthzHandler(); 28 | 29 | private GuestAuthzHandler(){} 30 | 31 | public static GuestAuthzHandler me(){ 32 | return gah; 33 | } 34 | 35 | @Override 36 | public void assertAuthorized() throws AuthorizationException { 37 | if (getSubject().getPrincipal() != null) { 38 | throw new UnauthenticatedException("Attempting to perform a guest-only operation. The current Subject is " + 39 | "not a guest (they have been authenticated or remembered from a previous login). Access " + 40 | "denied."); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/PermissionAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import java.lang.annotation.Annotation; 19 | 20 | import org.apache.shiro.authz.AuthorizationException; 21 | import org.apache.shiro.authz.annotation.Logical; 22 | import org.apache.shiro.authz.annotation.RequiresPermissions; 23 | import org.apache.shiro.subject.Subject; 24 | 25 | /** 26 | * 基于权限的访问控制处理器,非单例模式运行。 27 | * @author dafei 28 | * 29 | */ 30 | class PermissionAuthzHandler extends AbstractAuthzHandler { 31 | private final Annotation annotation; 32 | 33 | public PermissionAuthzHandler(Annotation annotation) { 34 | this.annotation = annotation; 35 | } 36 | 37 | @Override 38 | public void assertAuthorized() throws AuthorizationException { 39 | if (!(annotation instanceof RequiresPermissions)) 40 | return; 41 | 42 | RequiresPermissions rpAnnotation = (RequiresPermissions) annotation; 43 | String[] perms = rpAnnotation.value(); 44 | Subject subject = getSubject(); 45 | 46 | if (perms.length == 1) { 47 | subject.checkPermission(perms[0]); 48 | return; 49 | } 50 | if (Logical.AND.equals(rpAnnotation.logical())) { 51 | getSubject().checkPermissions(perms); 52 | return; 53 | } 54 | if (Logical.OR.equals(rpAnnotation.logical())) { 55 | // Avoid processing exceptions unnecessarily - "delay" throwing the 56 | // exception by calling hasRole first 57 | boolean hasAtLeastOnePermission = false; 58 | for (String permission : perms) 59 | if (getSubject().isPermitted(permission)) 60 | hasAtLeastOnePermission = true; 61 | // Cause the exception if none of the role match, note that the 62 | // exception message will be a bit misleading 63 | if (!hasAtLeastOnePermission) 64 | getSubject().checkPermission(perms[0]); 65 | 66 | } 67 | 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/RoleAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import java.lang.annotation.Annotation; 19 | import java.util.Arrays; 20 | 21 | import org.apache.shiro.authz.AuthorizationException; 22 | import org.apache.shiro.authz.annotation.Logical; 23 | import org.apache.shiro.authz.annotation.RequiresRoles; 24 | 25 | /** 26 | * 基于角色的访问控制处理器,非单例模式运行。 27 | * @author dafei 28 | * 29 | */ 30 | class RoleAuthzHandler extends AbstractAuthzHandler { 31 | 32 | private final Annotation annotation; 33 | 34 | public RoleAuthzHandler(Annotation annotation){ 35 | this.annotation = annotation; 36 | } 37 | 38 | @Override 39 | public void assertAuthorized() throws AuthorizationException { 40 | //if (!(annotation instanceof RequiresRoles)) return; 41 | RequiresRoles rrAnnotation = (RequiresRoles) annotation; 42 | String[] roles = rrAnnotation.value(); 43 | 44 | if (roles.length == 1) { 45 | getSubject().checkRole(roles[0]); 46 | return; 47 | } 48 | if (Logical.AND.equals(rrAnnotation.logical())) { 49 | getSubject().checkRoles(Arrays.asList(roles)); 50 | return; 51 | } 52 | if (Logical.OR.equals(rrAnnotation.logical())) { 53 | // Avoid processing exceptions unnecessarily - "delay" throwing the exception by calling hasRole first 54 | boolean hasAtLeastOneRole = false; 55 | for (String role : roles) if (getSubject().hasRole(role)) hasAtLeastOneRole = true; 56 | // Cause the exception if none of the role match, note that the exception message will be a bit misleading 57 | if (!hasAtLeastOneRole) getSubject().checkRole(roles[0]); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/ShiroInterceptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.authz.AuthorizationException; 19 | import org.apache.shiro.authz.UnauthenticatedException; 20 | 21 | import com.jfinal.aop.Interceptor; 22 | import com.jfinal.core.ActionInvocation; 23 | 24 | public class ShiroInterceptor implements Interceptor { 25 | 26 | @Override 27 | public void intercept(ActionInvocation ai) { 28 | AuthzHandler ah = ShiroKit.getAuthzHandler(ai.getActionKey()); 29 | // 存在访问控制处理器。 30 | if (ah != null) { 31 | try { 32 | // 执行权限检查。 33 | ah.assertAuthorized(); 34 | } catch (UnauthenticatedException lae) { 35 | // RequiresGuest,RequiresAuthentication,RequiresUser,未满足时,抛出未经授权的异常。 36 | // 如果没有进行身份验证,返回HTTP401状态码 37 | ai.getController().renderError(401); 38 | return; 39 | } catch (AuthorizationException ae) { 40 | // RequiresRoles,RequiresPermissions授权异常 41 | // 如果没有权限访问对应的资源,返回HTTP状态码403。 42 | ai.getController().renderError(403); 43 | return; 44 | } catch (Exception e) { 45 | // 出现了异常,应该是没有登录。 46 | ai.getController().renderError(401); 47 | return; 48 | } 49 | } 50 | // 执行正常逻辑 51 | ai.invoke(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/ShiroKit.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import java.util.concurrent.ConcurrentMap; 19 | 20 | 21 | /** 22 | * ShiroKit. (Singleton, ThreadSafe) 23 | * 24 | * @author dafei 25 | */ 26 | public class ShiroKit { 27 | 28 | /** 29 | * 用来记录那个action或者actionpath中是否有shiro认证注解。 30 | */ 31 | private static ConcurrentMap authzMaps = null; 32 | 33 | /** 34 | * 禁止初始化 35 | */ 36 | private ShiroKit() {} 37 | 38 | static void init(ConcurrentMap maps) { 39 | authzMaps = maps; 40 | } 41 | 42 | static AuthzHandler getAuthzHandler(String actionKey){ 43 | /* 44 | if(authzMaps.containsKey(controllerClassName)){ 45 | return true; 46 | }*/ 47 | return authzMaps.get(actionKey); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/ShiroMethod.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.SecurityUtils; 19 | import org.apache.shiro.subject.Subject; 20 | 21 | /** 22 | * ShiroMethod. (SPI, Singleton, ThreadSafe) 23 | * 24 | * @author dafei (myaniu AT gmail DOT com) 25 | */ 26 | public class ShiroMethod { 27 | 28 | private static final String NAMES_DELIMETER = ","; 29 | 30 | /** 31 | * 禁止初始化 32 | */ 33 | private ShiroMethod() {} 34 | 35 | /** 36 | * 获取 Subject 37 | * 38 | * @return Subject 39 | */ 40 | protected static Subject getSubject() { 41 | return SecurityUtils.getSubject(); 42 | } 43 | 44 | /** 45 | * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 46 | * 47 | * @param roleName 48 | * 角色名 49 | * @return 属于该角色:true,否则false 50 | */ 51 | public static boolean hasRole(String roleName) { 52 | return getSubject() != null && roleName != null 53 | && roleName.length() > 0 && getSubject().hasRole(roleName); 54 | } 55 | 56 | /** 57 | * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 58 | * 59 | * @param roleName 60 | * 角色名 61 | * @return 不属于该角色:true,否则false 62 | */ 63 | public static boolean lacksRole(String roleName) { 64 | return !hasRole(roleName); 65 | } 66 | 67 | /** 68 | * 验证当前用户是否属于以下任意一个角色。 69 | * 70 | * @param roleNames 71 | * 角色列表 72 | * @return 属于:true,否则false 73 | */ 74 | public static boolean hasAnyRoles(String roleNames) { 75 | boolean hasAnyRole = false; 76 | Subject subject = getSubject(); 77 | if (subject != null && roleNames != null && roleNames.length() > 0) { 78 | // Iterate through roles and check to see if the user has one of the 79 | // roles 80 | for (String role : roleNames.split(NAMES_DELIMETER)) { 81 | if (subject.hasRole(role.trim())) { 82 | hasAnyRole = true; 83 | break; 84 | } 85 | } 86 | } 87 | return hasAnyRole; 88 | } 89 | 90 | /** 91 | * 验证当前用户是否属于以下所有角色。 92 | * 93 | * @param roleNames 94 | * 角色列表 95 | * @return 属于:true,否则false 96 | */ 97 | public static boolean hasAllRoles(String roleNames) { 98 | boolean hasAllRole = true; 99 | Subject subject = getSubject(); 100 | if (subject != null && roleNames != null && roleNames.length() > 0) { 101 | // Iterate through roles and check to see if the user has one of the 102 | // roles 103 | for (String role : roleNames.split(NAMES_DELIMETER)) { 104 | if (!subject.hasRole(role.trim())) { 105 | hasAllRole = false; 106 | break; 107 | } 108 | } 109 | } 110 | return hasAllRole; 111 | } 112 | 113 | /** 114 | * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 115 | * 116 | * @param permission 117 | * 权限名 118 | * @return 拥有权限:true,否则false 119 | */ 120 | public static boolean hasPermission(String permission) { 121 | return getSubject() != null && permission != null 122 | && permission.length() > 0 123 | && getSubject().isPermitted(permission); 124 | } 125 | 126 | /** 127 | * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 128 | * 129 | * @param permission 130 | * 权限名 131 | * @return 拥有权限:true,否则false 132 | */ 133 | public static boolean lacksPermission(String permission) { 134 | return !hasPermission(permission); 135 | } 136 | 137 | /** 138 | * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 139 | * 140 | * @return 通过身份验证:true,否则false 141 | */ 142 | public static boolean authenticated() { 143 | return getSubject() != null && getSubject().isAuthenticated(); 144 | } 145 | 146 | /** 147 | * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 148 | * 149 | * @return 没有通过身份验证:true,否则false 150 | */ 151 | public static boolean notAuthenticated() { 152 | return !authenticated(); 153 | } 154 | 155 | /** 156 | * 认证通过或已记住的用户。与guset搭配使用。 157 | * 158 | * @return 用户:true,否则 false 159 | */ 160 | public static boolean user() { 161 | return getSubject() != null && getSubject().getPrincipal() != null; 162 | } 163 | 164 | /** 165 | * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 166 | * 167 | * @return 访客:true,否则false 168 | */ 169 | public static boolean guest() { 170 | return !user(); 171 | } 172 | 173 | /** 174 | * 输出当前用户信息,通常为登录帐号信息。 175 | * @return 当前用户信息 176 | */ 177 | public String principal(){ 178 | if (getSubject() != null) { 179 | // Get the principal to print out 180 | Object principal = getSubject().getPrincipal(); 181 | return principal.toString(); 182 | } 183 | return "Guest"; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /jfinal/com/jfinal/ext/plugin/shiro/UserAuthzHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2013, dafei 李飞 (myaniu AT gmail DOT com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jfinal.ext.plugin.shiro; 17 | 18 | import org.apache.shiro.authz.AuthorizationException; 19 | import org.apache.shiro.authz.UnauthenticatedException; 20 | 21 | /** 22 | * 认证通过或已记住的用户访问控制处理器 23 | * 单例模式运行。 24 | * @author dafei 25 | * 26 | */ 27 | class UserAuthzHandler extends AbstractAuthzHandler { 28 | private static UserAuthzHandler uah = new UserAuthzHandler(); 29 | 30 | private UserAuthzHandler(){} 31 | 32 | public static UserAuthzHandler me(){ 33 | return uah; 34 | } 35 | 36 | @Override 37 | public void assertAuthorized() throws AuthorizationException { 38 | if (getSubject().getPrincipal() == null) { 39 | throw new UnauthenticatedException("Attempting to perform a user-only operation. The current Subject is " + 40 | "not a user (they haven't been authenticated or remembered from a previous login). " + 41 | "Access denied."); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/DeptController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import com.cnvp.paladin.core.BaseController; 9 | import com.cnvp.paladin.model.SysDept; 10 | 11 | public class DeptController extends BaseController { 12 | 13 | public void index(){ 14 | setAttr("page", SysDept.dao.paginate(getParaToInt(0, 1), 10)); 15 | } 16 | public void getlist(){ 17 | Map json = new HashMap(); 18 | List data = SysDept.dao.where(""); 19 | for (int i = 0; i < data.size(); i++) { 20 | if (data.get(i).hasChild()) 21 | data.get(i).getAttrs().put("hasChild",true); 22 | else 23 | data.get(i).getAttrs().put("hasChild",false); 24 | } 25 | json.put("data", data); 26 | renderJson(json); 27 | } 28 | 29 | public void create(){ 30 | Integer pid = getParaToInt(0, 0); 31 | if(isPost()){ 32 | if(getModel(SysDept.class,"sysdept").save()) 33 | redirect(getControllerKey()); 34 | return; 35 | } 36 | SysDept data = new SysDept(); 37 | data.set("pid", pid); 38 | setAttr("data", data); 39 | render("form.html"); 40 | } 41 | 42 | public void update(){ 43 | if(isPost()){ 44 | if(getModel(SysDept.class,"sysdept").set("id", getParaToInt()).update()) 45 | redirect(getControllerKey()); 46 | return; 47 | } 48 | setAttr("data", SysDept.dao.findById(getParaToInt())); 49 | render("form.html"); 50 | } 51 | public void delete(){ 52 | if (SysDept.dao.findById(getParaToInt()).delete()) 53 | redirect(getControllerKey()); 54 | else 55 | renderText("删除失败"); 56 | } 57 | public void deleteAll(){ 58 | Integer[] ids=getParaValuesToInt("id"); 59 | for (Integer id : ids) { 60 | SysDept.dao.findById(id).delete(); 61 | } 62 | redirect(getControllerKey()); 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/GeneratorController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import java.util.List; 4 | 5 | import com.cnvp.paladin.core.BaseController; 6 | import com.cnvp.paladin.service.GeneratoService; 7 | import com.jfinal.plugin.activerecord.Record; 8 | 9 | public class GeneratorController extends BaseController { 10 | 11 | public void index() { 12 | List tables = GeneratoService.getTables(); 13 | setAttr("tables", tables); 14 | setAttr("type", getPara(0)); 15 | render("tables.html"); 16 | } 17 | public void model_code(){ 18 | String tableName = getPara(0); 19 | String modelName = getPara(1); 20 | List cols = GeneratoService.getFields(tableName); 21 | setAttr("table", GeneratoService.getTable(tableName)); 22 | setAttr("modelName", modelName); 23 | setAttr("cols", cols); 24 | } 25 | public void controller_code(){ 26 | String tableName = getPara(0); 27 | String modelName = getPara(1); 28 | List cols = GeneratoService.getFields(tableName); 29 | setAttr("table", GeneratoService.getTable(tableName)); 30 | setAttr("modelName", modelName); 31 | setAttr("cols", cols); 32 | } 33 | public void view_code(){ 34 | String tableName = getPara(0); 35 | String modelName = getPara(1); 36 | List cols = GeneratoService.getFields(tableName); 37 | setAttr("table", GeneratoService.getTable(tableName)); 38 | setAttr("modelName", modelName); 39 | setAttr("cols", cols); 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.shiro.SecurityUtils; 6 | 7 | import com.cnvp.paladin.core.BaseController; 8 | import com.cnvp.paladin.kit.PropertyKit; 9 | import com.cnvp.paladin.kit.StringKit; 10 | import com.cnvp.paladin.model.SysNav; 11 | import com.cnvp.paladin.model.SysUser; 12 | import com.cnvp.paladin.service.NavService; 13 | import com.jfinal.aop.ClearInterceptor; 14 | import com.jfinal.aop.ClearLayer; 15 | import com.jfinal.core.JFinal; 16 | import com.jfinal.kit.EncryptionKit; 17 | 18 | public class IndexController extends BaseController { 19 | public void index() { 20 | List tree = NavService.getTreeMap(0); 21 | setAttr("tree", tree); 22 | } 23 | public void welcome() { 24 | } 25 | public void password(){ 26 | if("POST".equals(getRequest().getMethod())){ 27 | SysUser currentUser = (SysUser) SecurityUtils.getSubject().getPrincipal(); 28 | currentUser = SysUser.dao.findById(currentUser.get("id")); 29 | String old = getPara("old"); 30 | String new1 = getPara("new1"); 31 | String new2 = getPara("new2"); 32 | if (StringKit.isBlank(old)) 33 | alertAndGoback("原始密码不能为空"); 34 | else if (!currentUser.getStr("password").equals(EncryptionKit.md5Encrypt(old))) 35 | alertAndGoback("原始密码错误"); 36 | else if (!new1.equals(new2)) 37 | alertAndGoback("新密码两次输入不一致"); 38 | else{ 39 | SysUser.dao 40 | .set("id", currentUser.get("id")) 41 | .set("password", EncryptionKit.md5Encrypt(new1)) 42 | .update(); 43 | alertAndGoback("密码修改成功"); 44 | } 45 | } 46 | } 47 | public void profile() { 48 | SysUser currentUser = (SysUser) SecurityUtils.getSubject().getPrincipal(); 49 | if("POST".equals(getRequest().getMethod())){ 50 | if(getModel(SysUser.class,"user").set("id", currentUser.getInt("id")).update()) 51 | redirect("/profile"); 52 | return; 53 | } 54 | setAttr("data", SysUser.dao.findById(currentUser.getInt("id"))); 55 | } 56 | public void closed() { 57 | setAttr("app_remark", PropertyKit.get("app_remark")); 58 | render("common/close.html"); 59 | } 60 | @ClearInterceptor(ClearLayer.ALL) 61 | public void test(){ 62 | List actionKeys = JFinal.me().getAllActionKeys(); 63 | for (String ak : actionKeys) { 64 | System.out.println(ak); 65 | } 66 | // List deptModels = new SysDept().findByModel(); 67 | // TreeKit deptTree = new TreeKit(); 68 | // deptTree.importModels(deptModels); 69 | // deptTree.getSelectMap(); 70 | // renderNull(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/PassportController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import org.apache.shiro.SecurityUtils; 4 | import org.apache.shiro.authc.AuthenticationException; 5 | import org.apache.shiro.authc.UsernamePasswordToken; 6 | import org.apache.shiro.subject.Subject; 7 | 8 | import com.cnvp.paladin.core.BaseController; 9 | import com.cnvp.paladin.interceptor.Global; 10 | import com.cnvp.paladin.kit.StringKit; 11 | import com.jfinal.aop.Before; 12 | import com.jfinal.aop.ClearInterceptor; 13 | import com.jfinal.aop.ClearLayer; 14 | import com.jfinal.kit.EncryptionKit; 15 | 16 | @ClearInterceptor(ClearLayer.ALL) 17 | public class PassportController extends BaseController { 18 | 19 | 20 | @Before(Global.class) 21 | public void login() { 22 | String from = getPara("from"); 23 | if (StringKit.notBlank(from)) 24 | setAttr("from", from); 25 | } 26 | public void logout() { 27 | Subject subject = SecurityUtils.getSubject(); 28 | subject.logout(); 29 | redirect("/Passport/login"); 30 | } 31 | public void dologin() { 32 | Subject subject = SecurityUtils.getSubject(); 33 | UsernamePasswordToken token = new UsernamePasswordToken(getPara("account"),EncryptionKit.md5Encrypt(getPara("password"))); 34 | try { 35 | //4、登录,即身份验证 36 | subject.login(token); 37 | String from = getPara("from"); 38 | if (StringKit.isBlank(from)) 39 | redirect("/"); 40 | else 41 | redirect(from); 42 | } catch (AuthenticationException e) { 43 | //5、身份验证失败 44 | alertAndGoback("用户名或密码错误,请重新登录"); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/ResourceController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import com.cnvp.paladin.core.BaseController; 10 | import com.cnvp.paladin.model.SysRes; 11 | import com.jfinal.core.JFinal; 12 | import com.jfinal.kit.JsonKit; 13 | import com.jfinal.plugin.ehcache.CacheKit; 14 | 15 | public class ResourceController extends BaseController { 16 | 17 | public void index(){ 18 | render("index.html"); 19 | } 20 | public void create(){ 21 | Integer pid = getParaToInt(0,0); 22 | if(isPost()){ 23 | SysRes model =getModel(SysRes.class,"sysres"); 24 | if(model.save()){ 25 | refreshCodeRoute(); 26 | Map r = new HashMap(); 27 | r.put("success", true); 28 | r.put("data", model.toNodeData()); 29 | renderJavascript(JsonKit.toJson(r)); 30 | return; 31 | } 32 | } 33 | setAttr("aks", JFinal.me().getAllActionKeys()); 34 | setAttr("data", new SysRes().set("pid", pid).addParentCode()); 35 | render("form.html"); 36 | } 37 | public void update(){ 38 | 39 | if(isPost()){ 40 | Integer id = getParaToInt("sysres.id"); 41 | SysRes model = getModel(SysRes.class,"sysres").set("id",id); 42 | if(model.update()){ 43 | refreshCodeRoute(); 44 | Map r = new HashMap(); 45 | r.put("success", true); 46 | r.put("data", model.toNodeData()); 47 | renderJavascript(JsonKit.toJson(r)); 48 | return; 49 | } 50 | }else{ 51 | Integer id = getParaToInt(0); 52 | setAttr("aks", JFinal.me().getAllActionKeys()); 53 | setAttr("data", SysRes.dao.findById(id).addParentCode()); 54 | render("form.html"); 55 | } 56 | } 57 | public void delete(){ 58 | int id = getParaToInt(); 59 | if (SysRes.dao.findById(id).delete()){ 60 | Map r = new HashMap(); 61 | r.put("success", true); 62 | r.put("data", new HashMap().put("id", id)); 63 | renderJavascript(JsonKit.toJson(r)); 64 | return; 65 | } 66 | else{ 67 | Map r = new HashMap(); 68 | r.put("success", false); 69 | r.put("msg", "删除失败"); 70 | renderJavascript(JsonKit.toJson(r)); 71 | return; 72 | } 73 | } 74 | public void getlist(){ 75 | Integer pid = getParaToInt("id",0); 76 | List models= SysRes.dao.where("pid=? order by seq",pid); 77 | List> nodes = new ArrayList>(); 78 | Iterator it = models.iterator(); 79 | while (it.hasNext()) { 80 | SysRes model = it.next(); 81 | nodes.add(model.toNodeData()); 82 | } 83 | renderJson(nodes); 84 | } 85 | public void refresh(){ 86 | refreshCodeRoute(); 87 | CacheKit.remove("system", "ak_coderoutes"); 88 | SysRes.dao.getAk_CodeRoutes(); 89 | redirect(getControllerKey()); 90 | } 91 | private void refreshCodeRoute() { 92 | List reslist = SysRes.dao.findAll(); 93 | Iterator it = reslist.iterator(); 94 | while (it.hasNext()) { 95 | SysRes model = it.next(); 96 | model.addParentCode(); 97 | String parent_code = model.get("parent_code"); 98 | String code_route; 99 | if (parent_code==null) 100 | code_route = model.get("code"); 101 | else 102 | code_route = parent_code + ":" +model.get("code"); 103 | model.set("code_route", code_route); 104 | model.update(); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.cnvp.paladin.core.BaseController; 8 | import com.cnvp.paladin.model.SysRole; 9 | import com.cnvp.paladin.model.SysRoleRes; 10 | import com.jfinal.kit.JsonKit; 11 | 12 | public class RoleController extends BaseController { 13 | public void index(){ 14 | setAttr("page", SysRole.dao.paginate(getParaToInt(0, 1), 10)); 15 | } 16 | public void getlist(){ 17 | Map json = new HashMap(); 18 | List data = SysRole.dao.where(""); 19 | for (int i = 0; i < data.size(); i++) { 20 | if (data.get(i).hasChild()) 21 | data.get(i).getAttrs().put("hasChild",true); 22 | else 23 | data.get(i).getAttrs().put("hasChild",false); 24 | } 25 | json.put("data", data); 26 | renderJson(json); 27 | } 28 | public void create(){ 29 | if(isPost()){ 30 | if(getModel(SysRole.class,"sysgroup").save()) 31 | redirect(getControllerKey()); 32 | return; 33 | } 34 | setAttr("data", new SysRole()); 35 | render("form.html"); 36 | } 37 | 38 | public void update(){ 39 | if(isPost()){ 40 | if(getModel(SysRole.class,"sysgroup").set("id", getParaToInt(0)).update()) 41 | redirect(getControllerKey()); 42 | return; 43 | } 44 | SysRole model = SysRole.dao.findById(getParaToInt(0)); 45 | setAttr("data", model); 46 | setAttr("res", JsonKit.toJson(model.getResidList())); 47 | render("form.html"); 48 | } 49 | public void delete(){ 50 | if (SysRole.dao.findById(getParaToInt(0)).delete()) 51 | redirect(getControllerKey()); 52 | else 53 | alertAndGoback("删除失败"); 54 | } 55 | public void deleteAll(){ 56 | Integer[] ids=getParaValuesToInt("id"); 57 | for (Integer id : ids) { 58 | SysRole.dao.findById(id).delete(); 59 | } 60 | redirect(getControllerKey()); 61 | } 62 | public void set_res(){ 63 | int role_id = getParaToInt(0); 64 | int res_id = getParaToInt(1); 65 | boolean flg = getParaToBoolean("checked"); 66 | if (flg) { 67 | SysRoleRes rr = new SysRoleRes().set("role_id", role_id).set("res_id",res_id); 68 | if (rr.findByModel().size()==0) 69 | rr.save(); 70 | }else{ 71 | //删除 72 | SysRoleRes rr = new SysRoleRes().set("role_id", role_id).set("res_id",res_id).findFirstByModel(); 73 | if(rr!=null) rr.delete(); 74 | } 75 | Map r = new HashMap(); 76 | r.put("success", true); 77 | renderJavascript(JsonKit.toJson(r)); 78 | return; 79 | 80 | } 81 | public void set_res_all(){ 82 | int role_id = getParaToInt(0); 83 | boolean flg = getParaToBoolean("checked"); 84 | SysRole.dao.checkAll(role_id, flg); 85 | 86 | SysRole model = SysRole.dao.findById(role_id); 87 | renderJavascript(JsonKit.toJson(model.getResidList())); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/SystemController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import com.cnvp.paladin.core.BaseController; 10 | import com.cnvp.paladin.kit.PropertyKit; 11 | import com.cnvp.paladin.kit.StringKit; 12 | import com.cnvp.paladin.model.SysNav; 13 | import com.cnvp.paladin.model.SysRes; 14 | import com.cnvp.paladin.service.NavService; 15 | import com.jfinal.kit.JsonKit; 16 | 17 | public class SystemController extends BaseController { 18 | public void index(){ 19 | if("POST".equals(getRequest().getMethod())){ 20 | if (!StringKit.isBlank(getPara("app_name"))) 21 | PropertyKit.set("app_name", getPara("app_name")); 22 | if (!StringKit.isBlank(getPara("app_status"))) 23 | PropertyKit.set("app_status", getPara("app_status")); 24 | if (!StringKit.isBlank(getPara("app_devModel"))) 25 | PropertyKit.set("app_devModel", getPara("app_devModel")); 26 | if (!StringKit.isBlank(getPara("app_remark"))) 27 | PropertyKit.set("app_remark", getPara("app_remark")); 28 | 29 | } 30 | setAttr("app_name", PropertyKit.get("app_name")); 31 | setAttr("app_status", PropertyKit.get("app_status")); 32 | setAttr("app_devModel", PropertyKit.get("app_devModel")); 33 | setAttr("app_remark", PropertyKit.get("app_remark")); 34 | } 35 | public void nav(){ 36 | List tree = NavService.getTreeMap(0); 37 | setAttr("test", tree); 38 | } 39 | public void nav_create(){ 40 | if("POST".equals(getRequest().getMethod())){ 41 | if(getModel(SysNav.class,"sysnav").save()) 42 | redirect(getControllerKey()+"/nav"); 43 | return; 44 | } 45 | setAttr("data", SysNav.dao.set("pid", getParaToInt())); 46 | render("nav_form.html"); 47 | } 48 | public void nav_update(){ 49 | if("POST".equals(getRequest().getMethod())){ 50 | getModel(SysNav.class,"sysnav").set("id",getParaToInt()).update(); 51 | redirect(getControllerKey()+"/nav"); 52 | return; 53 | } 54 | setAttr("data", SysNav.dao.findById(getParaToInt())); 55 | render("nav_form.html"); 56 | } 57 | public void nav_delete(){ 58 | if (SysNav.dao.findById(getParaToInt()).delete()) 59 | redirect(getControllerKey()+"/nav"); 60 | else 61 | alertAndGoback("删除失败"); 62 | } 63 | public void save_order(){ 64 | String[] vals = getParaValues("orderV"); 65 | String[] keys = getParaValues("orderK"); 66 | for (int i = 0; i < keys.length; i++) { 67 | SysNav.dao.findById(Integer.parseInt(keys[i])).set("orderid", Integer.parseInt(vals[i])).update(); 68 | } 69 | redirect(getControllerKey()+"/nav"); 70 | } 71 | public void getres() { 72 | List res = SysRes.dao.findAll(); 73 | List> r = new ArrayList>(); 74 | Iterator it = res.iterator(); 75 | while (it.hasNext()) { 76 | Map row = new HashMap(); 77 | SysRes sysRes = (SysRes) it.next(); 78 | row.put("id", sysRes.get("id")); 79 | row.put("pId", sysRes.get("pid")); 80 | row.put("name", sysRes.get("cname")); 81 | row.put("code_route", sysRes.get("code_route")); 82 | row.put("seq", sysRes.get("seq")); 83 | if (sysRes.hasChild()) { 84 | row.put("open", true); 85 | } 86 | r.add(row); 87 | } 88 | renderJavascript(JsonKit.toJson(r)); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.controller; 2 | 3 | import com.cnvp.paladin.core.BaseController; 4 | import com.cnvp.paladin.kit.StringKit; 5 | import com.cnvp.paladin.kit.tree.TreeKit; 6 | import com.cnvp.paladin.model.SysDept; 7 | import com.cnvp.paladin.model.SysRole; 8 | import com.cnvp.paladin.model.SysUser; 9 | import com.cnvp.paladin.model.SysUserRole; 10 | import com.jfinal.kit.EncryptionKit; 11 | 12 | public class UserController extends BaseController { 13 | public void index(){ 14 | setAttr("page", SysUser.dao.paginate(getParaToInt(0, 1), 10)); 15 | } 16 | public void create(){ 17 | if(isPost()){ 18 | SysUser model = getModel(SysUser.class,"user"); 19 | String psw = model.getStr("password"); 20 | model.set("password",EncryptionKit.md5Encrypt(psw)); 21 | model.set("create_time", System.currentTimeMillis()); 22 | model.set("create_user_id", 1); 23 | if(model.save()){ 24 | model.deleteAllRoles(); 25 | String[] role_ids = getParaValues("roles"); 26 | if(role_ids!=null) 27 | for (String role_id : role_ids) 28 | new SysUserRole().set("user_id", model.getInt("id")).set("role_id", role_id).save(); 29 | redirect(getControllerKey()); 30 | return; 31 | } 32 | } 33 | TreeKit deptTree = new TreeKit(); 34 | deptTree.importModels(new SysDept().findByModel()); 35 | //所有角色数据 36 | setAttr("allroles",SysRole.dao.findAll()); 37 | setAttr("depts",deptTree.getSelectMap()); 38 | setAttr("data", new SysUser()); 39 | render("form.html"); 40 | } 41 | public void update(){ 42 | if(isPost()){ 43 | SysUser model = getModel(SysUser.class,"user"); 44 | if (StringKit.isBlank(getPara("user.password"))) 45 | model.set("password", SysUser.dao.findById(getParaToInt()).get("password")); 46 | else{ 47 | String psw = model.getStr("password"); 48 | model.set("password",EncryptionKit.md5Encrypt(psw)); 49 | } 50 | model.set("id", getParaToInt()).set("update_time", System.currentTimeMillis()).set("update_user_id", 1); 51 | if(model.update()){ 52 | model.deleteAllRoles(); 53 | String[] role_ids = getParaValues("roles"); 54 | if(role_ids!=null) 55 | for (String role_id : role_ids) 56 | new SysUserRole().set("user_id", model.getInt("id")).set("role_id", role_id).save(); 57 | redirect(getControllerKey()); 58 | } 59 | return; 60 | } 61 | //当前用户数据 62 | SysUser user = SysUser.dao.findById(getParaToInt()); 63 | setAttr("data",user); 64 | //部门select数据 65 | TreeKit deptTree = new TreeKit(); 66 | deptTree.importModels(new SysDept().findByModel()); 67 | setAttr("depts",deptTree.getSelectMap()); 68 | //所有角色数据 69 | setAttr("allroles",SysRole.dao.findAll()); 70 | //用户现有角色数据 71 | setAttr("useroles",user.getRoles()); 72 | render("form.html"); 73 | } 74 | public void delete(){ 75 | SysUser model = SysUser.dao.findById(getParaToInt()); 76 | if(model==null){ 77 | goBack();return; 78 | } 79 | if(SysUser.dao.findById(getParaToInt()).delete()) 80 | redirect(getControllerKey()); 81 | else 82 | goBack(); 83 | } 84 | public void deleteAll(){ 85 | Integer[] ids=getParaValuesToInt("id"); 86 | for (Integer id : ids) { 87 | SysUser.dao.findById(id).delete(); 88 | // System.out.println(id); 89 | } 90 | redirect(getControllerKey()); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/core/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.core; 2 | 3 | import com.jfinal.core.Controller; 4 | 5 | /** 6 | * 用途:controller基类,所有controller必须继承 说明: 7 | */ 8 | public class BaseController extends Controller { 9 | 10 | protected String getControllerKey() { 11 | return this.getAttr("ControllerKey"); 12 | } 13 | protected boolean isPost(){ 14 | return "post".equals(getRequest().getMethod().toLowerCase()); 15 | } 16 | protected void goBack() { 17 | goBack(-1); 18 | } 19 | protected void goBack(int step) { 20 | renderJS("history.go(" + step + ")"); 21 | } 22 | protected void alertAndGoback(String msg) { 23 | alertAndGoback(msg,-1); 24 | } 25 | protected void alertAndGoback(String msg,int step) { 26 | renderJS("alert('"+msg+"');history.go(" + step + ")"); 27 | } 28 | protected void renderJS(String jsContent){ 29 | renderHtml(""); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/core/TypeConverter.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.core; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | 6 | import com.jfinal.core.JFinal; 7 | 8 | /** 9 | * Convert String to other type object. 10 | */ 11 | public final class TypeConverter { 12 | 13 | private static final int timeStampLen = "2011-01-18 16:18:18".length(); 14 | private static final String timeStampPattern = "yyyy-MM-dd HH:mm:ss"; 15 | private static final String datePattern = "yyyy-MM-dd"; 16 | 17 | /** 18 | * test for all types of mysql 19 | * 20 | * 表单提交测试结果: 21 | * 1: 表单中的域,就算不输入任何内容,也会传过来 "", 也即永远不可能为 null. 22 | * 2: 如果输入空格也会提交上来 23 | * 3: 需要考 model中的 string属性,在传过来 "" 时是该转成 null还是不该转换, 24 | * 我想, 因为用户没有输入那么肯定是 null, 而不该是 "" 25 | * 26 | * 注意: 1:当clazz参数不为String.class, 且参数s为空串blank的情况, 27 | * 此情况下转换结果为 null, 而不应该抛出异常 28 | * 2:调用者需要对被转换数据做 null 判断,参见 ModelInjector 的两处调用 29 | */ 30 | public static final Object convert(Class> clazz, String s) throws ParseException { 31 | // mysql type: varchar, char, enum, set, text, tinytext, mediumtext, longtext 32 | if (clazz == String.class) { 33 | return ("".equals(s) ? null : s); // 用户在表单域中没有输入内容时将提交过来 "", 因为没有输入,所以要转成 null. 34 | } 35 | s = s.trim(); 36 | if ("".equals(s)) { // 前面的 String跳过以后,所有的空字符串全都转成 null, 这是合理的 37 | return null; 38 | } 39 | // 以上两种情况无需转换,直接返回, 注意, 本方法不接受null为 s 参数(经测试永远不可能传来null, 因为无输入传来的也是"") 40 | 41 | Object result = null; 42 | // mysql type: int, integer, tinyint(n) n > 1, smallint, mediumint 43 | if (clazz == Integer.class || clazz == int.class) { 44 | result = Integer.parseInt(s); 45 | } 46 | // mysql type: bigint 47 | else if (clazz == Long.class || clazz == long.class) { 48 | result = Long.parseLong(s); 49 | } 50 | // 经测试java.util.Data类型不会返回, java.sql.Date, java.sql.Time,java.sql.Timestamp 全部直接继承自 java.util.Data, 所以 getDate可以返回这三类数据 51 | else if (clazz == java.util.Date.class) { 52 | if (s.length() >= timeStampLen) { // if (x < timeStampLen) 改用 datePattern 转换,更智能 53 | // Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] 54 | // result = new java.util.Date(java.sql.Timestamp.valueOf(s).getTime()); // error under jdk 64bit(maybe) 55 | result = new SimpleDateFormat(timeStampPattern).parse(s); 56 | } 57 | else { 58 | // result = new java.util.Date(java.sql.Date.valueOf(s).getTime()); // error under jdk 64bit 59 | result = new SimpleDateFormat(datePattern).parse(s); 60 | } 61 | } 62 | // mysql type: date, year 63 | else if (clazz == java.sql.Date.class) { 64 | if (s.length() >= timeStampLen) { // if (x < timeStampLen) 改用 datePattern 转换,更智能 65 | // result = new java.sql.Date(java.sql.Timestamp.valueOf(s).getTime()); // error under jdk 64bit(maybe) 66 | result = new java.sql.Date(new SimpleDateFormat(timeStampPattern).parse(s).getTime()); 67 | } 68 | else { 69 | // result = new java.sql.Date(java.sql.Date.valueOf(s).getTime()); // error under jdk 64bit 70 | result = new java.sql.Date(new SimpleDateFormat(datePattern).parse(s).getTime()); 71 | } 72 | } 73 | // mysql type: time 74 | else if (clazz == java.sql.Time.class) { 75 | result = java.sql.Time.valueOf(s); 76 | } 77 | // mysql type: timestamp, datetime 78 | else if (clazz == java.sql.Timestamp.class) { 79 | result = java.sql.Timestamp.valueOf(s); 80 | } 81 | // mysql type: real, double 82 | else if (clazz == Double.class) { 83 | result = Double.parseDouble(s); 84 | } 85 | // mysql type: float 86 | else if (clazz == Float.class) { 87 | result = Float.parseFloat(s); 88 | } 89 | // mysql type: bit, tinyint(1) 90 | else if (clazz == Boolean.class) { 91 | result = Boolean.parseBoolean(s) || "1".equals(s); 92 | } 93 | // mysql type: decimal, numeric 94 | else if (clazz == java.math.BigDecimal.class) { 95 | result = new java.math.BigDecimal(s); 96 | } 97 | // mysql type: unsigned bigint 98 | else if (clazz == java.math.BigInteger.class) { 99 | result = new java.math.BigInteger(s); 100 | } 101 | // mysql type: binary, varbinary, tinyblob, blob, mediumblob, longblob. I have not finished the test. 102 | else if (clazz == byte[].class) { 103 | result = s.getBytes(); 104 | } 105 | else { 106 | if (JFinal.me().getConstants().getDevMode()) 107 | throw new RuntimeException("Please add code in " + TypeConverter.class + ". The type can't be converted: " + clazz.getName()); 108 | else 109 | throw new RuntimeException(clazz.getName() + " can not be converted, please use other type of attributes in your model!"); 110 | } 111 | 112 | return result; 113 | } 114 | } 115 | 116 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/core/appConfig.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.core; 2 | 3 | import com.alibaba.druid.filter.stat.StatFilter; 4 | import com.cnvp.paladin.handler.CookieHandler; 5 | import com.cnvp.paladin.handler.RewriteHandler; 6 | import com.cnvp.paladin.handler.SessionHandler; 7 | import com.cnvp.paladin.interceptor.Global; 8 | import com.cnvp.paladin.kit.ConfigKit; 9 | import com.cnvp.paladin.kit.PropertyKit; 10 | import com.cnvp.paladin.plugin.AutoTableBindPlugin; 11 | import com.cnvp.paladin.plugin.TableNameStyle; 12 | import com.cnvp.paladin.utils.AutoRoutes; 13 | import com.cnvp.paladin.utils.beetl.BeetlRenderFactory; 14 | import com.jfinal.config.Constants; 15 | import com.jfinal.config.Handlers; 16 | import com.jfinal.config.Interceptors; 17 | import com.jfinal.config.JFinalConfig; 18 | import com.jfinal.config.Plugins; 19 | import com.jfinal.config.Routes; 20 | import com.jfinal.plugin.activerecord.CaseInsensitiveContainerFactory; 21 | import com.jfinal.plugin.druid.DruidPlugin; 22 | import com.jfinal.plugin.ehcache.EhCachePlugin; 23 | public class appConfig extends JFinalConfig { 24 | private Routes routes; 25 | public static DruidPlugin dp; 26 | /** 27 | * 配置常量 28 | */ 29 | public void configConstant(Constants me) { 30 | loadPropertyFile("app.properties"); 31 | //beetl集成 32 | me.setMainRenderFactory(new BeetlRenderFactory()); 33 | //可对beetl设置共享变量 34 | // GroupTemplate gt=BeetlRenderFactory.groupTemplate; 35 | // gt.registerFunctionPackage("shiro", BeetlShiro.class); 36 | // Map shared = new HashMap(); 37 | // shared.put("key","value"); 38 | // groupTemplate.setSharedVars(shared); 39 | //是否启用开发模式 40 | me.setDevMode(PropertyKit.getToBoolean("app_devModel")); 41 | 42 | // me.setViewType(ViewType.OTHER); 43 | me.setEncoding("UTF-8"); 44 | 45 | } 46 | 47 | /** 48 | * 配置路由 49 | */ 50 | public void configRoute(Routes me) { 51 | this.routes = me; 52 | //路由自动映射 53 | String default_contorller = getProperty("default_contorller", "Index"); 54 | AutoRoutes.add(me,default_contorller); 55 | } 56 | 57 | /** 58 | * 配置插件 59 | */ 60 | public void configPlugin(Plugins me) { 61 | // 配置数据库连接池插件 62 | dp = new DruidPlugin(ConfigKit.get("jdbc.url"),ConfigKit.get("jdbc.username"),ConfigKit.get("jdbc.password"),ConfigKit.get("jdbc.driver")); 63 | dp.addFilter(new StatFilter()); 64 | me.add(dp); 65 | //添加自动绑定model与表插件 66 | AutoTableBindPlugin autoTableBindPlugin = new AutoTableBindPlugin(dp, TableNameStyle.LOWER_UNDERLINE); 67 | autoTableBindPlugin.setShowSql(true); 68 | autoTableBindPlugin.setContainerFactory(new CaseInsensitiveContainerFactory(true)); 69 | me.add(autoTableBindPlugin); 70 | // me.add(new SqlInXmlPlugin()); 71 | 72 | me.add(new EhCachePlugin()); 73 | } 74 | 75 | /** 76 | * 配置全局拦截器 77 | */ 78 | public void configInterceptor(Interceptors me) { 79 | // me.add(new Shiro()); 80 | me.add(new Global()); 81 | } 82 | 83 | /** 84 | * 配置处理器 85 | */ 86 | public void configHandler(Handlers me) { 87 | me.add(new RewriteHandler());//将session里的参数传递到request中直接得到 88 | me.add(new SessionHandler());//将session里的参数传递到request中直接得到 89 | me.add(new CookieHandler());//将cookie里的参数传递到request中直接得到 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/handler/CookieHandler.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.handler; 2 | 3 | import javax.servlet.http.Cookie; 4 | import javax.servlet.http.HttpServletRequest; 5 | import javax.servlet.http.HttpServletResponse; 6 | 7 | import com.jfinal.handler.Handler; 8 | 9 | /** 10 | * cookie参数填入到request 11 | */ 12 | public class CookieHandler extends Handler { 13 | 14 | @Override 15 | public void handle(String target, HttpServletRequest request,HttpServletResponse response, boolean[] isHandled) { 16 | Cookie[] cookies = request.getCookies(); 17 | if (cookies != null) 18 | for (Cookie cookie : cookies) { 19 | String name = cookie.getName(); 20 | request.setAttribute(name, cookie.getValue()); 21 | } 22 | nextHandler.handle(target, request, response, isHandled); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/handler/RewriteHandler.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.handler; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import com.jfinal.handler.Handler; 7 | 8 | /** 9 | * 用途:重写Route,还有问题,需要改进 10 | * 说明:现在是简单实现用正则进行匹配,此方法还有待升级更多功能 11 | */ 12 | public class RewriteHandler extends Handler { 13 | 14 | @Override 15 | public void handle(String target, HttpServletRequest request,HttpServletResponse response, boolean[] isHandled) { 16 | // String fromUrl = target; 17 | // String toUrl = ""; 18 | // Prop prop = PropKit.use("urlrules.properties", Const.DEFAULT_ENCODING); 19 | // Properties p = prop.getProperties(); 20 | // Enumeration UrlRules = p.keys(); 21 | // while (UrlRules.hasMoreElements()){ 22 | // String reg = (String) UrlRules.nextElement(); 23 | // Pattern pattern = Pattern.compile("^"+reg+"$"); 24 | // if (pattern.matcher(fromUrl).matches()) { 25 | // toUrl = p.getProperty(reg); 26 | // break; 27 | // } 28 | // } 29 | // target = toUrl; 30 | // System.out.println(target); 31 | // System.out.println( PropertyKit.get("app_status")); 32 | // if (PropertyKit.get("app_status").equals("close")) { 33 | // target = "/closed"; 34 | // } 35 | nextHandler.handle(target, request, response, isHandled); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/handler/SessionHandler.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.handler; 2 | 3 | import java.util.Enumeration; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import javax.servlet.http.HttpSession; 8 | 9 | import com.jfinal.handler.Handler; 10 | 11 | /** 12 | * session参数填入到request 13 | * 14 | * @author 刘声凤 2012-9-4 下午10:22:19 15 | */ 16 | public class SessionHandler extends Handler { 17 | 18 | @Override 19 | public void handle(String target, HttpServletRequest request, 20 | HttpServletResponse response, boolean[] isHandled) { 21 | HttpSession session = request.getSession(); 22 | Enumeration atts = session.getAttributeNames(); 23 | while (atts.hasMoreElements() == true) { 24 | String an = atts.nextElement(); 25 | request.setAttribute(an, session.getAttribute(an)); 26 | } 27 | 28 | int index = target.indexOf(";jsessionid".toUpperCase()); 29 | 30 | if (index != -1) { 31 | target = target.substring(0, index); 32 | } 33 | 34 | nextHandler.handle(target, request, response, isHandled); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/interceptor/Global.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.interceptor; 2 | 3 | import com.cnvp.paladin.kit.PropertyKit; 4 | import com.jfinal.aop.Interceptor; 5 | import com.jfinal.core.ActionInvocation; 6 | import com.jfinal.core.Controller; 7 | import com.jfinal.core.JFinal; 8 | 9 | public class Global implements Interceptor { 10 | public void intercept(ActionInvocation ai) { 11 | 12 | Controller ctrl=ai.getController(); 13 | String cp = JFinal.me().getContextPath(); 14 | ctrl.setAttr("root",("".equals(cp) || "/".equals(cp)) ? "" : cp); 15 | ctrl.setAttr("action",ai.getActionKey()); 16 | ctrl.setAttr("app_name",PropertyKit.get("app_name")); 17 | ctrl.setAttr("ControllerKey",ai.getControllerKey()); 18 | ctrl.setAttr("ActionKey",ai.getActionKey()); 19 | // Method m = ai.getMethod(); 20 | // System.out.println(m.isVarArgs()); 21 | // JFinal.me().getConstants().setDevMode(PropertyKit.getToBoolean("app_devModel")); 22 | //每个连接器必须执行这个方法才可以继续执行 23 | ai.invoke(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/interceptor/Shiro.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.interceptor; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.shiro.SecurityUtils; 6 | import org.apache.shiro.subject.Subject; 7 | 8 | import com.cnvp.paladin.model.SysRes; 9 | import com.cnvp.paladin.model.SysUser; 10 | import com.jfinal.aop.Interceptor; 11 | import com.jfinal.core.ActionInvocation; 12 | import com.jfinal.core.JFinal; 13 | /** 14 | * 停用JFinal中的shiro拦截器,用AuthorizationFilter4Shiro替代 15 | * 直接在shiro的Filter其中注册AuthorizationFilter4Shiro 16 | * 这样可以结合shiro.ini做灵活的配置,同时也可以使用shiro的其他默认拦截器 17 | */ 18 | @Deprecated 19 | public class Shiro implements Interceptor { 20 | 21 | @Override 22 | public void intercept(ActionInvocation ai) { 23 | /* 继续完善权限控制体系 24 | * 1、配置资源代码,绑定actionKey 25 | * 2、把所有actionKey=>code_route放入缓存 26 | * 3、shiro拦截器中,根据actionKey在缓存中找到code_route 27 | * 4、根据code_route用shiro内置方法进行验证 28 | * */ 29 | // 获取Shiro Subject 30 | Subject currentUser = SecurityUtils.getSubject(); 31 | if (!currentUser.isAuthenticated()) { 32 | // 判断是否登陆 33 | System.err.println("会话超时or未登录"); 34 | String cp = JFinal.me().getContextPath(); 35 | cp = ("".equals(cp) || "/".equals(cp)) ? "" : cp; 36 | String url = cp+"/Passport/login?from="+ai.getController().getRequest().getRequestURL(); 37 | ai.getController().redirect(url); 38 | } else { 39 | SysUser user = (SysUser) currentUser.getPrincipal(); 40 | // 根据ak读取权限代码 41 | Map ak_coderoutes = SysRes.dao.getAk_CodeRoutes(); 42 | String code_route = ak_coderoutes.get(ai.getActionKey()); 43 | //进行权限判断 44 | if(user.getStr("account").equals("superadmin")){ 45 | ai.invoke(); 46 | }else if(code_route==null){ 47 | ai.getController().renderText(ai.getActionKey()+"由于该ActionKey未被配置到系统资源中,故默认没有权限"); 48 | }else if(currentUser.isPermitted(code_route)){ 49 | ai.invoke(); 50 | }else{ 51 | ai.getController().renderText("未授权,请联系管理员"); 52 | } 53 | return; 54 | } 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/kit/ConfigKit.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.kit; 2 | 3 | import java.util.Enumeration; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.Properties; 7 | import java.util.ResourceBundle; 8 | 9 | import com.jfinal.core.JFinal; 10 | 11 | 12 | /** 13 | * 配置文件app.properties所有配置 14 | * 15 | */ 16 | public class ConfigKit { 17 | public static Map config = new HashMap(); 18 | public static Properties properties=new Properties(); 19 | static { 20 | ResourceBundle rb = ResourceBundle.getBundle("app"); 21 | Enumeration cfgs = rb.getKeys(); 22 | while (cfgs.hasMoreElements()) { 23 | String key = cfgs.nextElement(); 24 | String val=rb.getString(key); 25 | config.put(key,val); 26 | } 27 | properties.putAll(config); 28 | } 29 | public static boolean isDevMode(){ 30 | return JFinal.me().getConstants().getDevMode(); 31 | } 32 | public static String getDbPrefix(){ 33 | return get("jdbc.dbPrefix"); 34 | } 35 | public static String get(String key){ 36 | return (String)config.get(key); 37 | } 38 | public static Object getObj(String key){ 39 | return config.get(key); 40 | } 41 | public static Boolean getToBool(String key,Boolean def){ 42 | try{ 43 | return Boolean.valueOf((String)config.get(key)); 44 | }catch(Exception e){ 45 | return def; 46 | } 47 | } 48 | public static Integer getToInteger(String key,Integer def){ 49 | try{ 50 | return Integer.valueOf((String)config.get(key)); 51 | }catch(Exception e){ 52 | return def; 53 | } 54 | } 55 | public static Long getToLong(String key,Long def){ 56 | try{ 57 | return Long.valueOf((String)config.get(key)); 58 | }catch(Exception e){ 59 | return def; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/kit/JstreeKit.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.kit; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import com.cnvp.paladin.core.BaseModel; 10 | 11 | public class JstreeKit { 12 | public static > List getNode(List models){ 13 | Map fieldMapping = new HashMap(); 14 | fieldMapping.put("id", "id"); 15 | fieldMapping.put("parent", "parent"); 16 | fieldMapping.put("text", "text"); 17 | return getNode(models,fieldMapping); 18 | } 19 | public static > List getNode(List models,Map fieldMapping){ 20 | Iterator it = models.iterator(); 21 | List nodes = new ArrayList(); 22 | while (it.hasNext()) { 23 | JstreeNode node = new JstreeNode(); 24 | T model = (T) it.next(); 25 | node.id = model.get(fieldMapping.get("id")).toString(); 26 | node.parent = model.get(fieldMapping.get("parent")).toString(); 27 | node.text = model.get(fieldMapping.get("text")).toString(); 28 | if (fieldMapping.get("icon")!=null) 29 | node.icon = model.get(fieldMapping.get("icon")).toString(); 30 | if (fieldMapping.get("opened")!=null) 31 | node.state.opened = model.get(fieldMapping.get("opened")).toString(); 32 | if (fieldMapping.get("disabled")!=null) 33 | node.state.disabled = model.get(fieldMapping.get("disabled")).toString(); 34 | if (fieldMapping.get("selected")!=null) 35 | node.state.selected = model.get(fieldMapping.get("selected")).toString(); 36 | nodes.add(node); 37 | } 38 | return nodes; 39 | } 40 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/kit/JstreeNode.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.kit; 2 | 3 | public class JstreeNode { 4 | public String id; 5 | public String parent; 6 | public String text; 7 | public String icon; 8 | public JstreeNodeState state = new JstreeNodeState(); 9 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/kit/JstreeNodeState.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.kit; 2 | 3 | public class JstreeNodeState { 4 | 5 | public String opened; 6 | public String disabled; 7 | public String selected; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/kit/PropertyKit.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.kit; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileOutputStream; 7 | import java.io.IOException; 8 | import java.io.OutputStream; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | import java.util.Properties; 12 | 13 | import com.jfinal.kit.PathKit; 14 | 15 | /** 16 | * 1、必须是.properties文件 2、必须在WEB-INF/classes目录下 17 | */ 18 | public class PropertyKit { 19 | // 属性文件的路径 20 | // static String profilepath = "config.properties"; 21 | static String defaultPropFileName = "config"; 22 | private static Map props = new HashMap(); 23 | static { 24 | load(defaultPropFileName); 25 | } 26 | public static boolean getToBoolean(String key){ 27 | String val = get(key); 28 | return Boolean.parseBoolean(val); 29 | } 30 | public static String get(String key) { 31 | return get(key,defaultPropFileName); 32 | } 33 | public static String get(String key,String proFileName) { 34 | if(!props.containsKey(proFileName)) 35 | load(proFileName); 36 | return props.get(proFileName).getProperty(key); 37 | } 38 | 39 | /** 40 | * 更新(或插入)一对properties信息(主键及其键值) 如果该主键已经存在,更新该主键的值; 如果该主键不存在,则插件一对键值。 41 | */ 42 | public static boolean set(String keyname, String keyvalue) { 43 | return set(keyname,keyvalue,defaultPropFileName); 44 | } 45 | public static boolean set(String keyname, String keyvalue ,String proFileName) { 46 | // if (!props.containsKey(proFileName)) 47 | load(proFileName); 48 | try { 49 | String profilepath = PathKit.getWebRootPath() + File.separator + "WEB-INF" + File.separator + proFileName + ".properties"; 50 | Properties prop = props.get(proFileName); 51 | OutputStream fos = new FileOutputStream(profilepath); 52 | prop.setProperty(keyname, keyvalue); 53 | prop.store(fos, "Update '" + keyname + "' value"); 54 | props.put(proFileName, prop); 55 | return true; 56 | } catch (IOException e) { 57 | System.err.println("属性文件更新错误"); 58 | return false; 59 | } 60 | } 61 | 62 | private static void load(String proFileName) { 63 | String profilepath = PathKit.getWebRootPath() + File.separator + "WEB-INF" + File.separator + proFileName + ".properties"; 64 | File file = new File(profilepath); 65 | if (!file.exists()) { 66 | try { 67 | file.createNewFile(); 68 | } catch (IOException e) { 69 | System.err.println("PropertyKit=>文件不存在,且创建失败"); 70 | e.printStackTrace(); 71 | } 72 | } 73 | try { 74 | Properties prop = new Properties(); 75 | prop.load(new FileInputStream(profilepath)); 76 | props.put(proFileName, prop); 77 | } catch (FileNotFoundException e) { 78 | System.err.println("PropertyKit=>读取失败:"+profilepath); 79 | e.printStackTrace(); 80 | System.exit(-1); 81 | } catch (IOException e) { 82 | System.exit(-1); 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/kit/tree/TreeNode.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.kit.tree; 2 | 3 | import java.util.List; 4 | import java.util.ArrayList; 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 用途: 9 | * 说明: 10 | */ 11 | @SuppressWarnings("serial") 12 | public class TreeNode implements Serializable { 13 | private int Id; 14 | private int Pid; 15 | private String nodeName; 16 | private Object obj; 17 | private TreeNode parentNode; 18 | private List childList; 19 | 20 | public TreeNode() { 21 | initChildList(); 22 | } 23 | //初始化子节点 24 | public void initChildList() { 25 | if (childList == null) 26 | childList = new ArrayList(); 27 | } 28 | //当前节点是否是叶节点(最终节点,无子节点) 29 | public boolean isLeaf() { 30 | if (childList == null) { 31 | return true; 32 | } else { 33 | if (childList.isEmpty()) { 34 | return true; 35 | } else { 36 | return false; 37 | } 38 | } 39 | } 40 | public void addChildNode(TreeNode childNode){ 41 | childNode.setParentNode(this); 42 | this.childList.add(childNode); 43 | } 44 | 45 | //seter geter 46 | 47 | public void setChildList(List childList) { 48 | this.childList = childList; 49 | } 50 | public List getChildList() { 51 | return this.childList; 52 | } 53 | 54 | public int getPid() { 55 | return Pid; 56 | } 57 | 58 | public void setPid(int Pid) { 59 | this.Pid = Pid; 60 | } 61 | 62 | public int getId() { 63 | return Id; 64 | } 65 | 66 | public void setId(int Id) { 67 | this.Id = Id; 68 | } 69 | 70 | public TreeNode getParentNode() { 71 | return parentNode; 72 | } 73 | 74 | public void setParentNode(TreeNode parentNode) { 75 | this.parentNode = parentNode; 76 | } 77 | 78 | public String getNodeName() { 79 | return nodeName; 80 | } 81 | 82 | public void setNodeName(String nodeName) { 83 | this.nodeName = nodeName; 84 | } 85 | 86 | public Object getObj() { 87 | return obj; 88 | } 89 | 90 | public void setObj(Object obj) { 91 | this.obj = obj; 92 | } 93 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysDept.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import com.cnvp.paladin.core.BaseModel; 4 | import com.jfinal.plugin.activerecord.Page; 5 | 6 | @SuppressWarnings("serial") 7 | public class SysDept extends BaseModel { 8 | public static final SysDept dao = new SysDept(); 9 | public Page paginate(int pageNumber, int pageSize) { 10 | return paginate(pageNumber, pageSize, "select *", "from "+getTableName()+" order by id asc"); 11 | } 12 | public boolean hasChild(){ 13 | if (SysDept.dao.set("pid", get("id")).findByModel().size()>0) 14 | return true; 15 | else 16 | return false; 17 | } 18 | public void getSelect(){ 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysNav.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import com.cnvp.paladin.core.BaseModel; 4 | import com.jfinal.plugin.activerecord.Page; 5 | 6 | @SuppressWarnings("serial") 7 | public class SysNav extends BaseModel { 8 | public static final SysNav dao = new SysNav(); 9 | /** 10 | * 所有 sql 与业务逻辑写在 Model 或 Service 中,不要写在 Controller 中,养成好习惯,有利于大型项目的开发与维护 11 | */ 12 | public Page paginate(int pageNumber, int pageSize) { 13 | return paginate(pageNumber, pageSize, "select *", "from cnvp_sys_nav order by id asc"); 14 | } 15 | private SysRes res = null; 16 | public SysRes getRes(){ 17 | if (this.res==null) { 18 | Integer res_id = getInt("res_id"); 19 | SysRes res = SysRes.dao.findById(res_id); 20 | if (res==null) 21 | this.res = new SysRes(); 22 | else 23 | this.res = res; 24 | } 25 | return this.res; 26 | } 27 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysRes.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import com.cnvp.paladin.core.BaseModel; 10 | import com.jfinal.plugin.ehcache.CacheKit; 11 | 12 | @SuppressWarnings("serial") 13 | public class SysRes extends BaseModel { 14 | public static final SysRes dao = new SysRes(); 15 | public boolean hasChild(){ 16 | return exists("pid=?",get("id")); 17 | } 18 | public boolean hasParent(){ 19 | return exists("id=?",get("pid")); 20 | } 21 | public SysRes addParentCode(){ 22 | Map attrs = getAttrs(); 23 | if(attrs.get("id")!=null&&!this.hasParent()) 24 | return this; 25 | List codes = getParentCodes(getInt("pid")); 26 | if(codes.size()==0) return this; 27 | StringBuilder codeStr = new StringBuilder(); 28 | for (int i = 0; i < codes.size(); i++) { 29 | if (i!=0) 30 | codeStr.append(":"); 31 | codeStr.append(codes.get(i)); 32 | } 33 | attrs.put("parent_code", codeStr.toString()); 34 | return this; 35 | } 36 | public List getParentCodes(Integer pid){ 37 | List codes = new ArrayList(); 38 | SysRes parent = SysRes.dao.findById(pid); 39 | if(parent==null) return codes; 40 | codes.add(0,parent.getStr("code")); 41 | if(parent.hasParent()) 42 | getParentCode(parent.getInt("pid"),codes); 43 | return codes; 44 | } 45 | public void getParentCode(Integer pid,List codes){ 46 | SysRes parent = SysRes.dao.findById(pid); 47 | if(parent==null) return; 48 | codes.add(0,parent.getStr("code")); 49 | if(parent.hasParent()) 50 | getParentCode(parent.getInt("pid"),codes); 51 | } 52 | public Map toNodeData(){ 53 | Map node = new HashMap(); 54 | node.put("id",get("id").toString()); 55 | node.put("isParent",hasChild()); 56 | node.put("cname",get("cname").toString()); 57 | node.put("cname",get("code").toString()); 58 | String name = ""+get("cname").toString()+""; 59 | if(get("code")!=null) 60 | name+=" ["+get("code").toString()+"] "; 61 | if(get("ak")!=null) 62 | name+=" ["+(get("ak")==null?"":get("ak"))+"] "; 63 | node.put("name",name); 64 | node.put("pid",get("pid").toString()); 65 | return node; 66 | } 67 | // 68 | public Map getAk_CodeRoutes(){ 69 | 70 | Map ak_coderoutes = CacheKit.get("system", "ak_coderoutes"); 71 | if (ak_coderoutes==null) { 72 | ak_coderoutes = new HashMap(); 73 | List res = SysRes.dao.where("ak is not null and ak<>''"); 74 | Iterator it = res.iterator(); 75 | while (it.hasNext()) { 76 | SysRes sysRes = (SysRes) it.next(); 77 | ak_coderoutes.put(sysRes.getStr("ak"), sysRes.getStr("code_route")); 78 | } 79 | CacheKit.put("system", "ak_coderoutes", ak_coderoutes); 80 | } 81 | return ak_coderoutes; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysRole.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import com.cnvp.paladin.core.BaseModel; 8 | import com.jfinal.plugin.activerecord.Page; 9 | 10 | @SuppressWarnings("serial") 11 | public class SysRole extends BaseModel { 12 | public static final SysRole dao = new SysRole(); 13 | public Page paginate(int pageNumber, int pageSize) { 14 | return paginate(pageNumber, pageSize, "select *", "from "+getTableName()+" order by cname asc"); 15 | } 16 | public boolean hasChild(){ 17 | if (SysRole.dao.where("pid=?",getInt("id")).size()>0) 18 | return true; 19 | else 20 | return false; 21 | } 22 | public List getResidList(){ 23 | List r = new ArrayList(); 24 | List rs = new SysRoleRes().set("role_id", get("id")).findByModel(); 25 | Iterator it = rs.iterator(); 26 | while (it.hasNext()) { 27 | SysRoleRes m = (SysRoleRes) it.next(); 28 | r.add(m.get("res_id").toString()); 29 | } 30 | return r; 31 | } 32 | public void checkAll(Integer role_id,boolean flg){ 33 | SysRoleRes.dao.deleteAll("role_id=?",role_id); 34 | if(flg==false) return; 35 | List srs = SysRes.dao.findAll(); 36 | Iterator it = srs.iterator(); 37 | while (it.hasNext()) { 38 | SysRes sr = (SysRes) it.next(); 39 | SysRoleRes srr = new SysRoleRes(); 40 | srr.set("role_id", role_id); 41 | srr.set("res_id", sr.getInt("id")); 42 | srr.save(); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysRoleRes.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import com.cnvp.paladin.core.BaseModel; 4 | 5 | @SuppressWarnings("serial") 6 | public class SysRoleRes extends BaseModel { 7 | public static final SysRoleRes dao = new SysRoleRes(); 8 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysUser.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | 8 | import com.cnvp.paladin.core.BaseModel; 9 | import com.jfinal.plugin.activerecord.Db; 10 | import com.jfinal.plugin.activerecord.Page; 11 | import com.jfinal.plugin.activerecord.Record; 12 | 13 | @SuppressWarnings("serial") 14 | public class SysUser extends BaseModel { 15 | public static final SysUser dao = new SysUser(); 16 | public Page paginate(int pageNumber, int pageSize) { 17 | return paginate(pageNumber, pageSize, "select *", "from "+getTableName()+" order by id asc"); 18 | } 19 | public String getDeptName(){ 20 | Integer dept_id = getInt("dept_id"); 21 | SysDept dept = SysDept.dao.findById(dept_id); 22 | if (dept==null) 23 | return null; 24 | else{ 25 | return dept.getStr("cname"); 26 | } 27 | } 28 | public boolean delete() { 29 | SysUserRole.dao.deleteAll("user_id=?", getInt("id")); 30 | return super.delete(); 31 | } 32 | public int deleteAllRoles(){ 33 | return SysUserRole.dao.deleteAllByUserId(getInt("id")); 34 | } 35 | public List getRoles(){ 36 | return SysUserRole.dao.findByUserId(getInt("id")); 37 | } 38 | public Collection getRoleNameList(){ 39 | List r = Db.queryColumn("select cname from "+ getDbPerfix() +"sys_role r " 40 | + "left join "+ getDbPerfix() +"sys_user_role ur on r.id=ur.role_id " 41 | + "where ur.userid=?", getInt("id")); 42 | return r; 43 | } 44 | public List getRes(){ 45 | List roles = getRoles(); 46 | StringBuffer sql = new StringBuffer(); 47 | sql.append("select res.id,res.id,res.code_route from cnvp_sys_res res "); 48 | sql.append("left join cnvp_sys_role_res role_res on role_res.res_id = res.id "); 49 | sql.append("right join cnvp_sys_role role on role_res.role_id = role.id "); 50 | sql.append("where role.id in("); 51 | for (int i = 0; i < roles.size(); i++) { 52 | if(i!=0)sql.append(","); 53 | sql.append(roles.get(i).get("role_id")); 54 | } 55 | sql.append(") "); 56 | sql.append("group by res.id "); 57 | sql.append("order by id asc "); 58 | List code_routes = Db.find(sql.toString()); 59 | List reses = new ArrayList(); 60 | Iterator it = code_routes.iterator(); 61 | while (it.hasNext()) { 62 | Record r = (Record) it.next(); 63 | reses.add(r.getStr("code_route")); 64 | } 65 | return reses; 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/model/SysUserRole.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import java.util.List; 4 | 5 | import com.cnvp.paladin.core.BaseModel; 6 | import com.jfinal.plugin.activerecord.Db; 7 | import com.jfinal.plugin.activerecord.Page; 8 | 9 | @SuppressWarnings("serial") 10 | public class SysUserRole extends BaseModel { 11 | public static final SysUserRole dao = new SysUserRole(); 12 | public Page paginate(int pageNumber, int pageSize) { 13 | return paginate(pageNumber, pageSize, "select *", "from "+getTableName()+" order by id asc"); 14 | } 15 | public int deleteAllByUserId(int user_id){ 16 | return Db.update("delete from "+getTableName()+" where user_id=?",user_id); 17 | } 18 | public List findByUserId(int user_id){ 19 | return where("user_id = ?",user_id); 20 | } 21 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/plugin/AutoTableBindPlugin.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.plugin; 2 | 3 | import java.util.List; 4 | 5 | import javax.sql.DataSource; 6 | 7 | import com.cnvp.paladin.core.BaseModel; 8 | import com.cnvp.paladin.kit.ClassKit; 9 | import com.cnvp.paladin.kit.ConfigKit; 10 | import com.jfinal.kit.StrKit; 11 | import com.jfinal.plugin.activerecord.ActiveRecordPlugin; 12 | import com.jfinal.plugin.activerecord.IDataSourceProvider; 13 | /*** 14 | * 自动绑定model与数据库表 15 | */ 16 | public class AutoTableBindPlugin extends ActiveRecordPlugin { 17 | private TableNameStyle tableNameStyle; 18 | public AutoTableBindPlugin(DataSource dataSource) { 19 | super(dataSource); 20 | } 21 | 22 | public AutoTableBindPlugin(IDataSourceProvider dataSourceProvider, TableNameStyle tableNameStyle) { 23 | super(dataSourceProvider); 24 | this.tableNameStyle = tableNameStyle; 25 | } 26 | 27 | @SuppressWarnings({ "rawtypes", "unchecked" }) 28 | @Override 29 | public boolean start() { 30 | try { 31 | List modelClasses = ClassKit.findClasses(BaseModel.class); 32 | TableBind tb = null; 33 | for (Class modelClass : modelClasses) { 34 | tb = (TableBind) modelClass.getAnnotation(TableBind.class); 35 | if (tb == null) { 36 | this.addMapping(tableName(modelClass), modelClass); 37 | } else { 38 | if(StrKit.notBlank(tb.name())){ 39 | if (StrKit.notBlank(tb.pk())) { 40 | this.addMapping(tb.name(), tb.pk(), modelClass); 41 | } else { 42 | this.addMapping(tb.name(), modelClass); 43 | } 44 | }else{ 45 | if (StrKit.notBlank(tb.pk())) { 46 | this.addMapping(tableName(modelClass), tb.pk(), modelClass); 47 | } 48 | } 49 | } 50 | } 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | // throw new RuntimeException(e); 54 | } 55 | return super.start(); 56 | } 57 | 58 | @Override 59 | public boolean stop() { 60 | return super.stop(); 61 | } 62 | 63 | // 根据类名生成Table名 64 | private String tableName(Class> clazz) { 65 | String tableName = clazz.getSimpleName(); 66 | if (tableNameStyle == TableNameStyle.UP) { 67 | tableName = tableName.toUpperCase(); 68 | } else if (tableNameStyle == TableNameStyle.LOWER) { 69 | tableName = tableName.toLowerCase(); 70 | } else if (tableNameStyle == TableNameStyle.LOWER_UNDERLINE) { 71 | tableName = tableName.replaceAll("[A-Z]", "_$0"); 72 | tableName = tableName.substring(1,tableName.length()).toLowerCase(); 73 | }else { 74 | tableName = StrKit.firstCharToLowerCase(tableName); 75 | } 76 | String tablePrefix =ConfigKit.get("jdbc.dbPrefix"); 77 | if (!StrKit.isBlank(tablePrefix)) 78 | tableName = tablePrefix + tableName; 79 | System.out.println("DATABASE_TABLE_MAPPING---->"+clazz.getName()+"=>"+tableName); 80 | return tableName; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/plugin/TableBind.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.plugin; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | /** 9 | * model绑定数据库表注解 10 | * @author loyin 11 | * 2012-9-4 上午11:48:26 12 | */ 13 | @Inherited 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target({ElementType.TYPE}) 16 | public @interface TableBind { 17 | /**表名*/ 18 | String name() default ""; 19 | /**主键名*/ 20 | String pk() default "id"; 21 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/plugin/TableNameStyle.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.plugin; 2 | 3 | public enum TableNameStyle { 4 | UP, LOWER, UP_UNDERLINE, LOWER_UNDERLINE 5 | } 6 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/plugin/shiro/AuthorizationFilter4Shiro.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.plugin.shiro; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import javax.servlet.ServletRequest; 7 | import javax.servlet.ServletResponse; 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | import org.apache.shiro.subject.Subject; 11 | import org.apache.shiro.web.filter.authz.AuthorizationFilter; 12 | 13 | import com.cnvp.paladin.model.SysRes; 14 | import com.cnvp.paladin.model.SysUser; 15 | import com.jfinal.core.JFinal; 16 | 17 | public class AuthorizationFilter4Shiro extends AuthorizationFilter { 18 | 19 | @Override 20 | protected boolean isAccessAllowed(ServletRequest request,ServletResponse response, Object mappedValue) throws Exception { 21 | //-----------------登陆认证------------------ 22 | HttpServletRequest req = (HttpServletRequest) request; 23 | Subject currentUser = getSubject(request, response); 24 | setLoginUrl(createLoginURL(req)); 25 | if (!currentUser.isAuthenticated()) 26 | return false; 27 | //-----------------权限认证------------- 28 | SysUser user = (SysUser) currentUser.getPrincipal(); 29 | // 根据ak读取权限代码 30 | Map ak_coderoutes = SysRes.dao.getAk_CodeRoutes(); 31 | String code_route = ak_coderoutes.get(getActionKey(req)); 32 | //进行权限判断 33 | if (user==null) 34 | return false; 35 | else if(user.getStr("account").equals("superadmin")){ 36 | return true; 37 | }else if(code_route==null){ 38 | return false; 39 | }else if(currentUser.isPermitted(code_route)){ 40 | return true; 41 | }else{ 42 | return false; 43 | } 44 | } 45 | 46 | private String createLoginURL(HttpServletRequest req) { 47 | StringBuffer fromURL = req.getRequestURL(); 48 | String loginUrl = getLoginUrl(); 49 | int i = loginUrl.indexOf("?"); 50 | if (i!=-1) { 51 | loginUrl = loginUrl.substring(0, i); 52 | } 53 | if (fromURL.length()>0) 54 | loginUrl +="?from="+fromURL; 55 | return loginUrl; 56 | } 57 | 58 | private String getActionKey(HttpServletRequest request) { 59 | //获取所有AK 60 | List aks = JFinal.me().getAllActionKeys(); 61 | /* 62 | * 由于不能直接使用Action类,无法使用JFinal.me().getAction(url, urlPara)来直接获取 63 | * 以下代码取自JFinal的JFinal.core的相关类,保证与JFinal获取AK的方式相同 64 | * TODO 各位路人不知道是否有更好的方法? 65 | */ 66 | //开始 67 | String target = request.getRequestURI(); 68 | String contextPath = request.getServletContext().getContextPath(); 69 | Integer contextPathLength = (contextPath == null || "/".equals(contextPath) ? 0 : contextPath.length()); 70 | if (contextPathLength != 0) 71 | target = target.substring(contextPathLength); 72 | //结束 73 | if (aks.contains(target)) 74 | return target; 75 | int i = target.lastIndexOf("/"); 76 | if (i != -1) { 77 | target = target.substring(0, i); 78 | if (aks.contains(target)) 79 | return target; 80 | } 81 | return ""; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/plugin/shiro/ShiroDbRealm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.cnvp.paladin.plugin.shiro; 5 | 6 | import java.util.List; 7 | 8 | import org.apache.shiro.authc.AuthenticationException; 9 | import org.apache.shiro.authc.AuthenticationInfo; 10 | import org.apache.shiro.authc.AuthenticationToken; 11 | import org.apache.shiro.authc.SimpleAuthenticationInfo; 12 | import org.apache.shiro.authc.UsernamePasswordToken; 13 | import org.apache.shiro.authz.AuthorizationInfo; 14 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 15 | import org.apache.shiro.cache.Cache; 16 | import org.apache.shiro.realm.AuthorizingRealm; 17 | import org.apache.shiro.subject.PrincipalCollection; 18 | import org.apache.shiro.subject.SimplePrincipalCollection; 19 | 20 | import com.cnvp.paladin.model.SysUser; 21 | import com.jfinal.core.JFinal; 22 | 23 | public class ShiroDbRealm extends AuthorizingRealm{ 24 | 25 | 26 | 27 | /** 28 | * 认证回调函数,登录时调用. 29 | * 提取当前用户角色和权限 30 | * com.jfaker.framework.security.shiro.ShiroAuthorizingRealm 31 | */ 32 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException { 33 | UsernamePasswordToken token = (UsernamePasswordToken) authcToken; 34 | SysUser sysUser = SysUser.dao.set("account", token.getUsername()).findFirstByModel(); 35 | // System.err.println("ShiroDbRealm::AuthenticationInfo"); 36 | if (sysUser != null) { 37 | return new SimpleAuthenticationInfo(sysUser, sysUser.getStr("password"),sysUser.getStr("account")); 38 | } else { 39 | return null; 40 | } 41 | } 42 | 43 | /** 44 | * 授权查询回调函数, 进行鉴权但缓存中无用户的授权信息时调用. 45 | */ 46 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { 47 | SysUser userInPrincipal = (SysUser) principals.getPrimaryPrincipal(); 48 | List user = SysUser.dao.where("account = ?",userInPrincipal.getStr("account")); 49 | if(user.size()!=1){ 50 | if (JFinal.me().getConstants().getDevMode()) 51 | System.err.println("错误:用户不是唯一"); 52 | return null; 53 | }if(user.size()==0){ 54 | if (JFinal.me().getConstants().getDevMode()) 55 | System.err.println("错误:无法找到用户"); 56 | return null; 57 | } 58 | SysUser userInDb = user.get(0); 59 | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); 60 | //根据用户获取权限 61 | List code_routes = userInDb.getRes(); 62 | info.addStringPermissions(code_routes); 63 | return info; 64 | } 65 | 66 | /** 67 | * 更新用户授权信息缓存. 68 | */ 69 | public void clearCachedAuthorizationInfo(String principal) { 70 | SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName()); 71 | clearCachedAuthorizationInfo(principals); 72 | } 73 | 74 | /** 75 | * 清除所有用户授权信息缓存. 76 | */ 77 | public void clearAllCachedAuthorizationInfo() { 78 | Cache cache = getAuthorizationCache(); 79 | if (cache != null) { 80 | for (Object key : cache.keys()) { 81 | cache.remove(key); 82 | } 83 | } 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/service/DbService.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.service; 2 | 3 | import java.io.File; 4 | import java.io.InputStream; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import java.util.Scanner; 8 | 9 | import com.cnvp.paladin.kit.ConfigKit; 10 | import com.jfinal.kit.PathKit; 11 | 12 | public class DbService { 13 | 14 | private static String sp = File.separator; 15 | /** 16 | * @param path URL绝对路径 17 | * @throws Exception 18 | */ 19 | public static void backup(String path) throws Exception{ 20 | //转换为物理路径 21 | path = PathKit.getWebRootPath() + path; 22 | System.out.println(path); 23 | //判断目录是否存在,不存在则新建 24 | File pathObj =new File(path); 25 | if (!pathObj .exists() && !pathObj .isDirectory()) 26 | pathObj .mkdir(); 27 | //生成sql文件名 28 | SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); 29 | String sqlFileName = formatter.format(new Date(System.currentTimeMillis()))+".sql"; 30 | //生成sql文件完整物理路径 31 | String sqlFile = path+sp+sqlFileName; 32 | sqlFile = sqlFile.replace("/", sp).replace("\\", sp); 33 | System.out.println(sqlFile); 34 | // 这里是读取的属性文件,也可以直接使用 35 | String username = ConfigKit.get("jdbc.username"); 36 | String password = ConfigKit.get("jdbc.password"); 37 | String dbName = ConfigKit.get("jdbc.dbName"); 38 | String cmdTxt_no = "mysqldump -u "+username+" -p"+password+" --default-character-set=utf8 --lock-all-tables=true "+dbName+" > "+ sqlFile; 39 | StringBuilder cmdTxt = new StringBuilder(); 40 | cmdTxt 41 | .append("mysqldump") 42 | .append(" --opt") 43 | // .append(" -h").append(hostIP) 44 | .append(" --user=").append(username) 45 | .append(" --password=").append(username) 46 | .append(" --lock-all-tables=true") 47 | .append(" --result-file=").append(sqlFile) 48 | .append(" --default-character-set=utf8 ") 49 | .append(dbName); 50 | System.out.println(cmdTxt); 51 | System.out.println(cmdTxt_no); 52 | 53 | Runtime rt = Runtime.getRuntime(); 54 | // //-u后面是用户名,-p是密码-p后面最好不要有空格,-family是数据库的名字 55 | Process process = rt.exec(cmdTxt_no); 56 | InputStream inputStream = process.getInputStream(); 57 | Scanner scanner = new Scanner(inputStream, "UTF-8"); 58 | String text = scanner.useDelimiter("\\A").next(); 59 | System.out.println(text); 60 | scanner.close(); 61 | // InputStream inputStream = process.getInputStream();//得到输入流,写成.sql文件 62 | // InputStreamReader reader = new InputStreamReader(inputStream); 63 | // BufferedReader br = new BufferedReader(reader); 64 | // String s = null; 65 | // StringBuffer sb = new StringBuffer(); 66 | // while((s = br.readLine()) != null){ 67 | // sb.append(s+"\r\n"); 68 | // } 69 | // s = sb.toString(); 70 | // 71 | // File file = new File(sqlFile); 72 | // file.getParentFile().mkdirs(); 73 | // FileOutputStream fileOutputStream = new FileOutputStream(file); 74 | // fileOutputStream.write(s.getBytes()); 75 | // fileOutputStream.close(); 76 | // br.close(); 77 | // reader.close(); 78 | // inputStream.close(); 79 | } 80 | public static void backup() throws Exception{ 81 | backup("/db_bak"); 82 | } 83 | 84 | /** 85 | * 恢复备份 86 | * @throws Exception 87 | */ 88 | public static void recover() throws Exception{ 89 | String path="mysql -uroot -padmin wj < F:\\MySQl\\loowj.sql"; 90 | //注意文件路径中存在空格,需要再空格地方加上" "引上空格 91 | java.lang.Runtime.getRuntime().exec("cmd.exe /c C:\\Program\" \"Files\\MySQL5\\bin\\"+path); 92 | } 93 | 94 | public static void main(String[] args) { 95 | try { 96 | backup("loowj.sql"); 97 | } catch (Exception e) { 98 | e.printStackTrace(); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/service/GeneratoService.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.service; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import com.cnvp.paladin.kit.ConfigKit; 9 | import com.cnvp.paladin.kit.StringKit; 10 | import com.jfinal.plugin.activerecord.Db; 11 | import com.jfinal.plugin.activerecord.Record; 12 | 13 | public class GeneratoService { 14 | 15 | public static List getFields(String tableName) { 16 | List cols = Db.find("SHOW FULL COLUMNS FROM "+tableName+" where Extra<>'auto_increment'"); 17 | System.out.println(cols.size()); 18 | for (int i = 0; i < cols.size(); i++) { 19 | Map field = new HashMap(); 20 | field = cols.get(i).getColumns(); 21 | String fieldType = field.get("Type").toString(); 22 | String[] type = StringKit.getFieldTypeLength(fieldType); 23 | field.put("Type", type[0]); 24 | field.put("Length", type[1]); 25 | ArrayList validate = new ArrayList(); 26 | if ("NO".equals(field.get("Null").toString())) { 27 | validate.add("required:请填写"+field.get("Comment")); 28 | } 29 | field.put("validate", StringKit.implode(validate, ",")); 30 | 31 | } 32 | return cols; 33 | } 34 | public static List getTables() { 35 | String dbPrefix = ConfigKit.get("jdbc.dbPrefix"); 36 | return getTables(dbPrefix); 37 | } 38 | public static List getTables(String dbPrefix) { 39 | List tables = Db.find("SHOW TABLE STATUS LIKE '" + dbPrefix 40 | + "%'"); 41 | for (int i = 0; i < tables.size(); i++) { 42 | Map table = new HashMap(); 43 | table = tables.get(i).getColumns(); 44 | String tableName = table.get("name").toString(); 45 | table.put("modelname", StringKit.tableName_2_modelName(tableName)); 46 | 47 | } 48 | return tables; 49 | } 50 | public static Record getTable(String dbPrefix,String tableName) { 51 | return Db.findFirst("SHOW TABLE STATUS where Name=?",(dbPrefix + tableName)); 52 | } 53 | public static Record getTable(String tableName) { 54 | return Db.findFirst("SHOW TABLE STATUS where Name=?",tableName); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/service/NavService.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.service; 2 | 3 | import java.util.List; 4 | 5 | import com.cnvp.paladin.model.SysNav; 6 | 7 | public class NavService { 8 | public static List getTreeMap(int pid) { 9 | List rows = new SysNav().set("pid", pid).findByModel("orderid asc"); 10 | if (!rows.isEmpty()) { 11 | for (int i = 0; i < rows.size(); i++) { 12 | List sub = getChildren(new Integer(rows.get(i) 13 | .get("id").toString())); 14 | if (!sub.isEmpty()) { 15 | rows.get(i).put("hasChild", true); 16 | rows.get(i).put("children", sub); 17 | } 18 | ; 19 | } 20 | 21 | } 22 | return rows; 23 | } 24 | 25 | public static List getChildren(int pid) { 26 | List rows = new SysNav().set("pid", pid).findByModel("orderid asc"); 27 | if (!rows.isEmpty()) { 28 | for (int i = 0; i < rows.size(); i++) { 29 | List sub = getChildren(new Integer(rows.get(i) 30 | .get("id").toString())); 31 | if (!sub.isEmpty()) { 32 | rows.get(i).put("hasChild", true); 33 | rows.get(i).put("children", sub); 34 | } 35 | } 36 | } 37 | return rows; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/utils/AutoRoutes.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.utils; 2 | 3 | import java.util.List; 4 | 5 | import com.cnvp.paladin.core.BaseController; 6 | import com.cnvp.paladin.kit.ClassKit; 7 | import com.jfinal.config.Routes; 8 | 9 | /** 10 | * 用途:根据类名完整路径自动映射route与controller关系 说明: 11 | * 1、com.cnvp.controllers为根分组,其下面直接的controller为根控制器 12 | * 2、com.cnvp.controllers下的包为其他分组 13 | * 3、各分组中以Index开头的控制器为默认控制器,可在app.properties中进行配置 14 | * 【重要约定】 1、根控制器,不得与分组重名 2、根控制器中的方法,不得与分组中的控制器重名 3、同一分组内,控制器不得与index控制器中的方法重名 15 | * 比如有了Admin分组,根控制器就不能有AdminController 16 | */ 17 | public class AutoRoutes { 18 | @SuppressWarnings("unchecked") 19 | public static void add(Routes me, String defaultContorller) { 20 | String controllersPackge = "com.cnvp.paladin.controller"; 21 | List classNames = ClassKit.getClassName(controllersPackge); 22 | for (String className : classNames) { 23 | String routeFromClass = className.replace(controllersPackge + ".", 24 | "").replace("Controller", ""); 25 | String[] layers = routeFromClass.split("\\."); 26 | String route = ""; 27 | for (int i = 0; i < layers.length; i++) { 28 | if (i != (layers.length - 1) 29 | || !layers[i].equals(defaultContorller)) 30 | route += "/" + layers[i]; 31 | } 32 | if ("".equals(route)) 33 | route = "/"; 34 | Class forClass; 35 | try { 36 | forClass = (Class) Class.forName(className); 37 | } catch (ClassNotFoundException e) { 38 | break; 39 | } 40 | System.out.println(route + "=>" + className); 41 | me.add(route, forClass); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/utils/beetl/BeetlRender.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.utils.beetl; 2 | 3 | import org.beetl.core.GroupTemplate; 4 | import org.beetl.core.exception.BeetlException; 5 | import org.beetl.ext.web.WebRender; 6 | 7 | import com.jfinal.render.Render; 8 | import com.jfinal.render.RenderException; 9 | 10 | public class BeetlRender extends Render { 11 | GroupTemplate gt = null; 12 | private transient static final String encoding = getEncoding(); 13 | private transient static final String contentType = "text/html; charset=" 14 | + encoding; 15 | 16 | public BeetlRender(GroupTemplate gt, String view) { 17 | this.gt = gt; 18 | this.view = view; 19 | } 20 | 21 | @Override 22 | public void render() { 23 | 24 | try 25 | 26 | { 27 | response.setContentType(contentType); 28 | WebRender webRender = new WebRender(gt); 29 | webRender.render(view, request, response); 30 | 31 | } catch (BeetlException e) { 32 | throw new RenderException(e); 33 | } 34 | 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/utils/beetl/BeetlRenderFactory.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.utils.beetl; 2 | 3 | import java.io.IOException; 4 | 5 | import org.beetl.core.Configuration; 6 | import org.beetl.core.GroupTemplate; 7 | import org.beetl.core.resource.WebAppResourceLoader; 8 | 9 | import com.jfinal.render.IMainRenderFactory; 10 | import com.jfinal.render.Render; 11 | 12 | public class BeetlRenderFactory implements IMainRenderFactory { 13 | 14 | public static String viewExtension = ".html"; 15 | public static GroupTemplate groupTemplate = null; 16 | 17 | static { 18 | try { 19 | 20 | Configuration cfg = Configuration.defaultConfiguration(); 21 | WebAppResourceLoader resourceLoader = new WebAppResourceLoader(); 22 | groupTemplate = new GroupTemplate(resourceLoader, cfg); 23 | 24 | } catch (IOException e) { 25 | throw new RuntimeException("加载GroupTemplate失败", e); 26 | } 27 | } 28 | 29 | public Render getRender(String view) { 30 | return new BeetlRender(groupTemplate, view); 31 | } 32 | 33 | public String getViewExtension() { 34 | return viewExtension; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/com/cnvp/paladin/utils/beetl/fn/DateFormat.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.utils.beetl.fn; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import org.beetl.core.Format; 7 | 8 | public class DateFormat implements Format 9 | { 10 | 11 | public Object format(Object data, String pattern) 12 | { 13 | if (data == null) 14 | return null; 15 | if (Date.class.isAssignableFrom(data.getClass())) 16 | { 17 | SimpleDateFormat sdf = null; 18 | if (pattern == null) 19 | { 20 | sdf = new SimpleDateFormat(); 21 | } 22 | else 23 | { 24 | sdf = new SimpleDateFormat(pattern); 25 | } 26 | return sdf.format((Date) data); 27 | 28 | } 29 | else if (data.getClass() == Long.class) 30 | { 31 | // System.out.println(data); 32 | SimpleDateFormat sdf = null; 33 | long date = Long.valueOf(data.toString()); 34 | if (pattern == null) 35 | { 36 | sdf = new SimpleDateFormat(); 37 | } 38 | else 39 | { 40 | sdf = new SimpleDateFormat(pattern); 41 | } 42 | if(data.toString().length() != 13) 43 | date = date*1000; 44 | // System.out.println(date); 45 | return sdf.format(new Date(date)); 46 | 47 | } 48 | else if (data.getClass() == Integer.class) 49 | { 50 | if (data.toString().length()!=10) 51 | return null; 52 | long date = Long.valueOf(data.toString()); 53 | SimpleDateFormat sdf = null; 54 | if (pattern == null) 55 | { 56 | sdf = new SimpleDateFormat(); 57 | } 58 | else 59 | { 60 | sdf = new SimpleDateFormat(pattern); 61 | } 62 | return sdf.format(new Date(date*1000)); 63 | } 64 | else 65 | { 66 | throw new RuntimeException("Arg Error:Type should be Date:" + data.getClass()); 67 | } 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/com/cnvp/paladin/utils/beetl/fn/FileSize.java: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.utils.beetl.fn; 2 | 3 | import org.beetl.core.Context; 4 | import org.beetl.core.Function; 5 | 6 | /** 7 | * FileSize(123123123) 8 | * FileSize(123123123,"B") 9 | * FileSize(123123123,"KB") 10 | * FileSize(123123123,"MB") 11 | * FileSize(123123123,"GB") 12 | */ 13 | public class FileSize implements Function{ 14 | 15 | public Object call(Object[] paras, Context ctx){ 16 | if (paras.length>2) { 17 | throw new RuntimeException("最多只能传递2个参数"); 18 | } 19 | Object o = paras[0]; 20 | Long size = Long.parseLong(o.toString()); 21 | if (paras.length==2) { 22 | String unitInput = paras[0].toString().toUpperCase(); 23 | if ("KB".equals(unitInput)) { 24 | size = size*1024; 25 | }else if("MB".equals(unitInput)){ 26 | size = size*1024*1024; 27 | }else if("GB".equals(unitInput)){ 28 | size = size*1024*1024*1024; 29 | } 30 | } 31 | long kb = 1024; 32 | long mb = kb * 1024; 33 | long gb = mb * 1024; 34 | if (size >= gb) { 35 | return String.format("%.1f GB", (float) size / gb); 36 | } else if (size >= mb) { 37 | float f = (float) size / mb; 38 | return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f); 39 | } else if (size >= kb) { 40 | float f = (float) size / kb; 41 | return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f); 42 | } else 43 | return String.format("%d B", size); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /wwwroot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /wwwroot/Static/images/face.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/face.jpg -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/back.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/blank.gif -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/cancel.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/clearup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/clearup.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/coins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/coins.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/config.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/cut.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/data_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/data_config.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/edit_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/edit_add.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/edit_remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/edit_remove.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/export.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/filesave.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/filter.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/group_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/group_key.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/help.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/import.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/key.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/large_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/large_chart.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/large_clipart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/large_clipart.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/large_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/large_picture.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/large_shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/large_shapes.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/large_smartart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/large_smartart.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/logout.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/member1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/member1.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/member2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/member2.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/member3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/member3.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/mini_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/mini_add.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/mini_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/mini_edit.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/mini_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/mini_refresh.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/no.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/ok.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/pencil.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/print.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/redo.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/reload.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/search.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/sum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/sum.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/tip.png -------------------------------------------------------------------------------- /wwwroot/Static/images/icons/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/icons/undo.png -------------------------------------------------------------------------------- /wwwroot/Static/images/index.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/index.jpg -------------------------------------------------------------------------------- /wwwroot/Static/images/login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/login.jpg -------------------------------------------------------------------------------- /wwwroot/Static/images/logo.bak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/logo.bak.png -------------------------------------------------------------------------------- /wwwroot/Static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/logo.png -------------------------------------------------------------------------------- /wwwroot/Static/images/passcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/images/passcode.jpg -------------------------------------------------------------------------------- /wwwroot/Static/js/admin.js: -------------------------------------------------------------------------------- 1 | //页面加载完毕后执行 2 | $(function(){ 3 | //一级菜单激活 4 | $(".admin-nav>li>a").click(function(event) { 5 | $(this).parent().addClass('active'); 6 | $(this).parent().siblings().removeClass('active'); 7 | childrenBox = $('.admin-nav-ii',$(this).parent()); 8 | children = $('a',childrenBox[0]); 9 | if (children[0]) children[0].click(); 10 | }); 11 | //二级菜单激活 12 | $(".admin-nav-ii li").click(function(){ 13 | $(this).addClass('active'); 14 | $(this).siblings().removeClass('active'); 15 | Link1 = $("a:first",$(this).parent().parent()); 16 | Link2 = $("a",this); 17 | $(".admin-bread .bread").empty(); 18 | $('').append(Link1.clone()).appendTo(".admin-bread .bread"); 19 | $('').append(Link2.clone()).appendTo(".admin-bread .bread"); 20 | }); 21 | $(".admin_left_btn").click(function(){ 22 | $('body').toggleClass("fullscreen"); 23 | $(this).toggleClass("admin_left_btn_open"); 24 | $(this).toggleClass("icon-caret-right"); 25 | }); 26 | $('.dialogs-delegate').delegate('.dialogx','click', function() { 27 | var el=$(this); 28 | var trigger=el.attr("data-toggle"); 29 | $showdialogx(el); 30 | }); 31 | removedialogx = function(container){ 32 | $(".dialogx-win",container).remove(); 33 | $(".dialogx-mask",container).remove(); 34 | } 35 | $showdialogx=function(el){ 36 | var trigger=el.attr("data-toggle"); 37 | var getid=el.attr("data-target"); 38 | var url=el.attr("data-url"); 39 | var mask=el.attr("data-mask"); 40 | var width=el.attr("data-width"); 41 | var height=el.attr("data-height"); 42 | var title=el.attr("data-title"); 43 | if(width==null||typeof width == 'undefined'){width="80%";} 44 | if(width==null||typeof height == 'undefined'){height="500px";} 45 | if(title==null||typeof title == 'undefined'){title="对话框标题";} 46 | if(url==null||typeof url == 'undefined'){alert('该方法仅支持ifram调用');return;} 47 | var masklayout=$(''); 48 | if (mask=="1"){ 49 | $("body").append(masklayout); 50 | } 51 | 52 | var detail=''; 53 | detail+=''; 54 | detail+=''; 55 | detail+=''; 56 | detail+=''; 57 | detail+=''; 58 | detail+=''+title+''; 59 | detail+=''; 60 | detail+=''; 61 | detail+=''; 62 | detail+=''; 63 | detail+=''; 64 | detail+=''; 65 | detail+=''; 66 | var $win=$(detail); 67 | $win.find(".dialog").addClass("open"); 68 | $("body").append($win); 69 | 70 | var x=parseInt($(window).width()-$win.outerWidth())/2; 71 | var y=parseInt($(window).height()-$win.outerHeight())/2; 72 | if(y<0) y=0; 73 | $win.css("left",x); 74 | $win.css("top",y); 75 | $win.find(".dialog-close,.close").bind('click',function(){ 76 | $win.remove(); 77 | $('.dialogx-mask').remove(); 78 | }) 79 | // win.find(".dialog-close,.close").each(function(){ 80 | // 81 | // console.info('==========win=========='); 82 | // console.info(win); 83 | // $(this,win).click(function(){ 84 | // console.info('==========win=========='); 85 | // console.info(win); 86 | // win.remove(); 87 | // $('.dialog-mask').remove(); 88 | // }); 89 | // }); 90 | masklayout.click(function(){ 91 | $win.remove(); 92 | $(this).remove(); 93 | }); 94 | 95 | }; 96 | 97 | }); 98 | -------------------------------------------------------------------------------- /wwwroot/Static/js/jstree/themes/default-dark/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/js/jstree/themes/default-dark/32px.png -------------------------------------------------------------------------------- /wwwroot/Static/js/jstree/themes/default-dark/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/js/jstree/themes/default-dark/40px.png -------------------------------------------------------------------------------- /wwwroot/Static/js/jstree/themes/default-dark/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/js/jstree/themes/default-dark/throbber.gif -------------------------------------------------------------------------------- /wwwroot/Static/js/jstree/themes/default/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/js/jstree/themes/default/32px.png -------------------------------------------------------------------------------- /wwwroot/Static/js/jstree/themes/default/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/js/jstree/themes/default/40px.png -------------------------------------------------------------------------------- /wwwroot/Static/js/jstree/themes/default/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/Static/js/jstree/themes/default/throbber.gif -------------------------------------------------------------------------------- /wwwroot/Static/js/respond.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill 2 | * Copyright 2014 Scott Jehl 3 | * Licensed under MIT 4 | * http://j.mp/respondjs */ 5 | 6 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;b")},showNode:function(c,a){a.isHidden=!1;f.initShowForExCheck(c,a);j(a,c).show()},showNodes:function(c,a,b){if(a&&a.length!=0){var e={},g,k;for(g=0,k=a.length;g0&&!a[b][0].isHidden? 16 | a[b][0].isFirstNode=!0:e>0&&d.setFirstNodeForHide(c,a[b])},setLastNode:function(c,a){var b=c.data.key.children,e=a[b].length;e>0&&!a[b][0].isHidden?a[b][e-1].isLastNode=!0:e>0&&d.setLastNodeForHide(c,a[b])},setFirstNodeForHide:function(c,a){var b,e,g;for(e=0,g=a.length;e=0;e--){b=a[e];if(b.isLastNode)break;if(!b.isHidden&&!b.isLastNode){b.isLastNode=!0;d.setNodeLineIcos(c,b);break}else b=null}return b},setLastNodeForShow:function(c,a){var b,e,g,f;for(e=a.length-1;e>=0;e--)if(b=a[e],!g&&!b.isHidden&& 18 | b.isLastNode){g=b;break}else if(!g&&!b.isHidden&&!b.isLastNode)b.isLastNode=!0,g=b,d.setNodeLineIcos(c,b);else if(g&&b.isLastNode){b.isLastNode=!1;f=b;d.setNodeLineIcos(c,b);break}return{"new":g,old:f}}},data:{initHideForExCheck:function(c,a){if(a.isHidden&&c.check&&c.check.enable){if(typeof a._nocheck=="undefined")a._nocheck=!!a.nocheck,a.nocheck=!0;a.check_Child_State=-1;d.repairParentChkClassWithSelf&&d.repairParentChkClassWithSelf(c,a)}},initShowForExCheck:function(c,a){if(!a.isHidden&&c.check&& 19 | c.check.enable){if(typeof a._nocheck!="undefined")a.nocheck=a._nocheck,delete a._nocheck;if(d.setChkClass){var b=j(a,l.id.CHECK,c);d.setChkClass(c,b,a)}d.repairParentChkClassWithSelf&&d.repairParentChkClassWithSelf(c,a)}}}});var i=i.fn.zTree,m=i._z.tools,l=i.consts,d=i._z.view,f=i._z.data,j=m.$;f.addInitNode(function(c,a,b){if(typeof b.isHidden=="string")b.isHidden=m.eqs(b.isHidden,"true");b.isHidden=!!b.isHidden;f.initHideForExCheck(c,b)});f.addBeforeA(function(){});f.addZTreeTools(function(c,a){a.showNodes= 20 | function(a,b){d.showNodes(c,a,b)};a.showNode=function(a,b){a&&d.showNodes(c,[a],b)};a.hideNodes=function(a,b){d.hideNodes(c,a,b)};a.hideNode=function(a,b){a&&d.hideNodes(c,[a],b)};var b=a.checkNode;if(b)a.checkNode=function(c,d,f,h){(!c||!c.isHidden)&&b.apply(a,arguments)}});var n=f.initNode;f.initNode=function(c,a,b,e,g,i,h){var j=(e?e:f.getRoot(c))[c.data.key.children];f.tmpHideFirstNode=d.setFirstNodeForHide(c,j);f.tmpHideLastNode=d.setLastNodeForHide(c,j);h&&(d.setNodeLineIcos(c,f.tmpHideFirstNode), 21 | d.setNodeLineIcos(c,f.tmpHideLastNode));g=f.tmpHideFirstNode===b;i=f.tmpHideLastNode===b;n&&n.apply(f,arguments);h&&i&&d.clearOldLastNode(c,b,h)};var o=f.makeChkFlag;if(o)f.makeChkFlag=function(c,a){(!a||!a.isHidden)&&o.apply(f,arguments)};var p=f.getTreeCheckedNodes;if(p)f.getTreeCheckedNodes=function(c,a,b,e){if(a&&a.length>0){var d=a[0].getParentNode();if(d&&d.isHidden)return[]}return p.apply(f,arguments)};var q=f.getTreeChangeCheckedNodes;if(q)f.getTreeChangeCheckedNodes=function(c,a,b){if(a&& 22 | a.length>0){var d=a[0].getParentNode();if(d&&d.isHidden)return[]}return q.apply(f,arguments)};var r=d.expandCollapseSonNode;if(r)d.expandCollapseSonNode=function(c,a,b,e,f){(!a||!a.isHidden)&&r.apply(d,arguments)};var s=d.setSonNodeCheckBox;if(s)d.setSonNodeCheckBox=function(c,a,b,e){(!a||!a.isHidden)&&s.apply(d,arguments)};var t=d.repairParentChkClassWithSelf;if(t)d.repairParentChkClassWithSelf=function(c,a){(!a||!a.isHidden)&&t.apply(d,arguments)}})(jQuery); 23 | -------------------------------------------------------------------------------- /wwwroot/Template/Dept/form.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | if(@data.isNew()){ ?>添加 }else{ ?>编辑} ?> 6 | 返回 7 | 8 | 信息 9 | 10 | 11 | 12 | 13 | 14 | 15 | 名称 16 | 17 | 18 | 19 | 20 | 21 | 22 | 描述 23 | 24 | 25 | 26 | 27 | 28 | 29 | 父级Id 30 | 31 | 32 | 33 | 34 | 35 | 提交 36 | 37 | 38 | 39 | 40 | 41 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Dept/index.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 部门列表 添加一级部门 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | includeFileTemplate("/common/paginate.html",{uri : '', page : page}){}?> 16 | 17 | 18 | 19 | 20 | 30 | 61 | } ?> 62 | -------------------------------------------------------------------------------- /wwwroot/Template/Generator/controller_code.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | ${table.Name}==>${modelName} 6 | 返回 7 | 8 | 控制器 9 | 10 | 11 | 12 | 13 | 14 | include("controller_code_normal.html"){} ?> 15 | 16 | 17 | 18 | 19 | 20 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Generator/controller_code_normal.html: -------------------------------------------------------------------------------- 1 | var modelNameLowerCase= strutil.toLowerCase(modelName); ?> 2 | package com.cnvp.paladin.controller; 3 | 4 | import com.cnvp.paladin.core.BaseController; 5 | import com.cnvp.paladin.model.${modelName}; 6 | 7 | public class ${modelName}Controller extends BaseController { 8 | public void index(){ 9 | setAttr("page", ${modelName}.dao.paginate(getParaToInt(0, 1), 10)); 10 | } 11 | public void create(){ 12 | if(isPost()){ 13 | if(getModel(${modelName}.class,"${modelNameLowerCase}").save()) 14 | redirect(getControllerKey()); 15 | return; 16 | } 17 | setAttr("data", new ${modelName}()); 18 | } 19 | 20 | public void update(){ 21 | if(isPost()){ 22 | if(getModel(${modelName}.class,"${modelNameLowerCase}").set("id",getParaToInt()).update()) 23 | redirect(getControllerKey()); 24 | return; 25 | } 26 | setAttr("data", ${modelName}.dao.findById(getParaToInt())); 27 | } 28 | public void delete(){ 29 | if (${modelName}.dao.findById(getParaToInt()).delete()) 30 | redirect(getControllerKey()); 31 | else 32 | alertAndGoback("删除失败"); 33 | } 34 | public void deleteAll(){ 35 | Integer[] ids=getParaValuesToInt("id"); 36 | for (Integer id : ids) { 37 | ${modelName}.dao.findById(id).delete(); 38 | } 39 | redirect(getControllerKey()); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /wwwroot/Template/Generator/model_code.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | ${table.Name}==>${modelName} 6 | 返回 7 | 8 | 模型 9 | 10 | 11 | 12 | 13 | 14 | include("model_code_normal.html"){} ?> 15 | 16 | 17 | 18 | 19 | 20 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Generator/model_code_normal.html: -------------------------------------------------------------------------------- 1 | package com.cnvp.paladin.model; 2 | 3 | import com.cnvp.paladin.core.BaseModel; 4 | 5 | @SuppressWarnings("serial") 6 | public class ${modelName} extends BaseModel<${modelName}> { 7 | public static final ${modelName} dao = new ${modelName}(); 8 | } 9 | -------------------------------------------------------------------------------- /wwwroot/Template/Generator/tables.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 表名 8 | 9 | 模型名 10 | 数据类型 11 | 字符集 12 | 记录数 13 | 大小 14 | 操作 15 | 16 | for(table in tables){ ?> 17 | var fields = @table.getColumns(); ?> 18 | 19 | ${fields.name} 20 | => 21 | ${fields.modelname!} 22 | ${fields.engine} 23 | ${fields.collation} 24 | ${fields.rows} 25 | ${fileSize(fields.data_length)} 26 | 预览代码 27 | 28 | } ?> 29 | 30 | 31 | 32 | 33 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Generator/view_code.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | ${table.Name}==>${modelName} 6 | 返回 7 | 8 | 表单 9 | 列表 10 | 11 | 12 | 13 | 14 | 15 | include("view_code_form.html"){} ?> 16 | 17 | 18 | 19 | 20 | include("view_code_index.html"){} ?> 21 | 22 | 23 | 24 | 25 | 26 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Generator/view_code_form.html: -------------------------------------------------------------------------------- 1 | <? layout("../layout/default.html") { ?> 2 | <div class="admin-panel"> 3 | <div class="tab"> 4 | <div class="tab-head"> 5 | <strong><? if(@data.isNew()){ ?>添加<? }else{ ?>编辑<?} ?>${table.comment}</strong> 6 | <span class="tab-more"><a href="javascript:history.go(-1)" class="button button-little bg-blue icon-step-backward"> 返回</a></span> 7 | <ul class="tab-nav"> 8 | <li class="active"><a href="#tab-set">${table.comment}信息</a></li> 9 | </ul> 10 | </div> 11 | <div class="tab-body"> 12 | <div class="tab-panel active" id="tab-set"> 13 | <form method="post" class="form-x" action=""> 14 | for(col in cols){ ?> 15 | var model= strutil.toLowerCase(modelName); ?> 16 | <div class="form-group"> 17 | <div class="label"><label for="sitename">${col.comment}</label></div> 18 | <div class="field"> 19 | switch(col.type){ ?> 20 | case "varchar": ?> 21 | <input type="text" class="input" id="${model}_${col.field}" name="${model}.${col.field}" size="${col.length}" placeholder="请填写${col.comment}" data-validate="${col.validate}" value="\${data.${col.field}!"${col.Default}"}"/> 22 | break; ?> 23 | case "text": ?> 24 | <textarea class="input" rows="5" id="${model}_${col.field}" name="${model}.${col.field}" placeholder="请填写${col.comment}" data-validate="${col.validate}" ></textarea> 25 | break; ?> 26 | case "tinyint": ?> 27 | <div class="button-group button-group-small radio"> 28 | <label class="button" id="${model}_${col.field}_true"><input name="${model}.${col.field}" value="1" type="radio"><span class="icon icon-check"></span> 是</label> 29 | <label class="button" id="${model}_${col.field}_false"><input name="${model}.${col.field}" value="0" type="radio"><span class="icon icon-times"></span> 否</label> 30 | </div> 31 | <script> 32 | $("#${model}_${col.field}_\${data.${col.field}!true}").addClass('active').children('input').attr('checked',true); 33 | </script> 34 | break; ?> 35 | case "enum": ?> 36 | var opts = strutil.replace(col.Length,"'","");?> 37 | opts = strutil.split(opts,",");?> 38 | <div class="button-group button-group-small radio"> 39 | for(opt in opts){?> 40 | <label class="button ${model}_${col.field}" data="${opt}" ><input name="${model}.${col.field}" value="${opt}" type="radio"><span class="icon icon-check"></span> ${opt}</label> 41 | }?> 42 | </div> 43 | <script> 44 | $(".${model}_${col.field}[data='\${data.${col.field}!true}']").addClass('active').children('input').attr('checked',true); 45 | </script> 46 | break; ?> 47 | default: ?> 48 | <input type="text" class="input" id="${model}_${col.field}" name="${model}.${col.field}" size="${col.length}" placeholder="${col.comment}" data-validate="${col.validate}" value="\${data.${col.field}!"${col.Default}"}"/> 49 | } ?> 50 | </div> 51 | </div> 52 | 53 | } ?> 54 | <div class="form-button"><button class="button bg-main" type="submit">提交</button></div> 55 | </form> 56 | </div> 57 | </div> 58 | </div> 59 | </div> 60 | <? } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Generator/view_code_index.html: -------------------------------------------------------------------------------- 1 | woshi index -------------------------------------------------------------------------------- /wwwroot/Template/Passport/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 登录 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Paladin-JFinal通用后台基础框架 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 立即登录 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /wwwroot/Template/Resource/form.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 49 | 50 | 51 | 52 | if(@data.isNew()){ ?>添加 }else{ ?>编辑} ?> 53 | 54 | 55 | 信息 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 名称 66 | 67 | 68 | 69 | 70 | 71 | 72 | 权限识别码 73 | 74 | 75 | ${data.parent_code!"根节点"}: 76 | 77 | 78 | 79 | 80 | 81 | 82 | 描述 83 | 84 | 85 | 86 | 87 | 88 | 类型 89 | 90 | 91 | 无 92 | ActionKey 93 | 94 | 97 | 98 | 99 | 100 | actionKey 101 | 102 | 103 | 请选择actionKey 104 | for(ak in aks){?> 105 | ${ak} 106 | }?> 107 | 108 | 111 | 112 | 113 | 114 | 115 | 排序 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 提交 124 | 125 | 126 | 127 | 128 | 129 | } ?> 130 | -------------------------------------------------------------------------------- /wwwroot/Template/Resource/index.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 资源管理 添加分组 10 | 更新权限路径缓存 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 78 | } ?> 79 | 80 | -------------------------------------------------------------------------------- /wwwroot/Template/Resource/indexbak.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 资源管理 添加分组 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 70 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/Role/form.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | if(@data.isNew()){ ?>添加 }else{ ?>编辑} ?> 8 | 返回 9 | 10 | 信息 11 | 配置资源权限 12 | 13 | 14 | 15 | 16 | 17 | 18 | 角色名称 19 | 20 | 21 | 22 | 23 | 24 | 25 | 父级Id 26 | 27 | 28 | 29 | 30 | 31 | 提交 32 | 33 | 34 | 35 | 清空 36 | 全选 37 | 38 | 39 | 40 | 41 | 42 | } ?> 43 | 44 | -------------------------------------------------------------------------------- /wwwroot/Template/Role/index.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 角色列表 添加角色 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | includeFileTemplate("/common/paginate.html",{uri : '', page : page}){}?> 16 | 17 | 18 | 19 | 20 | 30 | 62 | } ?> 63 | -------------------------------------------------------------------------------- /wwwroot/Template/common/close.html: -------------------------------------------------------------------------------- 1 | ${app_remark!} -------------------------------------------------------------------------------- /wwwroot/Template/common/paginate.html: -------------------------------------------------------------------------------- 1 | 2 | var pageNumber = page.pageNumber; // 当前页 3 | var totalPage = page.totalPage; // 总页数 4 | var num_display_entries = 10; // 每次显示多少页 5 | var num_edge_entries = 2; // 前后各多少页 6 | var ellipse_text = "..."; 7 | var uri = action+"/"; 8 | if (page.totalRow > page.pageSize) { 9 | ?> 10 | 11 | 12 | // 上一页 13 | if(pageNumber != 1) { 14 | printf("上一页",uri,pageNumber-1); 15 | } else { 16 | printf("上一页"); 17 | } 18 | // 总页数大于 (显示的页数+前后显示) 表示需要显示很多页 19 | var pageCount = totalPage - (num_display_entries + num_edge_entries * 2); 20 | if (pageCount > 0) { 21 | var i = 1; 22 | var len = 0; 23 | var _start = trunc(num_display_entries / 2); 24 | var _end = _start; 25 | if (num_display_entries%2 == 0) { 26 | _start = _start - 1; 27 | } 28 | // 页码-前 29 | if (pageNumber - _start - num_edge_entries >= num_edge_entries) { 30 | while(i < num_edge_entries + 1) { 31 | printf("%s ",uri,i,i); 32 | i = i + 1; 33 | } 34 | printf("%s ",ellipse_text); 35 | 36 | i = pageNumber-_start; 37 | len = pageNumber + _end+1; 38 | } else { 39 | len = num_display_entries+1; 40 | } 41 | 42 | var show_num_edge_entries_next = totalPage - pageNumber - _end - num_edge_entries > 0; 43 | if (!show_num_edge_entries_next) { 44 | i = pageNumber - _start; 45 | if (totalPage - pageNumber - _end < 0) { 46 | i = totalPage - num_display_entries+1; 47 | } 48 | len = totalPage + 1; 49 | } 50 | 51 | // 显示中间的那串页码 52 | while(i < len) { 53 | if (pageNumber == i) { 54 | printf("%s",i); 55 | } else { 56 | printf("%s",uri,i,i); 57 | } 58 | i = i + 1; 59 | } 60 | 61 | // 页码-后 62 | if (show_num_edge_entries_next) { 63 | printf("%s ",ellipse_text); 64 | i = totalPage + 1 - num_edge_entries; 65 | while(i < totalPage + 1) { 66 | printf("%s ",uri,i,i); 67 | i = i + 1; 68 | } 69 | } 70 | } else { 71 | // 显示全部页码 72 | var i = 1; 73 | while(i < totalPage + 1) { 74 | if (pageNumber == i) { 75 | printf("%s",i); 76 | } else { 77 | printf("%s",uri,i,i); 78 | } 79 | i = i + 1; 80 | } 81 | } 82 | 83 | // 下一页 84 | if(pageNumber != totalPage) { 85 | printf("下一页",uri,pageNumber+1); 86 | } else { 87 | printf("下一页"); 88 | } 89 | } 90 | ?> 91 | -------------------------------------------------------------------------------- /wwwroot/Template/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${app_name!} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 前台首页 25 | 注销登录 26 | 27 | 28 | 29 | 30 | if(shiro.hasPermission(@nav.getRes().get("code_route"))){?> 31 | 32 | 33 | ${nav.title} 34 | if(nav.hasChild==true){ ?> 35 | 36 | 37 | if(@sub.getRes().get("code_route")!=null)if(shiro.hasPermission(@sub.getRes().get("code_route"))){?> 38 | " class="${sub.icon}"> ${sub.title} 39 | } ?> 40 | } ?> 41 | 42 | } ?> 43 | 44 | }?> 45 | } ?> 46 | 47 | 48 | 49 | 您好:${shiro.getUser("cname")},欢迎使用! 50 | 51 | 开始 52 | 后台首页 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /wwwroot/Template/layout/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${app_name!} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ${layoutContent} 18 | 19 | -------------------------------------------------------------------------------- /wwwroot/Template/layout/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Full Layout - jQuery EasyUI Demo 13 | 14 | 15 | ${layoutContent} 16 | 17 | -------------------------------------------------------------------------------- /wwwroot/Template/password.html: -------------------------------------------------------------------------------- 1 | layout("layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 修改密码 8 | 9 | 10 | 11 | 12 | 13 | 14 | 原始密码 15 | 16 | 17 | 18 | 19 | 20 | 新密码 21 | 22 | 23 | 24 | 25 | 26 | 再次确认 27 | 28 | 29 | 30 | 31 | 提交 32 | 33 | 34 | 35 | 36 | 37 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/profile.html: -------------------------------------------------------------------------------- 1 | layout("layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 个人资料 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 中文名 16 | 17 | 18 | 19 | 20 | 21 | 英文名 22 | 23 | 24 | 25 | 26 | 27 | 性别 28 | 29 | 30 | 男 31 | 女 32 | 33 | 36 | 37 | 38 | 39 | 手机 40 | 41 | 42 | 43 | 44 | 提交 45 | 46 | 47 | 48 | 49 | 50 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/system/index.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 系统设置 6 | 7 | 全局设置 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 网站名称 18 | 19 | 20 | 21 | 22 | 23 | 网站运行状态 24 | 25 | 26 | 27 | 开启 28 | 29 | 30 | 关闭 31 | 32 | 33 | 36 | 37 | 38 | 39 | 调试模式 40 | 41 | 42 | 43 | 开启 44 | 45 | 46 | 关闭 47 | 48 | 49 | 52 | 需要重启才能生效 53 | 54 | 55 | 56 | 维护说明 57 | 58 | ${app_remark!} 59 | 60 | 61 | 62 | 63 | 64 | 提交 65 | 66 | 67 | 18 | 顺序 19 | 名称 20 | 资源 21 | 链接 22 | 操作 23 | 24 | for(nav in test){ ?> 25 | 26 | 27 | 28 | if(nav.hasChild==true){ ?> 29 | 30 | } ?> 31 | 32 | 33 | 34 | 35 | 36 | ${nav.title} 37 | 【 code_route=@nav.getRes().get("code_route"); 38 | isEmpty(code_route)?print("尚未配置"):print(code_route); 39 | ?>】 40 | 41 | 42 | 43 | url = nav.url; 44 | ak = @nav.getRes().get("ak"); 45 | isEmpty(url)==false?print(url):print(ak); 46 | ?> 47 | 48 | 49 | 50 | 51 | 52 | 53 | if(nav.hasChild==true) ?> 54 | for(sub in nav.children){ ?> 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | ${sub.title} 63 | 【 code_route=@sub.getRes().get("code_route"); 64 | isEmpty(code_route)?print("尚未配置"):print(code_route); 65 | ?>】 66 | 67 | 68 | url = sub.url; 69 | ak = @sub.getRes().get("ak"); 70 | isEmpty(url)==false?print(url):print(ak); 71 | ?> 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | } ?> 80 | 81 | } ?> 82 | 83 | 84 | 85 | 86 | 87 | 101 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/user/index.html: -------------------------------------------------------------------------------- 1 | layout("../layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 用户列表 添加 7 | 8 | 9 | 批量删除 10 | 11 | 12 | 13 | 14 | 15 | ID 16 | 17 | 账号 18 | 中文名 19 | 英文名 20 | 所在部门 21 | 备注 22 | 最后登陆 23 | 登陆次数 24 | 操作 25 | 26 | for(data in @page.getList()){?> 27 | 28 | ${data.id} 29 | 30 | ${data.account} 31 | ${data.cname} 32 | ${data.ename} 33 | ${@data.getDeptName()} 34 | ${data.remark} 35 | ${data.last_login_time,dateFormat="yyyy-MM-dd"} 36 | ${data.login_count} 37 | 38 | 39 | 40 | 41 | 42 | } ?> 43 | 44 | 45 | 46 | includeFileTemplate("/common/paginate.html",{uri : '', page : page}){}?> 47 | 48 | 49 | 50 | } ?> -------------------------------------------------------------------------------- /wwwroot/Template/welcome.html: -------------------------------------------------------------------------------- 1 | layout("layout/default.html") { ?> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | admin 11 | 12 | 您好,admin,这是您第100次登录,上次登录为2014-10-1。 13 | 14 | 15 | 16 | 站点统计 17 | 18 | 88 会员 19 | 828 文件 20 | 828 订单 21 | 828 内容 22 | 828 数据库 23 | 24 | 25 | 26 | 27 | 28 | 注意:您有5条未读信息,点击查看。 29 | 30 | 拼图前端框架介绍 31 | 拼图是优秀的响应式前端CSS框架,国内前端框架先驱及领导者,自动适应手机、平板、电脑等设备,让前端开发像游戏般快乐、简单、灵活、便捷。 32 | 下载示例代码 33 | 下载拼图框架 34 | 拼图使用教程 35 | 36 | 37 | 系统信息 38 | 39 | 服务器信息系统信息 40 | 操作系统:Windows 2008系统开发:拼图前端框架 41 | Web服务器:Apache主页:http://www.pintuer.com 42 | 程序语言:PHP演示:http://demo.pintuer.com 43 | 数据库:MySQL群交流:201916085 (点击加入) 44 | 45 | 46 | 47 | 48 | 49 | 50 | } ?> -------------------------------------------------------------------------------- /wwwroot/WEB-INF/.gitignore: -------------------------------------------------------------------------------- 1 | /classes/ 2 | -------------------------------------------------------------------------------- /wwwroot/WEB-INF/config.properties: -------------------------------------------------------------------------------- 1 | #Update 'app_remark' value 2 | #Sat Feb 14 13:26:36 CST 2015 3 | app_devModel=true 4 | app_name=cnvp-java-dev 5 | app_remark=1 6 | app_status=open 7 | -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/activation-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/activation-1.1.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/beetl-core-2.1.3-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/beetl-core-2.1.3-sources.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/beetl-core-2.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/beetl-core-2.1.3.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/commons-beanutils-1.9.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/commons-beanutils-1.9.2.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/commons-collections-3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/commons-collections-3.2.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/commons-logging-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/commons-logging-1.2.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/druid-1.0.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/druid-1.0.9.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/ehcache-2.9.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/ehcache-2.9.0.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/jetty-server-8.1.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/jetty-server-8.1.8.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/jfinal-1.9-bin-with-src.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/jfinal-1.9-bin-with-src.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/log4j-1.2.17.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/log4j-1.2.17.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/mysql-connector-java-5.1.26-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/mysql-connector-java-5.1.26-bin.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/shiro-all-1.2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/shiro-all-1.2.3.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/slf4j-api-1.6.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/slf4j-api-1.6.6.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/lib/slf4j-log4j12-1.7.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang890910bo/back_manager/7b00d8329d4019aa9baf62c83d8fa3cf4f47e383/wwwroot/WEB-INF/lib/slf4j-log4j12-1.7.10.jar -------------------------------------------------------------------------------- /wwwroot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Paladin 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | 13 | 14 | 18 | 19 | org.apache.shiro.web.env.EnvironmentLoaderListener 20 | 21 | 22 | shiroConfigLocations 23 | classpath:shiro.ini 24 | 25 | 29 | 30 | ShiroFilter 31 | org.apache.shiro.web.servlet.ShiroFilter 32 | 33 | 34 | ShiroFilter 35 | /* 36 | 37 | 38 | 39 | jfinal 40 | com.jfinal.core.JFinalFilter 41 | 42 | configClass 43 | com.cnvp.paladin.core.appConfig 44 | 45 | 46 | 47 | jfinal 48 | /* 49 | 50 | --------------------------------------------------------------------------------
14 | include("controller_code_normal.html"){} ?> 15 |
14 | include("model_code_normal.html"){} ?> 15 |
15 | include("view_code_form.html"){} ?> 16 |
20 | include("view_code_index.html"){} ?> 21 |
拼图是优秀的响应式前端CSS框架,国内前端框架先驱及领导者,自动适应手机、平板、电脑等设备,让前端开发像游戏般快乐、简单、灵活、便捷。