tianyun 3 年 前
コミット
43940b51aa

+ 1 - 1
springboot-main/pom.xml

@@ -149,7 +149,7 @@
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
-            <version>8.0.16</version>
+            <version>8.0.27</version>
         </dependency>
     </dependencies>
 

+ 0 - 13
springboot-main/src/main/java/com/alvin/annotation/ResponseResult.java

@@ -1,13 +0,0 @@
-package com.alvin.annotation;
-
-import java.lang.annotation.*;
-
-/**
- * 标记方法返回值需要进行包装的 自定义注解
- * @author 田云
- */
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface ResponseResult {
-}

+ 0 - 5
springboot-main/src/main/java/com/alvin/controller/AppController.java

@@ -1,11 +1,9 @@
 package com.alvin.controller;
 
-import com.alvin.annotation.ResponseResult;
 import com.alvin.common.entity.PageResult;
 import com.alvin.common.entity.Result;
 import com.alvin.entity.User;
 import com.alvin.service.AppService;
-import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,12 +11,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Collections;
-import java.util.List;
 
 @Slf4j
 @RestController
 @RequestMapping("/user")
-@ResponseResult
 public class AppController {
 
     @Autowired
@@ -29,7 +25,6 @@ public class AppController {
      *
      * @return {@link Result<User>}
      */
-    @ResponseResult
     @GetMapping("/findOne")
     public User findOne() {
         User user = new User();

+ 0 - 51
springboot-main/src/main/resources/application-dev.yml

@@ -1,51 +0,0 @@
-server:
-  port: 8080
-
-spring:
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://ip-191:3306/biaozhu_medical_kg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
-    username: xxx
-    password: xxx
-    #下面为连接池补充设置
-    druid:
-      initial-size: 5 # 初始化
-      max-active: 5 # 最大
-      min-idle: 5 # 最小
-      max-wait: 6000 # 超时时间
-      time-between-eviction-runs-millis: 60000 # 每分钟检查一次空闲链接
-      min-evictable-idle-time-millis: 300000 # 空闲链接可以保持多久而不被驱逐
-      # 检测链接是否有效的query
-      validation-query: SELECT 1 FROM DUAL
-      test-while-idle: true # 检测到链接空闲时,验证是否有效
-      test-on-borrow: false # 申请链接时,不检测
-      test-on-return: false # 返回链接时,不检测
-      pool-prepared-statements: false # 是否缓存preparedStatement,oracle打开,mysql关闭
-      # 如果上面开启了游标,这里要设置一下大小,例如 50
-      max-pool-prepared-statement-per-connection-size: -1
-      # 统计、监控配置
-      filters: stat,wall # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-      # 合并执行的相同sql,避免因为参数不同而统计多条sql语句;开启慢sql记录
-      connect-properties: config.stat.mergeSql=true;config.stat.slowSqlMillis=500
-      use-global-data-source-stat: true # 合并多个DruidDataSource的监控数据
-      stat-view-servlet:
-        enabled: true
-        login-username: tianyun
-        login-password: tianyunperfect
-        allow: # 默认运行所有
-        deny: # 默认即可
-        reset-enable: true
-
-
-mybatis:
-  type-aliases-package: com.alvin.dao.entity
-  mapper-locations: classpath:mapper/*Mapper.xml
-
-
-# 设置debug模式下打印mysql
-logging:
-  level:
-    com:
-      alvin:
-        mapper: debug

+ 0 - 2
springboot-main/src/main/resources/application-docker.yml

@@ -1,2 +0,0 @@
-server:
-  port: 8080

+ 0 - 35
springboot-main/src/main/resources/application-prod.yml

@@ -1,35 +0,0 @@
-server:
-  port: 8080
-
-spring:
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://127.0.0.1:3306/user?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
-    username:
-    password:
-    #下面为连接池补充设置
-    initialSize: 5
-    # 配置获取连接等待超时的时间
-    maxWait: 60000
-    # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-    timeBetweenEvictionRunsMillis: 60000
-    # 配置一个连接在池中最小生存的时间,单位是毫秒
-    minEvictableIdleTimeMillis: 300000
-    validationQuery: SELECT 1 FROM DUAL
-    testWhileIdle: true
-    testOnBorrow: false
-    testOnReturn: false
-    # 打开PSCache,并且指定每个连接上PSCache的大小
-    poolPreparedStatements: true
-    # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-    filters: stat,wall
-    # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
-    connectionProperties: config.stat.mergeSql=true;config.stat.slowSqlMillis=5000
-    # 合并多个DruidDataSource的监控数据
-    useGlobalDataSourceStat: true
-
-
-mybatis:
-  type-aliases-package: com.alvin.dao.entity
-  mapper-locations: classpath:mapper/*Mapper.xml

+ 50 - 4
springboot-main/src/main/resources/application.yml

@@ -1,5 +1,51 @@
-spring:
-  profiles:
-    active: dev
 server:
-  port: 8080
+  port: 8080
+
+spring:
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://ip-191:3306/biaozhu_medical_kg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
+    username: xxx
+    password: xxx
+    #下面为连接池补充设置
+    druid:
+      initial-size: 5 # 初始化
+      max-active: 5 # 最大
+      min-idle: 5 # 最小
+      max-wait: 6000 # 超时时间
+      time-between-eviction-runs-millis: 60000 # 每分钟检查一次空闲链接
+      min-evictable-idle-time-millis: 300000 # 空闲链接可以保持多久而不被驱逐
+      # 检测链接是否有效的query
+      validation-query: SELECT 1 FROM DUAL
+      test-while-idle: true # 检测到链接空闲时,验证是否有效
+      test-on-borrow: false # 申请链接时,不检测
+      test-on-return: false # 返回链接时,不检测
+      pool-prepared-statements: false # 是否缓存preparedStatement,oracle打开,mysql关闭
+      # 如果上面开启了游标,这里要设置一下大小,例如 50
+      max-pool-prepared-statement-per-connection-size: -1
+      # 统计、监控配置
+      filters: stat,wall # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      # 合并执行的相同sql,避免因为参数不同而统计多条sql语句;开启慢sql记录
+      connect-properties: config.stat.mergeSql=true;config.stat.slowSqlMillis=500
+      use-global-data-source-stat: true # 合并多个DruidDataSource的监控数据
+      stat-view-servlet:
+        enabled: true
+        login-username: tianyun
+        login-password: tianyunperfect
+        allow: # 默认运行所有
+        deny: # 默认即可
+        reset-enable: true
+
+
+mybatis:
+  type-aliases-package: com.alvin.dao.entity
+  mapper-locations: classpath:mapper/*Mapper.xml
+
+
+# 设置debug模式下打印mysql
+logging:
+  level:
+    com:
+      alvin:
+        mapper: debug

+ 7 - 9
springboot-main/src/main/resources/mybatis-generator.xml

@@ -7,15 +7,13 @@
 
     <context id="MySql" defaultModelType="flat">
 
-        <!--搜索:need to change-->
-
         <!-- 查询单条数据插件 -->
         <plugin type="com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin"/>
 
         <!-- MySQL分页插件 -->
         <plugin type="com.itfsw.mybatis.generator.plugins.LimitPlugin">
             <!-- 通过配置startPage影响Example中的page方法开始分页的页码,默认分页从0开始 -->
-            <property name="startPage" value="0"/>
+            <property name="startPage" value="1"/>
         </plugin>
 
         <!-- Example Criteria 增强插件 -->
@@ -24,12 +22,6 @@
             <property name="enableAndIf" value="true"/>
         </plugin>
 
-        <!-- Example 目标包修改插件 need to change-->
-        <plugin type="com.itfsw.mybatis.generator.plugins.ExampleTargetPlugin">
-            <!-- 修改Example类生成到目标包下 -->
-            <property name="targetPackage" value="com.alvin.dao.entity.example"/>
-        </plugin>
-
         <!-- 数据Model属性对应Column获取插件 -->
         <plugin type="com.itfsw.mybatis.generator.plugins.ModelColumnPlugin"/>
 
@@ -100,6 +92,12 @@
 
         <!--<plugin type="org.mybatis.generator.plugins.ToStringPlugin" />-->
 
+        <!-- Example 目标包修改插件 need to change-->
+        <plugin type="com.itfsw.mybatis.generator.plugins.ExampleTargetPlugin">
+            <!-- 修改Example类生成到目标包下 -->
+            <property name="targetPackage" value="com.alvin.dao.entity.example"/>
+        </plugin>
+
         <!--数据库连接配置 need to change-->
         <jdbcConnection
                 driverClass="com.mysql.cj.jdbc.Driver"