├── src ├── main │ ├── resources │ │ ├── public │ │ │ ├── favicon.ico │ │ │ └── error │ │ │ │ ├── 403.html │ │ │ │ ├── error.html │ │ │ │ ├── 404.html │ │ │ │ ├── 405.html │ │ │ │ ├── 500.html │ │ │ │ └── 401.html │ │ ├── static │ │ │ ├── img │ │ │ │ ├── a1.jpg │ │ │ │ ├── a2.jpg │ │ │ │ ├── a3.jpg │ │ │ │ ├── a4.jpg │ │ │ │ ├── a5.jpg │ │ │ │ ├── a6.jpg │ │ │ │ ├── a7.jpg │ │ │ │ ├── a8.jpg │ │ │ │ ├── lou.jpg │ │ │ │ ├── p1.jpg │ │ │ │ ├── p3.jpg │ │ │ │ ├── p_big1.jpg │ │ │ │ ├── p_big2.jpg │ │ │ │ ├── profile.jpg │ │ │ │ └── profile_small.jpg │ │ │ ├── images │ │ │ │ ├── 404.jpg │ │ │ │ ├── logo_icon.png │ │ │ │ └── photos │ │ │ │ │ ├── user1.png │ │ │ │ │ ├── user2.png │ │ │ │ │ ├── user3.png │ │ │ │ │ ├── user4.png │ │ │ │ │ ├── user5.png │ │ │ │ │ └── user-avatar.png │ │ │ ├── css │ │ │ │ ├── patterns │ │ │ │ │ └── header-profile.png │ │ │ │ └── plugins │ │ │ │ │ ├── fileinput │ │ │ │ │ └── loading.gif │ │ │ │ │ ├── chosen │ │ │ │ │ └── chosen-sprite@2x.png │ │ │ │ │ ├── footable │ │ │ │ │ └── fonts │ │ │ │ │ │ ├── footable.ttf │ │ │ │ │ │ └── footable.woff │ │ │ │ │ ├── iCheck │ │ │ │ │ ├── minimal-green@2x.png │ │ │ │ │ └── green.css │ │ │ │ │ ├── tagsinput │ │ │ │ │ └── jquery.tagsinput.css │ │ │ │ │ ├── multiselect │ │ │ │ │ └── tree-multiselect.min.css │ │ │ │ │ └── gritter │ │ │ │ │ └── jquery.gritter.css │ │ │ ├── js │ │ │ │ ├── My97DatePicker │ │ │ │ │ ├── skin │ │ │ │ │ │ ├── datePicker.gif │ │ │ │ │ │ ├── default │ │ │ │ │ │ │ └── img.gif │ │ │ │ │ │ ├── whyGreen │ │ │ │ │ │ │ ├── bg.jpg │ │ │ │ │ │ │ └── img.gif │ │ │ │ │ │ └── WdatePicker.css │ │ │ │ │ └── lang │ │ │ │ │ │ ├── en.js │ │ │ │ │ │ ├── zh-cn.js │ │ │ │ │ │ └── zh-tw.js │ │ │ │ └── plugins │ │ │ │ │ ├── datetimepicker │ │ │ │ │ └── locales │ │ │ │ │ │ ├── bootstrap-datetimepicker.zh-CN.js │ │ │ │ │ │ └── bootstrap-datetimepicker.zh-TW.js │ │ │ │ │ ├── opentable │ │ │ │ │ └── opentable.js │ │ │ │ │ ├── loading │ │ │ │ │ └── jquery.loading.js │ │ │ │ │ ├── fileinput │ │ │ │ │ └── fileinput_locale_zh.js │ │ │ │ │ ├── metisMenu │ │ │ │ │ └── jquery.metisMenu.js │ │ │ │ │ ├── validate │ │ │ │ │ └── validate-cn.js │ │ │ │ │ ├── toastr │ │ │ │ │ └── toastr.min.js │ │ │ │ │ └── slimscroll │ │ │ │ │ └── jquery.slimscroll.min.js │ │ │ ├── fonts │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── font-awesome │ │ │ │ └── fonts │ │ │ │ └── fontawesome-webfont.woff2 │ │ ├── db │ │ │ └── sqlite │ │ │ │ ├── db1.sqlite3 │ │ │ │ └── db2.sqlite3 │ │ ├── conf │ │ │ ├── ehcache-shiro.xml │ │ │ └── xss_security_config.xml │ │ ├── banner.txt │ │ ├── templates │ │ │ ├── common │ │ │ │ ├── error.ftl │ │ │ │ └── page.ftl │ │ │ ├── view │ │ │ │ ├── news │ │ │ │ │ ├── list_page1.ftl │ │ │ │ │ ├── list_page2.ftl │ │ │ │ │ ├── edit_form.ftl │ │ │ │ │ └── list_page.ftl │ │ │ │ └── login │ │ │ │ │ └── login.ftl │ │ │ └── topnav.ftl │ │ ├── META-INF │ │ │ └── spring-configuration-metadata.json │ │ ├── mapper │ │ │ ├── auth │ │ │ │ ├── UserRoleMapper.xml │ │ │ │ ├── RolePermissionMapper.xml │ │ │ │ └── RoleMapper.xml │ │ │ └── simple │ │ │ │ └── NewsMapper.xml │ │ ├── log4j2.xml │ │ └── application.yml │ └── java │ │ └── cn │ │ └── springboot │ │ ├── framework │ │ ├── locks │ │ │ ├── package-info.java │ │ │ ├── exception │ │ │ │ ├── package-info.java │ │ │ │ ├── LockException.java │ │ │ │ ├── UnLockException.java │ │ │ │ └── BuildLockException.java │ │ │ ├── zookeeper │ │ │ │ ├── package-info.java │ │ │ │ └── ZookeeperMutexLock.java │ │ │ ├── ReadWriteLock.java │ │ │ ├── MutexLock.java │ │ │ ├── DistributedLockFactory.java │ │ │ ├── SharedLock.java │ │ │ └── DistributedLock.java │ │ ├── pk │ │ │ ├── TableEnum.java │ │ │ ├── FactoryAboutKey.java │ │ │ └── local │ │ │ │ ├── LocalIdGenerator.java │ │ │ │ └── impl │ │ │ │ └── LocalIdGeneratorImpl.java │ │ ├── constant │ │ │ ├── Constant.java │ │ │ ├── Constants.java │ │ │ └── CacheableKey.java │ │ ├── datasource │ │ │ ├── DataSourceTagger.java │ │ │ └── PageInfo.java │ │ └── exception │ │ │ └── BusinessException.java │ │ ├── model │ │ ├── BaseEntity.java │ │ ├── auth │ │ │ ├── UserRole.java │ │ │ ├── RolePermission.java │ │ │ ├── Role.java │ │ │ ├── Permission.java │ │ │ └── User.java │ │ └── simple │ │ │ └── News.java │ │ ├── mapper │ │ ├── auth │ │ │ ├── UserRoleMapper.java │ │ │ ├── RolePermissionMapper.java │ │ │ ├── RoleMapper.java │ │ │ ├── PermissionMapper.java │ │ │ └── UserMapper.java │ │ └── simple │ │ │ └── NewsMapper.java │ │ ├── service │ │ ├── auth │ │ │ ├── PermissionService.java │ │ │ ├── AuthService.java │ │ │ ├── RoleService.java │ │ │ ├── impl │ │ │ │ ├── AuthServiceImpl.java │ │ │ │ └── RoleServiceImpl.java │ │ │ └── UserService.java │ │ ├── simple │ │ │ ├── NewsService.java │ │ │ └── impl │ │ │ │ └── NewsServiceImpl.java │ │ └── LdapService.java │ │ ├── web │ │ ├── shiro │ │ │ ├── vo │ │ │ │ ├── PermissionVo.java │ │ │ │ ├── Principal.java │ │ │ │ └── RoleEnumUtil.java │ │ │ └── MShiroFilterFactoryBean.java │ │ └── controller │ │ │ ├── ViewController.java │ │ │ ├── MainController.java │ │ │ └── LoginController.java │ │ ├── config │ │ ├── FreemarkerConfig.java │ │ ├── authority │ │ │ ├── service │ │ │ │ └── xss │ │ │ │ │ ├── XSSSecurityConfig.java │ │ │ │ │ └── XSSSecurityConstants.java │ │ │ └── filter │ │ │ │ ├── SQLInjectionFilterServlet.java │ │ │ │ └── XSSSecurityFilter.java │ │ ├── LdapConfig.java │ │ ├── ServletContextConfig.java │ │ ├── DistributedLockConfig.java │ │ ├── MybatisConfig.java │ │ └── ThreadPoolConfig.java │ │ ├── util │ │ ├── salt │ │ │ ├── Encodes.java │ │ │ ├── Exceptions.java │ │ │ └── Digests.java │ │ └── UUIDUtil.java │ │ └── Application.java └── test │ ├── resources │ └── template │ │ ├── mapper.java.ftl │ │ └── entity.java.ftl │ └── java │ ├── cn │ └── springboot │ │ ├── service │ │ └── LdapServiceTest.java │ │ ├── ApplicationTests.java │ │ └── InitServiceTest.java │ └── org │ └── mybatis │ └── generator │ └── SqlServerTypeConvertCustom.java ├── version.bat ├── .gitignore ├── .gitattributes ├── version.sh └── README.md /src/main/resources/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/public/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/static/img/a1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a1.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a2.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a3.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a4.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a5.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a6.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a7.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/a8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/a8.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/lou.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/lou.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/p1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/p1.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/p3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/p3.jpg -------------------------------------------------------------------------------- /src/main/resources/db/sqlite/db1.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/db/sqlite/db1.sqlite3 -------------------------------------------------------------------------------- /src/main/resources/db/sqlite/db2.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/db/sqlite/db2.sqlite3 -------------------------------------------------------------------------------- /src/main/resources/static/images/404.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/404.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/p_big1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/p_big1.jpg -------------------------------------------------------------------------------- /src/main/resources/static/img/p_big2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/p_big2.jpg -------------------------------------------------------------------------------- /version.bat: -------------------------------------------------------------------------------- 1 | @title springboot-freemarker 2 | @color 0a 3 | 4 | call mvn versions:set -DgenerateBackupPoms=false -DnewVersion=2022.0.1 5 | pause 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /.externalToolBuilders 3 | /*.log 4 | /.classpath 5 | /.project 6 | /.settings 7 | /*.db 8 | /bin 9 | /logs 10 | /*.iml -------------------------------------------------------------------------------- /src/main/resources/static/img/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/profile.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/logo_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/logo_icon.png -------------------------------------------------------------------------------- /src/main/resources/static/img/profile_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/img/profile_small.jpg -------------------------------------------------------------------------------- /src/main/resources/static/images/photos/user1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/photos/user1.png -------------------------------------------------------------------------------- /src/main/resources/static/images/photos/user2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/photos/user2.png -------------------------------------------------------------------------------- /src/main/resources/static/images/photos/user3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/photos/user3.png -------------------------------------------------------------------------------- /src/main/resources/static/images/photos/user4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/photos/user4.png -------------------------------------------------------------------------------- /src/main/resources/static/images/photos/user5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/photos/user5.png -------------------------------------------------------------------------------- /src/main/java/cn/springboot/framework/locks/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | *
提供了分布式锁的接口定义类
3 | * 4 | * @author jqxi 5 | */ 6 | package cn.springboot.framework.locks; 7 | -------------------------------------------------------------------------------- /src/main/resources/static/images/photos/user-avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/images/photos/user-avatar.png -------------------------------------------------------------------------------- /src/main/resources/static/css/patterns/header-profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/css/patterns/header-profile.png -------------------------------------------------------------------------------- /src/main/resources/static/css/plugins/fileinput/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/css/plugins/fileinput/loading.gif -------------------------------------------------------------------------------- /src/main/java/cn/springboot/framework/locks/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | *提供了分布式锁接口所抛出的异常类
3 | * 4 | * @author jqxi 5 | */ 6 | package cn.springboot.framework.locks.exception; 7 | -------------------------------------------------------------------------------- /src/main/resources/static/css/plugins/chosen/chosen-sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/css/plugins/chosen/chosen-sprite@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/css/plugins/footable/fonts/footable.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/css/plugins/footable/fonts/footable.ttf -------------------------------------------------------------------------------- /src/main/resources/static/css/plugins/iCheck/minimal-green@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/css/plugins/iCheck/minimal-green@2x.png -------------------------------------------------------------------------------- /src/main/resources/static/js/My97DatePicker/skin/datePicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/js/My97DatePicker/skin/datePicker.gif -------------------------------------------------------------------------------- /src/main/resources/static/js/My97DatePicker/skin/default/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/js/My97DatePicker/skin/default/img.gif -------------------------------------------------------------------------------- /src/main/resources/static/js/My97DatePicker/skin/whyGreen/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/js/My97DatePicker/skin/whyGreen/bg.jpg -------------------------------------------------------------------------------- /src/main/resources/static/js/My97DatePicker/skin/whyGreen/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/js/My97DatePicker/skin/whyGreen/img.gif -------------------------------------------------------------------------------- /src/main/resources/static/css/plugins/footable/fonts/footable.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/css/plugins/footable/fonts/footable.woff -------------------------------------------------------------------------------- /src/main/resources/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tobeflyboy/springboot-freemarker/HEAD/src/main/resources/static/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=Java 2 | *.css linguist-language=Java 3 | *.html linguist-language=Java 4 | *.ftl linguist-language=Java 5 | *.FreeMarker linguist-language=Java 6 | *.freemarker linguist-language=Java -------------------------------------------------------------------------------- /version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat springboot-freemarker/src/main/resources/banner.txt 3 | # 默认版本号 4 | DEFAULT_VERSION=2022.0.1 5 | # 接输入参数做为新版本号 6 | VERSION=${1:-$DEFAULT_VERSION} 7 | # 更新版本号 8 | mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$VERSION 9 | -------------------------------------------------------------------------------- /src/main/java/cn/springboot/framework/locks/zookeeper/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | *提供了基于 ZooKeeper 的分布式锁实现, 3 | * 通过其客户端 curator 的 API 进行二次封装实现 4 | *
5 | * 6 | * @author 胡桃夹子 7 | */ 8 | package cn.springboot.framework.locks.zookeeper; 9 | -------------------------------------------------------------------------------- /src/main/resources/static/js/My97DatePicker/skin/WdatePicker.css: -------------------------------------------------------------------------------- 1 | .Wdate{ 2 | border:#999 1px solid; 3 | /*height:20px;*/ 4 | background:#fff url(datePicker.gif) no-repeat right; 5 | } 6 | .Wdate::-ms-clear{display:none;} 7 | 8 | .WdateFmtErr{ 9 | font-weight:bold; 10 | color:red; 11 | } -------------------------------------------------------------------------------- /src/main/java/cn/springboot/framework/pk/TableEnum.java: -------------------------------------------------------------------------------- 1 | package cn.springboot.framework.pk; 2 | 3 | /** 4 | * @author 胡桃夹子 5 | * @Description 数据表名 6 | * @date Apr 12, 2017 2:12:02 PM 7 | */ 8 | public enum TableEnum { 9 | 10 | /*表名请大写*/ 11 | T_SYS_PERMISSION, 12 | T_SYS_ROLE, 13 | T_SYS_ROLE_PERMISSION, 14 | T_SYS_USER, 15 | T_SYS_USER_ROLE, 16 | T_NEWS, 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/cn/springboot/model/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package cn.springboot.model; 2 | 3 | import java.io.Serializable; 4 | 5 | 6 | /** 7 | * @param获取锁运行时异常
5 | * 6 | * @author 胡桃夹子 7 | */ 8 | public class LockException extends RuntimeException { 9 | 10 | private static final long serialVersionUID = -1881390443685916800L; 11 | 12 | public LockException(String message) { 13 | super(message); 14 | } 15 | 16 | public LockException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/cn/springboot/framework/locks/exception/UnLockException.java: -------------------------------------------------------------------------------- 1 | package cn.springboot.framework.locks.exception; 2 | 3 | /** 4 | *解锁运行时异常
5 | * 6 | * @author 胡桃夹子 7 | */ 8 | public class UnLockException extends RuntimeException { 9 | 10 | private static final long serialVersionUID = -2298723230022810352L; 11 | 12 | public UnLockException(String message) { 13 | super(message); 14 | } 15 | 16 | public UnLockException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/cn/springboot/mapper/auth/RolePermissionMapper.java: -------------------------------------------------------------------------------- 1 | package cn.springboot.mapper.auth; 2 | 3 | import cn.springboot.model.auth.RolePermission; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 角色与菜单关系Mapper 9 | * 10 | * @author 胡桃夹子 11 | * @date 2022/3/15 14:14 12 | */ 13 | @Mapper 14 | public interface RolePermissionMapper extends BaseMapper创建锁运行时异常
5 | * 6 | * @author 胡桃夹子 7 | */ 8 | public class BuildLockException extends RuntimeException { 9 | 10 | private static final long serialVersionUID = 3875257035681233457L; 11 | 12 | public BuildLockException(String message) { 13 | super(message); 14 | } 15 | 16 | public BuildLockException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/template/mapper.java.ftl: -------------------------------------------------------------------------------- 1 | package ${package.Mapper}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superMapperClassPackage}; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | *9 | * ${table.comment!} Mapper 接口 10 | *
11 | * 12 | * @author ${author} 13 | * @since ${date} 14 | */ 15 | <#if kotlin> 16 | interface ${table.mapperName} : ${superMapperClass}<${entity}> 17 | <#else> 18 | @Repository 19 | public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { 20 | 21 | } 22 | #if> 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # springboot-freemarker 介绍 # 2 | 3 |它是一个典型的MVC三层框架,快速简单的上手。4 | 5 | #### springboot-freemarker 6 | 7 | + 包含框架有:SpringBoot、SpringMVC、MyBaits、Bootstrap3、Freemarker; 8 | + 集成示例有:增删改查及分页;防XSS、SQL注入; 9 | 10 | 11 | #### 数据库配置 12 | + 默认是连接的MySQL数据库,支持多数据源,分别连接的db1,db2 ,在项目工程的db文件夹下有数据库初始化脚本; 13 | 14 | #### 示例启动 15 | 16 | + 启动工程; 17 | + 运行cn.springboot.Application当中的main方法; 18 | + 浏览器访问http://localhost:8090, 测试账号是admin/123456,即可看示例效果; 19 | 20 | [GitHub](https://github.com/wangxinforme) [issues](https://github.com/wangxinforme/springboot-freemarker/issues) 21 | -------------------------------------------------------------------------------- /src/main/java/cn/springboot/service/auth/PermissionService.java: -------------------------------------------------------------------------------- 1 | package cn.springboot.service.auth; 2 | 3 | import cn.springboot.model.auth.Permission; 4 | import cn.springboot.web.shiro.vo.PermissionVo; 5 | 6 | import java.util.List; 7 | 8 | public interface PermissionService { 9 | 10 | /** 11 | * 查询用户所能访问的所有菜单 12 | * 13 | * @param userId 用户ID 14 | * @return permissions 菜单 15 | */ 16 | List
7 | * ReadWriteLock 维护了一对相关的锁,一个用于只读操作,另一个用于写入操作。 8 | * 只要没有 writer,读取锁可以由多个 reader 线程同时保持,写入锁是独占的。 9 | * 与互斥锁相比,读写锁允许对共享数据进行更高级别的并发访问。 10 | * 一次只有一个线程(writer 线程)可以修改共享数据,任何数量的线程可以同时读取共享数据(reader 线程)。 11 | * 若读锁已经存在,则写锁不能被获取,必须等待读锁释放。 12 | * 若写锁已经存在,则不同线程的读锁不能被获取,但是相同线程内的读锁可以被获取。 13 | *
14 | * 15 | * @author 胡桃夹子 16 | */ 17 | public interface ReadWriteLock { 18 | 19 | /** 20 | *16 | ${err!'请求出错'},再试一次或者,或使用浏览器的返回按钮,导航到您之前访问的网页。 17 |
18 |19 | 或者您可以点击下面这个小按钮: 20 |
21 | 返回首页 22 |7 | * 继承自分布式锁接口{@link cn.springboot.framework.locks.DistributedLock DistributedLock}, 8 | * 同一时间只有一个线程能够获取锁,其他线程必须等待它释放锁后,才能获取。 9 | *
10 | * 11 | * @author 胡桃夹子 12 | */ 13 | public interface MutexLock extends DistributedLock { 14 | 15 | /** 16 | *19 | * 每调用一次 lock()或tryLock()方法,当前线程保持此锁的次数增加 1。 20 | * 每调用一次unlock()方法,当前线程保持此锁的次数减 1。 21 | *
22 | * 23 | * @return 当前线程保持此锁的次数,如果此锁未被当前线程保持过,则返回 0 24 | */ 25 | int getHoldCount(); 26 | 27 | /** 28 | *31 | * 等同于 调用{@link cn.springboot.framework.locks.MutexLock#getHoldCount() getHoldCount()}方法, 32 | * 返回值大于 0 则当前线程保持此锁。 33 | *
34 | * 35 | * @return 如果当前线程保持此锁,则返回 true;否则返回 false 36 | */ 37 | boolean isHeldByCurrentThread(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/cn/springboot/service/auth/RoleService.java: -------------------------------------------------------------------------------- 1 | package cn.springboot.service.auth; 2 | 3 | import cn.springboot.model.auth.Role; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色相关接口 9 | * 10 | * @author 胡桃夹子 11 | * @date 2022/3/15 14:17 12 | */ 13 | public interface RoleService { 14 | 15 | /** 16 | * 添加一个角色 ,若已经存在同名角色,则不创建 17 | * 18 | * @param role 角色对象 19 | */ 20 | void addRole(Role role); 21 | 22 | /** 23 | * 根据编码查询角色 24 | * 25 | * @param code 角色编码 26 | * @return 27 | */ 28 | Role findRoleByCode(String code); 29 | 30 | /** 31 | * 根据用户查询对应所有角色 32 | * 33 | * @param userId 用户Id 34 | * @return roles 所有角色 35 | */ 36 | List7 | * 为了方便分布式锁的使用,所有分布式锁的实例对象全部由分布式锁工厂负责提供。 8 | * 不能单独构造实例化分布式锁对象。 9 | *
10 | * 11 | *12 | * 异常处理 :构造分布式锁实例时,任何错误都会导致抛出运行时异常 {@link cn.springboot.framework.locks.exception.BuildLockException BuildLockException} 13 | *
14 | * 15 | * @author 胡桃夹子 16 | */ 17 | public interface DistributedLockFactory { 18 | 19 | /** 20 | *21 | 服务器拒绝请求 22 | ,再试一次或者,或使用浏览器的 23 | 返回 24 | 按钮,导航到您之前访问的网页。 25 |
26 |27 | 或者您可以点击下面这个小按钮: 28 |
29 | 30 | 31 | 返回首页 32 | 33 |21 | 请求出错 22 | ,再试一次或者,或使用浏览器的 23 | 返回 24 | 按钮,导航到您之前访问的网页。 25 |
26 |27 | 或者您可以点击下面这个小按钮: 28 |
29 | 30 | 31 | 返回首页 32 | 33 |21 | 服务器找不到请求的网页 22 | ,再试一次或者,或使用浏览器的 23 | 返回 24 | 按钮,导航到您之前访问的网页。 25 |
26 |27 | 或者您可以点击下面这个小按钮: 28 |
29 | 30 | 31 | 返回首页 32 | 33 |21 | 禁用请求中指定的方法 22 | ,再试一次或者,或使用浏览器的 23 | 返回 24 | 按钮,导航到您之前访问的网页。 25 |
26 |27 | 或者您可以点击下面这个小按钮: 28 |
29 | 30 | 31 | 返回首页 32 | 33 |21 | 服务器遇到错误,无法完成请求 22 | ,再试一次或者,或使用浏览器的 23 | 返回 24 | 按钮,导航到您之前访问的网页。 25 |
26 |27 | 或者您可以点击下面这个小按钮: 28 |
29 | 30 | 31 | 返回首页 32 | 33 |21 | 请求被拒绝 22 | ,再试一次或者,或使用浏览器的 23 | 返回 24 | 按钮,导航到您之前访问的网页。 25 |
26 |27 | 或者您可以点击下面这个小按钮: 28 |
29 | 30 | 31 | 返回首页 32 | 33 || 标题 | 7 |内容 | 8 |地址 | 9 |发生时间 | 10 |创建时间 | 11 |
|---|---|---|---|---|
| ${n.title } | 18 |${n.description } | 19 |${n.address } | 20 |${n.newsTime?string("yyyy-MM-dd HH:mm") } | 21 |${n.createTime?string("yyyy-MM-dd HH:mm") } | 22 |
| 标题 | 7 |内容 | 8 |地址 | 9 |发生时间 | 10 |创建时间 | 11 |
|---|---|---|---|---|
| ${n.title } | 18 |${n.description } | 19 |${n.address } | 20 |${n.newsTime?string("yyyy-MM-dd HH:mm") } | 21 |${n.createTime?string("yyyy-MM-dd HH:mm") } | 22 |
9 | * 指定共享锁池的大小,可以被不同线程共享的锁,获取锁的线程都可以访问共享资源。 10 | * 同一线程可以一次性获取多个锁,这些锁不能分开获取,锁池必须能够一次性提供。 11 | *
12 | * 13 | * @author 胡桃夹子 14 | */ 15 | public interface SharedLock extends DistributedLock { 16 | 17 | /** 18 | *22 | * 能一次性获取指定数量的锁才算成功获取 23 | * 若无法获取锁,则当前线程阻塞,直到成功获取锁为止 24 | */ 25 | void lock(int qty); 26 | 27 | /** 28 | *
33 | * 能一次性获取指定数量的锁才算成功获取,也就是锁池空闲锁的数量必须能够满足。 34 | */ 35 | boolean tryLock(int qty); 36 | 37 | /** 38 | *
46 | * 能一次性获取指定数量的锁才算成功获取,也就是锁池空闲锁的数量必须能够满足。 47 | */ 48 | boolean tryLock(int qty, long time, TimeUnit unit); 49 | 50 | /** 51 | *
55 | * 必须和lock()、tryLock()成对使用,释放锁后共享锁池大小将会增加。 56 | */ 57 | void unlock(int qty); 58 | 59 | /** 60 | *
| 标题 | 7 |内容 | 8 |地址 | 9 |发生时间 | 10 |创建时间 | 11 |操作 | 12 |
|---|---|---|---|---|---|
| ${n.title } | 19 |${n.description } | 20 |${n.address } | 21 |${n.newsTime?string("yyyy-MM-dd HH:mm") } | 22 |${n.createTime?string("yyyy-MM-dd HH:mm") } | 23 |
24 |
25 |
29 |
30 | |
31 |
9 | * 分布式锁是控制不同JVM下的多个线程对共享资源进行访问的工具。 10 | * 通常,锁提供了对共享资源的独占访问。 11 | * 一次只能有一个线程获得锁,对共享资源的所有访问都需要首先获得锁。 12 | * 不过,某些锁可能允许对共享资源并发访问,如 {@link cn.springboot.framework.locks.ReadWriteLock ReadWriteLock} 的读取锁,共享锁 {@link cn.springboot.framework.locks.SharedLock SharedLock} 。 13 | *
14 | * 15 | * @author 胡桃夹子 16 | */ 17 | public interface DistributedLock { 18 | 19 | /** 20 | *22 | * 若无法获取锁,则当前线程阻塞,直到成功获取锁为止。 23 | * 代码示例: 24 | *
25 | * lock.lock();
26 | * try {
27 | * //操作共享资源的代码
28 | * }
29 | * finally {
30 | * lock.unlock();
31 | * }
32 | *
33 | *
34 | * 35 | * 异常处理 :任何错误都会导致抛出运行时异常 {@link cn.springboot.framework.locks.exception.LockException LockException} 36 | *
37 | */ 38 | void lock(); 39 | 40 | /** 41 | *43 | * 若存在可用的锁,则获取并立即返回 true,否则立即返回 false,线程不会阻塞。 44 | * 代码示例: 45 | *
46 | * if(lock.tryLock()) {
47 | * try {
48 | * //操作共享资源的代码
49 | * }
50 | * finally {
51 | * lock.unlock();
52 | * }
53 | * } else {
54 | * //无法获取锁时的处理代码
55 | * }
56 | *
57 | *
58 | * 59 | * 异常处理 :任何错误都会导致抛出运行时异常 {@link cn.springboot.framework.locks.exception.LockException LockException} 60 | *
61 | * 62 | * @return 成功获取锁返回 true,否则返回 false 63 | */ 64 | boolean tryLock(); 65 | 66 | /** 67 | *69 | * 若存在可用的锁,则获取并立即返回 true,否则会在限定时间内不停尝试获取,直到成功获取返回 true 或者失败返回 false。 70 | * 代码示例: 71 | *
72 | * if(lock.tryLock(1, TimeUnit.SECONDS)) {
73 | * try {
74 | * //操作共享资源的代码
75 | * }
76 | * finally {
77 | * lock.unlock();
78 | * }
79 | * }else{
80 | * //无法获取锁时的处理代码
81 | * }
82 | *
83 | *
84 | * 85 | * 异常处理 :任何错误都会导致抛出运行时异常 {@link cn.springboot.framework.locks.exception.LockException LockException} 86 | *
87 | * 88 | * @param time 时间数值,长整形数字,必须大于等于 1 89 | * @param unit 时间单位 90 | * @return 成功获取锁返回 true,否则返回 false 91 | * @see TimeUnit 92 | */ 93 | boolean tryLock(long time, TimeUnit unit); 94 | 95 | /** 96 | *98 | * 必须和lock(),tryLock()成对使用,由持有锁的对象释放锁。 99 | * 100 | *
101 | * 异常处理 :任何错误都会导致抛出运行时异常 {@link cn.springboot.framework.locks.exception.UnLockException UnLockException} 102 | *
103 | */ 104 | void unlock(); 105 | } 106 | -------------------------------------------------------------------------------- /src/main/resources/templates/common/page.ftl: -------------------------------------------------------------------------------- 1 |{errors}',
57 | dropZoneTitle: '拖拽文件到这里 …',
58 | slugCallback: function(text) {
59 | return text ? text.split(/(\\|\/)/g).pop().replace(/[^\w\u4e00-\u9fa5\-.\\\/ ]+/g, '') : '';
60 | },
61 | fileActionSettings: {
62 | removeTitle: '删除文件',
63 | uploadTitle: '上传文件',
64 | indicatorNewTitle: '没有上传',
65 | indicatorSuccessTitle: '上传',
66 | indicatorErrorTitle: '上传错误',
67 | indicatorLoadingTitle: '上传 ...'
68 | }
69 | };
70 | })(window.jQuery);
--------------------------------------------------------------------------------
/src/main/java/cn/springboot/model/auth/Permission.java:
--------------------------------------------------------------------------------
1 | package cn.springboot.model.auth;
2 |
3 | import cn.springboot.model.BaseEntity;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.annotation.TableName;
7 |
8 | /**
9 | * 菜单对象
10 | *
11 | * @author 胡桃夹子
12 | * @date 2022/3/15 14:13
13 | */
14 | @TableName("t_sys_permission")
15 | public class Permission implements BaseEntity基于 ZooKeeper 实现了分布式互斥锁接口{@link MutexLock MutexLock}
19 | * 20 | * @author 胡桃夹子 21 | */ 22 | public class ZookeeperMutexLock implements MutexLock { 23 | 24 | private static final Logger LOG = LoggerFactory.getLogger(ZookeeperMutexLock.class); 25 | 26 | private final InterProcessLock lock; 27 | 28 | private int holdCount = 0; 29 | 30 | protected ZookeeperMutexLock(CuratorFramework client, String name) { 31 | if (client == null || name == null) { 32 | throw new BuildLockException("init ZookeeperMutexLock error!"); 33 | } 34 | if (!name.startsWith("/")) { 35 | name = "/" + name; 36 | } 37 | lock = new InterProcessMutex(client, name); 38 | } 39 | 40 | @Override 41 | public void lock() { 42 | try { 43 | lock.acquire(); 44 | holdCount++; 45 | } catch (Exception e) { 46 | LOG.error(e.getMessage(), e); 47 | throw new LockException(e.getMessage(), e); 48 | } 49 | } 50 | 51 | @Override 52 | public boolean tryLock() { 53 | try { 54 | boolean result = lock.acquire(1, TimeUnit.MICROSECONDS); 55 | if (result) { 56 | holdCount++; 57 | } 58 | return result; 59 | } catch (Exception e) { 60 | LOG.error(e.getMessage(), e); 61 | throw new LockException(e.getMessage(), e); 62 | } 63 | } 64 | 65 | @Override 66 | public boolean tryLock(long time, TimeUnit unit) { 67 | try { 68 | if (time <= 0 || unit == null) { 69 | throw new LockException("lock time error!"); 70 | } 71 | boolean result = lock.acquire(time, unit); 72 | if (result) { 73 | holdCount++; 74 | } 75 | LOG.debug("{}", result); 76 | return result; 77 | /* 78 | time=unit.toMillis(time); 79 | log.debug("time:{}",time); 80 | long beginTime=System.currentTimeMillis(); 81 | boolean result=false; 82 | do{ 83 | result=lock.acquire(1, TimeUnit.MICROSECONDS); 84 | log.debug("diff:{}",System.currentTimeMillis()-beginTime); 85 | }while(System.currentTimeMillis()-beginTime < time); 86 | return result; 87 | */ 88 | } catch (Exception e) { 89 | LOG.error(e.getMessage(), e); 90 | throw new LockException(e.getMessage(), e); 91 | } 92 | } 93 | 94 | @Override 95 | public void unlock() { 96 | try { 97 | lock.release(); 98 | holdCount--; 99 | } catch (Exception e) { 100 | LOG.error(e.getMessage(), e); 101 | throw new UnLockException(e.getMessage(), e); 102 | } 103 | } 104 | 105 | @Override 106 | public int getHoldCount() { 107 | return holdCount; 108 | } 109 | 110 | @Override 111 | public boolean isHeldByCurrentThread() { 112 | return holdCount > 0; 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/test/java/cn/springboot/InitServiceTest.java: -------------------------------------------------------------------------------- 1 | package cn.springboot; 2 | 3 | import cn.springboot.model.auth.Permission; 4 | import cn.springboot.model.auth.Role; 5 | import cn.springboot.model.auth.User; 6 | import cn.springboot.service.auth.PermissionService; 7 | import cn.springboot.service.auth.RoleService; 8 | import cn.springboot.service.auth.UserService; 9 | import cn.springboot.web.shiro.vo.PermissionEnumUtil; 10 | import cn.springboot.web.shiro.vo.RoleEnumUtil; 11 | import org.junit.jupiter.api.Test; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | 15 | import java.util.List; 16 | 17 | @SpringBootTest 18 | public class InitServiceTest { 19 | 20 | @Autowired 21 | private UserService userService; 22 | 23 | @Autowired 24 | private RoleService roleService; 25 | 26 | @Autowired 27 | private PermissionService permissionService; 28 | 29 | /** 30 | * 创建角色 31 | */ 32 | private void addRoles() { 33 | try { 34 | roleService.addRole(RoleEnumUtil.ADMIN_ROLE.getRole()); 35 | roleService.addRole(RoleEnumUtil.COMMON_ROLE.getRole()); 36 | } catch (Exception e) { 37 | e.printStackTrace(); 38 | } 39 | } 40 | 41 | /** 42 | * 创建菜单 43 | */ 44 | private void addPermission() { 45 | try { 46 | List20 | * ${table.comment!} 21 | *
22 | * 23 | * @author ${author} 24 | * @since ${date} 25 | */ 26 | <#if entityLombokModel> 27 | @Data 28 | <#if superEntityClass??> 29 | @EqualsAndHashCode(callSuper = true) 30 | <#else> 31 | @EqualsAndHashCode(callSuper = false) 32 | #if> 33 | <#if chainModel> 34 | @Accessors(chain = true) 35 | #if> 36 | #if> 37 | <#if table.convert> 38 | @TableName(value = "${table.name}", schema = "${schemaName?replace(".","")}") 39 | #if> 40 | <#if swagger> 41 | @ApiModel(value = "${entity}对象", description = "${table.comment!}") 42 | #if> 43 | <#if superEntityClass??> 44 | public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}>#if> { 45 | <#elseif activeRecord> 46 | public class ${entity} extends Model<${entity}> { 47 | <#else> 48 | public class ${entity} implements Serializable { 49 | #if> 50 | 51 | <#if entitySerialVersionUID> 52 | private static final long serialVersionUID = 1L; 53 | #if> 54 | <#-- ---------- BEGIN 字段循环遍历 ----------> 55 | <#list table.fields as field> 56 | <#if field.keyFlag> 57 | <#assign keyPropertyName="${field.propertyName}"/> 58 | #if> 59 | 60 | <#if field.comment!?length gt 0> 61 | <#if swagger> 62 | @ApiModelProperty(value = "${field.comment}") 63 | <#else> 64 | /** 65 | * ${field.comment} 66 | */ 67 | #if> 68 | #if> 69 | <#if field.keyFlag> 70 | <#-- 主键 --> 71 | <#if field.keyIdentityFlag> 72 | @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO) 73 | <#elseif idType??> 74 | @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) 75 | <#else> 76 | @TableId("${field.annotationColumnName}") 77 | #if> 78 | <#-- 普通字段 --> 79 | <#elseif field.fill??> 80 | <#-- ----- 存在字段填充设置 -----> 81 | @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) 82 | <#else> 83 | @TableField("${field.annotationColumnName}") 84 | #if> 85 | <#-- 乐观锁注解 --> 86 | <#if field.versionField> 87 | @Version 88 | #if> 89 | <#-- 逻辑删除注解 --> 90 | <#if field.logicDeleteField> 91 | @TableLogic 92 | #if> 93 | private ${field.propertyType} ${field.propertyName}; 94 | #list> 95 | <#------------ END 字段循环遍历 ----------> 96 | 97 | <#if !entityLombokModel> 98 | <#list table.fields as field> 99 | <#if field.propertyType == "boolean"> 100 | <#assign getprefix="is"/> 101 | <#else> 102 | <#assign getprefix="get"/> 103 | #if> 104 | public ${field.propertyType} ${getprefix}${field.capitalName}() { 105 | return ${field.propertyName}; 106 | } 107 | 108 | <#if chainModel> 109 | public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { 110 | <#else> 111 | public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { 112 | #if> 113 | this.${field.propertyName} = ${field.propertyName}; 114 | <#if chainModel> 115 | return this; 116 | #if> 117 | } 118 | #list> 119 | #if> 120 | 121 | <#if entityColumnConstant> 122 | <#list table.fields as field> 123 | public static final String ${field.name?upper_case} = "${field.name}"; 124 | 125 | #list> 126 | #if> 127 | <#if activeRecord> 128 | @Override 129 | protected Serializable pkVal() { 130 | <#if keyPropertyName??> 131 | return this.${keyPropertyName}; 132 | <#else> 133 | return null; 134 | #if> 135 | } 136 | 137 | #if> 138 | <#if !entityLombokModel> 139 | @Override 140 | public String toString() { 141 | return "${entity}{" + 142 | <#list table.fields as field> 143 | <#if field_index==0> 144 | "${field.propertyName}=" + ${field.propertyName} + 145 | <#else> 146 | ", ${field.propertyName}=" + ${field.propertyName} + 147 | #if> 148 | #list> 149 | "}"; 150 | } 151 | #if> 152 | } 153 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | management: 2 | endpoints: 3 | web: 4 | base-path: /rest/actuator 5 | exposure: 6 | include: '*' 7 | server: 8 | shutdown: graceful # 优雅停服务,在容器关闭时,web服务器将不再接收新请求,并将等待活动请求完成的缓冲期。从springboot2.3.0引入的新特性 9 | servlet: 10 | context-path: / 11 | port: 8090 12 | 13 | spring: 14 | servlet: 15 | multipart: 16 | max-request-size: 200MB 17 | max-file-size: 200MB 18 | main: 19 | allow-bean-definition-overriding: true # 解决bean重复定义。设置为true,后定义bean覆盖之前定义相同名称的bean。springboot2.0.4开始支持,默认为rue;springboot2.1.0开始默认false 20 | # allow-circular-references: true # 开启循环依赖,从springboot2.6.0开始,默认禁止循环依赖 21 | application: 22 | name: springboot-freemarker # 应用名 23 | freemarker: 24 | # 模板后缀名 25 | suffix: .ftl 26 | # 文档类型 27 | content-type: text/html 28 | # 页面编码 29 | charset: UTF-8 30 | # 页面缓存:true=开启;false=关闭; 31 | cache: false 32 | # 设定模板的加载路径,多个以逗号分隔,默认: 33 | template-loader-path: classpath:/templates/ 34 | # 设置是否允许HttpServletRequest属性覆盖(隐藏)控制器生成的同名模型属性。 35 | allow-request-override: false 36 | # 设置是否允许HttpSession属性覆盖(隐藏)控制器生成的同名模型属性。 37 | allow-session-override: false 38 | # 检查模板位置是否存在。 39 | check-template-location: true 40 | # 为这种技术启用MVC视图解决方案。 41 | enabled: true 42 | # 设置是否应该在与模板合并之前将所有请求属性添加到模型中。 43 | expose-request-attributes: false 44 | # 设置是否在与模板合并之前将所有HttpSession属性添加到模型中。 45 | expose-session-attributes: false 46 | # 设置是否公开RequestContext供Spring宏库使用,名称为“SpringMacroRequestContext”。 47 | expose-spring-macro-helpers: true 48 | order: 1 49 | # 更喜欢文件系统访问模板加载。文件系统访问允许对模板更改进行热检测。 50 | prefer-file-system-access: true 51 | # 所有视图的RequestContext属性的名称。 52 | request-context-attribute: request 53 | settings: 54 | # 解决前台使用${}赋值值为空的情况 55 | classic_compatible: true 56 | # 57 | default_encoding: UTF-8 58 | # 检查模板更新延迟时间,设置为0表示立即检查,如果时间大于0会有缓存不方便进行模板测试 59 | template_update_delay: 0 60 | mvc: 61 | static-path-pattern: /static/** 62 | datasource: 63 | type: com.zaxxer.hikari.HikariDataSource # 声明为hikari数据源连接池 64 | driver-class-name: com.mysql.jdbc.Driver # MYSQL驱动类 65 | # driver-class-name: org.sqlite.JDBC # sqlite驱动类 66 | dynamic: # 多数据源 67 | hikari: 68 | min-idle: 10 # 最小空闲连接 69 | max-pool-size: 30 # 最大连接数 70 | idle-timeout: 600000 # 连接最小空闲时间(单位:毫秒),10分钟 71 | max-lifetime: 1800000 # 连接最大存活时间(单位:毫秒),30分钟 72 | connection-timeout: 30000 # 连接池获取连接的最长等待时间(单位:毫秒),30秒 73 | connection-test-query: SELECT 1 # 验证查询 74 | primary: db1 # 设置默认数据源 75 | strict: false # 严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 76 | datasource: 77 | db1: 78 | username: root 79 | password: root 80 | url: 'jdbc:mysql://localhost:3306/db1?useUnicode=true&characterEncoding=UTF-8&useSSL=false' 81 | # username: 82 | # password: 83 | # sqlite3 建议使用绝对路径,这里使用的是相对路径 84 | # url: 'jdbc:sqlite::resource:db/sqlite/db1.sqlite3' 85 | db2: 86 | username: root 87 | password: root 88 | url: 'jdbc:mysql://localhost:3306/db2?useUnicode=true&characterEncoding=UTF-8&useSSL=false' 89 | # username: 90 | # password: 91 | # sqlite3 建议使用绝对路径,这里使用的是相对路径 92 | # url: 'jdbc:sqlite::resource:db/sqlite/db2.sqlite3' 93 | # ldap: 94 | # urls: ldap://127.0.0.1:389 95 | # base: OU=公司名称,DC=nutcracker,DC=com,DC=cn 96 | # username: admin 97 | # password: 123 98 | mybatis-plus: 99 | configuration: 100 | default-fetch-size: 100 # 每批处理的大小 101 | map-underscore-to-camel-case: true # 将下划线转为驼峰命名 102 | 103 | locks: 104 | zookeeper: # zookeeper分布式锁 105 | namespace: locks/springboot-freemarker # 锁命名空间 106 | # connect-server: zookeeper01:2181,zookeeper02:2181,zookeeper03:2181 # 连接地址 107 | connect-server: 127.0.0.1:2181 # 连接地址 108 | connection-timeout: 30000 # 连接超时时间,30秒 109 | session-timeout: 30000 # session会话超时时间,30秒 110 | app: 111 | version: '@version@' 112 | 113 | logging: 114 | config: classpath:log4j2.xml 115 | -------------------------------------------------------------------------------- /src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js: -------------------------------------------------------------------------------- 1 | /*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) 2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 4 | * 5 | * Version: 1.3.8 6 | * 7 | */ 8 | (function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event; 9 | var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,e,f){k=!1;var g=d,h=b.outerHeight()-c.outerHeight();e&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),h),g=0