添加支持mysql数据库

This commit is contained in:
liwen
2020-11-25 17:37:23 +08:00
parent a8bc130204
commit b1ceac8a77
23 changed files with 622 additions and 77 deletions

View File

@@ -30,6 +30,7 @@ dependencies {
compile 'joda-time:joda-time:2.10.1'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3'
implementation 'com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5'
implementation 'mysql:mysql-connector-java:8.0.20'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
@@ -39,7 +40,6 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.4'
}
test {

View File

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,49 @@
server:
port: 8080
spring:
datasource:
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
druid:
#url: jdbc:dm://10.105.73.121:12345/EMSHIS
url: jdbc:dm://192.168.1.210:12345/EMSHIS
username: IPSM_DBA
password: IPSM_DBA
driver-class-name: dm.jdbc.driver.DmDriver
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
mybatis:
basepackage: com.wlkj.ipsm.realtime.mapper
xmlLocation: classpath:mapper/**/*.xml
mapper-locations: "classpath*:mapper/*.xml"
#分页控件配置
pagehelper:
helper-dialect: dm
reasonable: true
support-methods-arguments: true
params: countSql

View File

@@ -0,0 +1,50 @@
server:
port: 8080
spring:
datasource:
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
druid:
#url: jdbc:dm://10.105.73.121:12345/EMSHIS
# url: jdbc:dm://192.168.1.210:12345/EMSHIS
url: jdbc:mysql://${MYSQL_HOST:10.211.55.9}:${MYSQL_PORT:3306}/ipsm_dba?useUnicode=true&characterEncoding=UTF8
username: root
password: Root@123456
driver-class-name: com.mysql.cj.jdbc.Driver
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT "x"
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
mybatis:
basepackage: com.wlkj.ipsm.realtime.mapper
xmlLocation: classpath:mapper/**/*.xml
mapper-locations: "classpath*:mapper/*.xml"
#分页控件配置
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: countSql

View File

@@ -1,50 +1,6 @@
server:
port: 8080
spring:
datasource:
# 使用druid数据源
type: com.alibaba.druid.pool.DruidDataSource
druid:
#url: jdbc:dm://10.105.73.121:12345/EMSHIS
url: jdbc:dm://192.168.1.210:12345/EMSHIS
username: IPSM_DBA
password: IPSM_DBA
driver-class-name: dm.jdbc.driver.DmDriver
# 连接池的配置信息
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
mybatis:
basepackage: com.wlkj.ipsm.realtime.mapper
xmlLocation: classpath:mapper/**/*.xml
mapper-locations: "classpath*:mapper/*.xml"
#分页控件配置
pagehelper:
helper-dialect: dm
reasonable: true
support-methods-arguments: true
params: countSql
profiles:
active: mysql
#日志输出
logging:
level:
@@ -57,5 +13,4 @@ jwt:
auth:
user:
token-header: Authorization
token-header: Authorization

View File

@@ -2,34 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epri.fx.server.mapper.RsaKeyMapper">
<resultMap id="BaseResultMap" type="com.epri.fx.server.entity.RsaKey">
<id column="KEY" jdbcType="VARCHAR" property="key" />
<result column="VALUE" jdbcType="VARCHAR" property="value" />
<id column="RSA_KEY" jdbcType="VARCHAR" property="key" />
<result column="KEY_VALUE" jdbcType="VARCHAR" property="value" />
</resultMap>
<sql id="Base_Column_List">
KEY, VALUE
RSA_KEY, KEY_VALUE
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from rsa_key
where KEY = #{key,jdbcType=VARCHAR}
from base_rsa_key
where RSA_KEY = #{key,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from rsa_key
where KEY = #{key,jdbcType=VARCHAR}
delete from base_rsa_key
where RSA_KEY = #{key,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.epri.fx.server.entity.RsaKey">
insert into rsa_key (KEY, VALUE)
insert into base_rsa_key (RSA_KEY, KEY_VALUE)
values (#{key,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.epri.fx.server.entity.RsaKey">
insert into rsa_key
insert into base_rsa_key
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="key != null">
KEY,
RSA_KEY,
</if>
<if test="value != null">
VALUE,
KEY_VALUE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -42,17 +42,17 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.epri.fx.server.entity.RsaKey">
update rsa_key
update base_rsa_key
<set>
<if test="value != null">
VALUE = #{value,jdbcType=VARCHAR},
KEY_VALUE = #{value,jdbcType=VARCHAR},
</if>
</set>
where KEY = #{key,jdbcType=VARCHAR}
where RSA_KEY = #{key,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.epri.fx.server.entity.RsaKey">
update rsa_key
update base_rsa_key
set VALUE = #{value,jdbcType=VARCHAR}
where KEY = #{key,jdbcType=VARCHAR}
where RSA_KEY = #{key,jdbcType=VARCHAR}
</update>
</mapper>

View File

@@ -389,6 +389,7 @@
</if>
</where>
</select>
<select id="selectMemberByGroupId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select u.* from base_user u left join base_group_member gm on gm.user_id = u.id where gm.group_id = #{groupId,jdbcType=INTEGER}