更新版本基础代码环境光
This commit is contained in:
parent
2f4fa9cbd9
commit
6aee5c930c
|
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
<!-- checker检查器,checkstyle固定配置写法,不能缺失 -->
|
<!-- checker检查器,checkstyle固定配置写法,不能缺失 -->
|
||||||
<module name="Checker">
|
<module name="Checker">
|
||||||
|
<!--排除指定文件-->
|
||||||
|
<!-- <module name="BeforeExecutionExclusionFileFilter">-->
|
||||||
|
<!-- <property name="fileNamePattern" value="(FoodTrWebinfoReport.java|IssueApplyQuery.java)"/>-->
|
||||||
|
<!-- </module>-->
|
||||||
<!-- 设置checkstyle以UTF8格式进行文件检查 -->
|
<!-- 设置checkstyle以UTF8格式进行文件检查 -->
|
||||||
<property name="charset" value="UTF-8"/>
|
<property name="charset" value="UTF-8"/>
|
||||||
<!--定义严重程度,可选等级:ignore info warning error,如不定义默认为error -->
|
<!--定义严重程度,可选等级:ignore info warning error,如不定义默认为error -->
|
||||||
|
|
@ -42,7 +45,7 @@
|
||||||
|
|
||||||
<!-- 检查非final的静态变量,有默认规则"^[a-z][a-zA-Z0-9]*$",可自定义-->
|
<!-- 检查非final的静态变量,有默认规则"^[a-z][a-zA-Z0-9]*$",可自定义-->
|
||||||
<module name="StaticVariableName">
|
<module name="StaticVariableName">
|
||||||
<property name="format" value="(^[A-Z0-9_]{0,19}$)"/>
|
<property name="format" value="(^[A-Z0-9_]{0,25}$)"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- 检查包名称命名规范,有默认规则"^[a-z]+(\.[a-z][a-z0-9]*)*$",详细解释为第一位必须为小写字母,后面位数可出现"."和小写字母/大写字母/数字 -->
|
<!-- 检查包名称命名规范,有默认规则"^[a-z]+(\.[a-z][a-z0-9]*)*$",详细解释为第一位必须为小写字母,后面位数可出现"."和小写字母/大写字母/数字 -->
|
||||||
|
|
@ -67,7 +70,7 @@
|
||||||
|
|
||||||
<!-- 方法中的参数名命名规则 -->
|
<!-- 方法中的参数名命名规则 -->
|
||||||
<module name="ParameterName">
|
<module name="ParameterName">
|
||||||
<property name="format" value="(^[a-z][a-zA-Z0-9_]{0,19}$)"/>
|
<property name="format" value="(^[a-z][a-zA-Z0-9_]{0,25}$)"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- 静态常量命名规则 -->
|
<!-- 静态常量命名规则 -->
|
||||||
|
|
@ -111,7 +114,7 @@
|
||||||
|
|
||||||
<!-- 检查方法或构造函数中的参数数量-->
|
<!-- 检查方法或构造函数中的参数数量-->
|
||||||
<module name="ParameterNumber">
|
<module name="ParameterNumber">
|
||||||
<property name="max" value="7"/>
|
<property name="max" value="8"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- 检查方法长度,忽略空行和注释,最大上限为300 -->
|
<!-- 检查方法长度,忽略空行和注释,最大上限为300 -->
|
||||||
|
|
|
||||||
27
pom.xml
27
pom.xml
|
|
@ -10,22 +10,30 @@
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<url>https://www.chinaweal.com.cn</url>
|
<url>https://www.chinaweal.com.cn</url>
|
||||||
|
<description>boot基础的后台模板</description>
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>2.3.5.RELEASE</version>
|
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<postgresql.version>42.2.8</postgresql.version>
|
|
||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
|
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
<spring.boot.version>2.3.5.RELEASE</spring.boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--基础框架youfool-framework-boot-->
|
<!--基础框架youfool-framework-boot-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -37,7 +45,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>${postgresql.version}</version>
|
<version>42.2.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
@ -58,6 +66,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- 代码风格检测插件 checkstyle -->
|
<!-- 代码风格检测插件 checkstyle -->
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,31 @@
|
||||||
package com.chinaweal.youfool.prj;
|
package com.chinaweal.youfool.prj;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.ApplicationListener;
|
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackages = {"com.chinaweal"})
|
@SpringBootApplication(scanBasePackages = {"com.chinaweal"})
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class YoufoolApplication extends SpringBootServletInitializer implements ApplicationListener<ContextRefreshedEvent> {
|
public class YoufoolApplication extends SpringBootServletInitializer {
|
||||||
@Value("${applicationName}")
|
|
||||||
private String applicationName;
|
|
||||||
@Value("${version}")
|
|
||||||
private String version;
|
|
||||||
@Value("${description}")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Override
|
public static void main(String[] args) {
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {
|
|
||||||
return applicationBuilder.sources(YoufoolApplication.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
SpringApplication.run(YoufoolApplication.class, args);
|
||||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
|
||||||
if (event.getApplicationContext().getParent() == null) {
|
|
||||||
log.info("========================== 程序启动成功! ==========================");
|
log.info("========================== 程序启动成功! ==========================");
|
||||||
log.info("====== 程 序:{} !", applicationName);
|
log.info("====== 程 序:youfool-prj-springboot-template!");
|
||||||
log.info("====== 版本号:{} ", version);
|
log.info("====== 描 述:boot基础的后台模板!");
|
||||||
log.info("====== 描 述:{} ", description);
|
|
||||||
log.info("====== CMS 基础框架后台管理系统路径:/cms,账号:admin、密码:123456");
|
log.info("====== CMS 基础框架后台管理系统路径:/cms,账号:admin、密码:123456");
|
||||||
log.info("====== 接口文档路径:/doc.html,账号:admin、密码:123456。注:如果乱码请指定VM -Dfile.encoding=UTF-8");
|
log.info("====== 接口文档路径:/doc.html,账号:admin、密码:123456。注:如果乱码请指定VM -Dfile.encoding=UTF-8");
|
||||||
log.info("====== Druid Monitor路径:/druid,账号:admin、密码:123456");
|
log.info("====== Druid Monitor路径:/druid,账号:admin、密码:123456");
|
||||||
log.info("====================================================================");
|
log.info("====================================================================");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||||
|
return builder.sources(this.getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -27,6 +28,8 @@ import javax.sql.DataSource;
|
||||||
@MapperScan(basePackages = {"com.chinaweal.youfool.framework.springboot.cms.**.mapper", "com.chinaweal.youfool.prj.**.mapper"}, sqlSessionTemplateRef = "prjSqlSessionTemplate")
|
@MapperScan(basePackages = {"com.chinaweal.youfool.framework.springboot.cms.**.mapper", "com.chinaweal.youfool.prj.**.mapper"}, sqlSessionTemplateRef = "prjSqlSessionTemplate")
|
||||||
public class PrjDataSource {
|
public class PrjDataSource {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CommonMetaObjectHandler commonMetaObjectHandler;
|
||||||
|
|
||||||
@Bean(name = "prjDS", initMethod = "init", destroyMethod = "close")
|
@Bean(name = "prjDS", initMethod = "init", destroyMethod = "close")
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.prj")
|
@ConfigurationProperties(prefix = "spring.datasource.prj")
|
||||||
|
|
@ -41,7 +44,7 @@ public class PrjDataSource {
|
||||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||||
bean.setDataSource(dataSource);
|
bean.setDataSource(dataSource);
|
||||||
GlobalConfig globalConfig = new GlobalConfig();
|
GlobalConfig globalConfig = new GlobalConfig();
|
||||||
globalConfig.setMetaObjectHandler(new CommonMetaObjectHandler());
|
globalConfig.setMetaObjectHandler(commonMetaObjectHandler);
|
||||||
bean.setGlobalConfig(globalConfig);
|
bean.setGlobalConfig(globalConfig);
|
||||||
bean.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
|
bean.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mybatis/mapper/**/*.xml"));
|
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mybatis/mapper/**/*.xml"));
|
||||||
|
|
@ -51,9 +54,7 @@ public class PrjDataSource {
|
||||||
@Bean(name = "prjTransactionManager")
|
@Bean(name = "prjTransactionManager")
|
||||||
@Primary
|
@Primary
|
||||||
public DataSourceTransactionManager transactionManager(@Qualifier("prjDS") DataSource dataSource) {
|
public DataSourceTransactionManager transactionManager(@Qualifier("prjDS") DataSource dataSource) {
|
||||||
DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager(dataSource);
|
return new DataSourceTransactionManager(dataSource);
|
||||||
dataSourceTransactionManager.setEnforceReadOnly(true);
|
|
||||||
return dataSourceTransactionManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "prjSqlSessionTemplate")
|
@Bean(name = "prjSqlSessionTemplate")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||||
public class SwaggerKnife4j {
|
public class SwaggerKnife4j {
|
||||||
@Value("${applicationName}")
|
@Value("${applicationName}")
|
||||||
private String applicationName;
|
private String applicationName;
|
||||||
@Value("${version}")
|
|
||||||
private String version;
|
|
||||||
@Value("${description}")
|
@Value("${description}")
|
||||||
private String description;
|
private String description;
|
||||||
@Value("${license}")
|
|
||||||
private String license;
|
|
||||||
|
|
||||||
@Bean("cms")
|
@Bean("cms")
|
||||||
public Docket cmsApi() {
|
public Docket cmsApi() {
|
||||||
|
|
@ -43,9 +39,8 @@ public class SwaggerKnife4j {
|
||||||
.title(applicationName)
|
.title(applicationName)
|
||||||
.description(description)
|
.description(description)
|
||||||
.termsOfServiceUrl("https://www.chinaweal.com.cn")
|
.termsOfServiceUrl("https://www.chinaweal.com.cn")
|
||||||
.version(version)
|
|
||||||
.contact(new Contact("chinaweal", "https://www.chinaweal.com.cn", ""))
|
.contact(new Contact("chinaweal", "https://www.chinaweal.com.cn", ""))
|
||||||
.license(license)
|
.license("众望通科技")
|
||||||
.licenseUrl("https://www.chinaweal.com.cn")
|
.licenseUrl("https://www.chinaweal.com.cn")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,12 @@ import com.chinaweal.youfool.framework.springboot.cms.dev.GenerateDictConstant;
|
||||||
/**
|
/**
|
||||||
* 常量代码生成器
|
* 常量代码生成器
|
||||||
*/
|
*/
|
||||||
public class ConstantCodeGenerator {
|
public class ConstantCodeGen {
|
||||||
private ConstantCodeGenerator() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
GenerateDictConstant generator = new GenerateDictConstant("properties/codeCenerator");
|
GenerateDictConstant generator = new GenerateDictConstant("properties/codeGenerator");
|
||||||
generator.generateConstant();
|
generator.generateConstant();
|
||||||
}
|
}
|
||||||
|
private ConstantCodeGen(){
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,15 +4,15 @@ package com.chinaweal.youfool.prj.dev;
|
||||||
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CodeGenerator;
|
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CodeGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代码生成器
|
* 根据库表结构生成代码层
|
||||||
*/
|
*/
|
||||||
public class MybatisPlusCodeGenerator {
|
public class TableCodeGen {
|
||||||
private MybatisPlusCodeGenerator() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
CodeGenerator codeGenerator = new CodeGenerator("properties/codeCenerator");
|
CodeGenerator codeGenerator = new CodeGenerator("properties/codeGenerator");
|
||||||
codeGenerator.generateCode();
|
codeGenerator.generateCode();
|
||||||
}
|
}
|
||||||
|
private TableCodeGen(){
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@ restLog:
|
||||||
# ignoreSuffix: .css,.jpg,.png,.icon,.html,.js
|
# ignoreSuffix: .css,.jpg,.png,.icon,.html,.js
|
||||||
|
|
||||||
jwt:
|
jwt:
|
||||||
id: pms
|
id: prj
|
||||||
secret: 64faa93ed3454feeab946cc3a526eea0
|
secret: 64faa93ed3454feeab946cc3a526eea0
|
||||||
ttlMillis: 7500000 #后台125分钟,多出5分钟,前端cookie只记录120分钟
|
ttlMillis: 7500000 #后台125分钟,多出5分钟,前端cookie只记录120分钟
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,11 @@
|
||||||
|
|
||||||
</settings>
|
</settings>
|
||||||
|
|
||||||
|
|
||||||
<!-- mybatis-plus 分页插件-->
|
<!-- mybatis-plus 分页插件-->
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin interceptor="com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor">
|
<plugin interceptor="com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor">
|
||||||
|
<property name="@page" value="com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor"/>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,14 @@ parentPackageName=com.chinaweal.youfool.prj
|
||||||
#mapper文件存放路径
|
#mapper文件存放路径
|
||||||
mapperFilePath=/src/main/resources/mybatis/mapper/
|
mapperFilePath=/src/main/resources/mybatis/mapper/
|
||||||
author=chinaweal
|
author=chinaweal
|
||||||
|
#mybatis-plus 代码生成器参数-------配置文件模板
|
||||||
|
#module=rl-biz-med
|
||||||
|
#实体目录
|
||||||
|
#entityPackagePath=/rl-rpc-service/src/main/java/com/chinaweal/fsrl/med/entity
|
||||||
|
#servicePackagePath=/rl-rpc-service/src/main/java/com/chinaweal/fsrl/med/service
|
||||||
|
#mapperPackagePath=/module
|
||||||
|
#serviceImplPackagePath=/module
|
||||||
|
#controllerPackagePath=/module
|
||||||
|
#mapper文件存放路径
|
||||||
|
#字典常量生成路径
|
||||||
|
constantPackagePath=/rl-common/src/main/java/com/chinaweal/fsrl
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
applicationName=prj
|
applicationName=youfool-prj-springboot-template
|
||||||
#描述
|
#描述
|
||||||
description=web应用后台模板
|
description=boot基础的后台模板
|
||||||
#许可
|
|
||||||
license=众望通科技
|
|
||||||
#版本号
|
|
||||||
version=1.0
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue