字典整合(没完成)
This commit is contained in:
parent
d6139a1c6b
commit
6558080e3e
|
|
@ -1,56 +0,0 @@
|
||||||
package com.chinaweal.youfool.prj.config;
|
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
|
||||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
|
||||||
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CommonMetaObjectHandler;
|
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
|
||||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cms基础的数据源
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@MapperScan(basePackages = "com.chinaweal.youfool.framework.springboot.**.mapper", sqlSessionTemplateRef = "cmsSqlSessionTemplate")
|
|
||||||
public class CmsDataSource {
|
|
||||||
|
|
||||||
@Bean(name = "cmsDS", initMethod = "init", destroyMethod = "close")
|
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.cms")
|
|
||||||
public DruidDataSource dataSource() {
|
|
||||||
return DruidDataSourceBuilder.create().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(name = "cmsSqlSessionFactory")
|
|
||||||
public MybatisSqlSessionFactoryBean sqlSessionFactory(@Qualifier("cmsDS") DataSource dataSource) throws Exception {
|
|
||||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
|
||||||
bean.setDataSource(dataSource);
|
|
||||||
GlobalConfig globalConfig = new GlobalConfig();
|
|
||||||
globalConfig.setMetaObjectHandler(new CommonMetaObjectHandler());
|
|
||||||
bean.setGlobalConfig(globalConfig);
|
|
||||||
bean.setConfigLocation(new ClassPathResource("cms/mybatis/mybatis-config.xml"));
|
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:cms/mybatis/mapper/**/*.xml"));
|
|
||||||
return bean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(name = "cmsTransactionManager")
|
|
||||||
public DataSourceTransactionManager transactionManager(@Qualifier("cmsDS") DataSource dataSource) {
|
|
||||||
return new DataSourceTransactionManager(dataSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(name = "cmsSqlSessionTemplate")
|
|
||||||
public SqlSessionTemplate sqlSessionTemplate(@Qualifier("cmsSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
|
||||||
return new SqlSessionTemplate(sqlSessionFactory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.chinaweal.youfool.prj.config;
|
||||||
|
|
||||||
|
import com.chinaweal.youfool.framework.springboot.filter.RepeatlyReadFilter;
|
||||||
|
import com.chinaweal.youfool.framework.springboot.filter.RestLogFilter;
|
||||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author itluck
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class FilterConfig {
|
||||||
|
/**
|
||||||
|
* 日志记录过滤器
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public FilterRegistrationBean<RestLogFilter> restLogFilter() {
|
||||||
|
FilterRegistrationBean<RestLogFilter> registrationBean = new FilterRegistrationBean<>();
|
||||||
|
registrationBean.setFilter(new RestLogFilter());
|
||||||
|
registrationBean.addUrlPatterns("/*");
|
||||||
|
registrationBean.setName("restLogFilter");
|
||||||
|
registrationBean.setOrder(-99);
|
||||||
|
return registrationBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启重复读取request流,用于日志
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public FilterRegistrationBean<RepeatlyReadFilter> repeatlyReadFilter() {
|
||||||
|
FilterRegistrationBean<RepeatlyReadFilter> registrationBean = new FilterRegistrationBean<>();
|
||||||
|
registrationBean.setFilter(new RepeatlyReadFilter());
|
||||||
|
registrationBean.addUrlPatterns("/*");
|
||||||
|
registrationBean.setName("repeatlyReadFilter");
|
||||||
|
registrationBean.setOrder(-100);
|
||||||
|
return registrationBean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,7 +24,7 @@ import javax.sql.DataSource;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@MapperScan(basePackages = {"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 {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.chinaweal.youfool.prj.dev;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chinaweal.youfool.framework.springboot.cms.dev.GenerateDictConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常量代码生成器
|
||||||
|
*/
|
||||||
|
public class ConstantCodeGenerator {
|
||||||
|
private ConstantCodeGenerator() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
GenerateDictConstant generator = new GenerateDictConstant("properties/codeCenerator");
|
||||||
|
generator.generateConstant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ logging:
|
||||||
level:
|
level:
|
||||||
dao: debug
|
dao: debug
|
||||||
youfool.dao: info
|
youfool.dao: info
|
||||||
com.chinaweal.youfool.framework.springboot.log: debug
|
com.chinaweal.youfool.framework.springboot.cms: debug
|
||||||
com.chinaweal.youfool.prj: debug
|
com.chinaweal.youfool.prj: debug
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
|
|
@ -10,7 +10,3 @@ spring:
|
||||||
url: jdbc:postgresql://172.22.80.157:5432/prj_template
|
url: jdbc:postgresql://172.22.80.157:5432/prj_template
|
||||||
username: postgres
|
username: postgres
|
||||||
password: 123456
|
password: 123456
|
||||||
cms:
|
|
||||||
url: jdbc:postgresql://172.22.80.157:5432/prj_template?currentSchema=cms
|
|
||||||
username: postgres
|
|
||||||
password: 123456
|
|
||||||
|
|
@ -11,7 +11,3 @@ spring:
|
||||||
url: jdbc:postgresql://127.0.0.1:5432/pms
|
url: jdbc:postgresql://127.0.0.1:5432/pms
|
||||||
username: postgres
|
username: postgres
|
||||||
password: 123456
|
password: 123456
|
||||||
youfool:
|
|
||||||
url: jdbc:postgresql://127.0.0.1:5432/pms?currentSchema=youfool
|
|
||||||
username: postgres
|
|
||||||
password: 123456
|
|
||||||
|
|
@ -18,15 +18,6 @@ spring:
|
||||||
time-between-eviction-runs-millis: 60000
|
time-between-eviction-runs-millis: 60000
|
||||||
min-evictable-idle-time-millis: 300000
|
min-evictable-idle-time-millis: 300000
|
||||||
validation-query: select version()
|
validation-query: select version()
|
||||||
cms:
|
|
||||||
filters: stat
|
|
||||||
initial-size: 2
|
|
||||||
min-idle: 1
|
|
||||||
max-active: 20
|
|
||||||
max-wait: 30000
|
|
||||||
time-between-eviction-runs-millis: 60000
|
|
||||||
min-evictable-idle-time-millis: 300000
|
|
||||||
validation-query: select version()
|
|
||||||
druid:
|
druid:
|
||||||
web-stat-filter:
|
web-stat-filter:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
@ -42,6 +33,7 @@ spring:
|
||||||
|
|
||||||
restLog:
|
restLog:
|
||||||
ignoreServletPath: /druid,/swagger-resources,/v2/api-docs,/webjars
|
ignoreServletPath: /druid,/swagger-resources,/v2/api-docs,/webjars
|
||||||
|
isSaveDb: false
|
||||||
# ignoreSuffix: .css,.jpg,.png,.icon,.html,.js
|
# ignoreSuffix: .css,.jpg,.png,.icon,.html,.js
|
||||||
|
|
||||||
jwt:
|
jwt:
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
#mybatis-plus 代码生成器参数
|
#mybatis-plus 代码生成器参数
|
||||||
url=jdbc:postgresql://172.22.80.157:5432/pms_dev
|
url=jdbc:postgresql://172.22.80.157:5432/prj_template
|
||||||
driverName=org.postgresql.Driver
|
driverName=org.postgresql.Driver
|
||||||
#PostgreSQL schemaName
|
#PostgreSQL schemaName
|
||||||
schemaName=public
|
schemaName=public
|
||||||
username=postgres
|
username=postgres
|
||||||
password=123456
|
password=123456
|
||||||
#父包名
|
#父包名
|
||||||
parentPackageName=com.chinaweal.youfool.pms
|
parentPackageName=com.chinaweal.youfool.prj
|
||||||
#mapper文件存放路径
|
#mapper文件存放路径
|
||||||
mapperFilePath=/src/main/resources/mybatis/mapper/
|
mapperFilePath=/src/main/resources/mybatis/mapper/
|
||||||
author=chinaweal
|
author=chinaweal
|
||||||
Loading…
Reference in New Issue