多数据源
@MapperScan(basePackages = {"com.kestrel.saas.mapper"},
sqlSessionFactoryRef = "sqlSessionFactory")
@MapperScan(basePackages = "com.kestrel.saas.mapper.collect", sqlSessionFactoryRef = "collectSqlSessionFactory")
yml
spring:
application:
name: iroq-pro
profiles:
active: dev
mybatis-plus:
mapper-locations: classpath*:mappers/*.xml,classpath*:collect-mappers/*.xml
pom.xml 依赖
org.springframework.boot
spring-boot-starter-web
mysql
mysql-connector-java
cn.hutool
hutool-all
5.1.1
io.jsonwebtoken
jjwt
0.9.1
com.auth0
java-jwt
3.4.0
com.alibaba
easyexcel
2.2.8
com.baomidou
mybatis-plus-core
3.3.2
compile
com.baomidou
mybatis-plus-extension
3.3.2
compile
com.baomidou
mybatis-plus-boot-starter
3.3.2
compile
发布平台错误 log
08:00 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
08:00 at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
08:00 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340)
08:00 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
08:00 at com.kestrel.App.main(App.java:37)
08:00 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
08:00 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
08:00 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
08:00 at java.lang.reflect.Method.invoke(Method.java:498)
08:00 at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
08:00 at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
08:00 at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
08:00 at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
08:00 Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'SqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/opt/app.jar!/BOOT-INF/classes!/collect-mappers/QuerydetailMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'URL [jar:file:/opt/app.jar!/BOOT-INF/classes!/collect-mappers/QuerydetailMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.kestrel.saas.mapper.collect.QuerydetailMapper.QuerydetailMap
08:00 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
08:00 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
08:00 ... 28 common frames omitted
08:00 Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/opt/app.jar!/BOOT-INF/classes!/collect-mappers/QuerydetailMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'URL [jar:file:/opt/app.jar!/BOOT-INF/classes!/collect-mappers/QuerydetailMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.kestrel.saas.mapper.collect.QuerydetailMapper.QuerydetailMap
08:00 at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:593)
08:00 at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:429)
08:00 at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.getObject(MybatisSqlSessionFactoryBean.java:626)
08:00 at com.kestrel.saas.config.CollectDataSourceConfig.SqlSessionFactory(CollectDataSourceConfig.java:47)
08:00 at com.kestrel.saas.config.CollectDataSourceConfig$$EnhancerBySpringCGLIB$$691472a0.CGLIB$SqlSessionFactory$1()
08:00 at com.kestrel.saas.config.CollectDataSourceConfig$$EnhancerBySpringCGLIB$$691472a0$$FastClassBySpringCGLIB$$15a8d1fe.invoke()
08:00 at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
08:00 at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
08:00 at com.kestrel.saas.config.CollectDataSourceConfig$$EnhancerBySpringCGLIB$$691472a0.SqlSessionFactory()
08:00 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
08:00 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
08:00 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
08:00 at java.lang.reflect.Method.invoke(Method.java:498)
08:00 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
08:00 ... 29 common frames omitted
08:00 Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'URL [jar:file:/opt/app.jar!/BOOT-INF/classes!/collect-mappers/QuerydetailMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.kestrel.saas.mapper.collect.QuerydetailMapper.QuerydetailMap
08:00 at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:122)
08:00 at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:94)
08:00 at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:591)
08:00 ... 42 common frames omitted
08:00 Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.kestrel.saas.mapper.collect.QuerydetailMapper.QuerydetailMap
08:00 at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:947)
08:00 at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:903)
08:00 at org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:660)
08:00 at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:209)
08:00 at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
08:00 at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:288)
08:00 at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:253)
08:00 at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:245)
08:00 at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
08:00 ... 44 common frames omitted
08:00
QuerydetailMapper.xml 文件
identify,
identify_time,
create_time,
id,
sourcesQuery,
queryIp,
queryTime,
productPc
insert into IrQuerydetail(identify, identify_time, create_time, id, sourcesQuery, queryIp, queryTime, productPc)
values
(#{entity.identify}, #{entity.identifyTime}, #{entity.createTime}, #{entity.sourcesquery}, #{entity.queryip}, #{entity.querytime}, #{entity.productpc})
insert into IrQuerydetail(identify, identify_time, create_time, sourcesQuery, queryIp, queryTime, productPc)
values
(#{entity.identify}, #{entity.identifyTime}, #{entity.createTime}, #{entity.sourcesquery}, #{entity.queryip}, #{entity.querytime}, #{entity.productpc})
on duplicate key update
identify = if(values(identify) is not null,values(identify) ,identify), identify_time = if(values(identify_time) is not null,values(identify_time) ,identify_time), create_time = if(values(create_time) is not null,values(create_time) ,create_time), sourcesQuery = if(values(sourcesQuery) is not null,values(sourcesQuery) ,sourcesQuery), queryIp = if(values(queryIp) is not null,values(queryIp) ,queryIp), queryTime = if(values(queryTime) is not null,values(queryTime) ,queryTime), productPc = if(values(productPc) is not null,values(productPc) ,productPc)
select count(1)
from IrQuerydetail
and queryTime>=#{querytime,jdbcType=VARCHAR}
select qsd.queryTime,qsd.productPc,qs.productName,qs.productSort from IrQuerydetail qsd left join IrQueryStatistics qs on qsd.productPc=qs.productPc order by queryTime desc limit #{pageSize};
select DATE_FORMAT(FROM_UNIXTIME(queryTime / 1000), '%Y%m') as months,count(1) as count from IrQuerydetail GROUP BY months;
查了全项目 resultType id 没重复,全项目 select id 也没重复,全项目 xml 文件没有重复多余