服务接口配置

  1. server:
  2. port: 8001
  3. #请求路径
  4. servlet:
  5. context-path: /userauth

spring的各种配置

包含:cloud、redis、servlet、jackson、datasource

  1. spring:
  2. application :
  3. name: apporder
  4. cloud:
  5. nacos:
  6. discovery:
  7. server-addr: localhost:8848
  8. redis:
  9. database: 3
  10. host: 127.0.0.1
  11. port: 6379
  12. password: qixianfeng@20161031
  13. jedis:
  14. pool:
  15. min-idle: 1
  16. servlet:
  17. multipart:
  18. max-file-size: 10MB
  19. max-request-size: 1000MB
  20. jackson:
  21. date-format: yyyy-MM-dd
  22. datasource:
  23. username: tarim
  24. password: d-nGh3H8%jf8rW-D
  25. url: jdbc:mysql://rm-bp1a5xlm7ezxn3hzabo.mysql.rds.aliyuncs.com:3306/qxfv2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
  26. driver-class-name: com.mysql.jdbc.Driver
  27. type: com.alibaba.druid.pool.DruidDataSource
  28. # 数据源其它配置
  29. initialSize: 5
  30. minIdle: 5
  31. maxActive: 20
  32. maxWait: 60000
  33. timeBetweenEvictionRunsMillis: 60000
  34. minEvictableIdleTimeMillis: 300000
  35. validationQuery: SELECT 1 FROM DUAL
  36. testWhileIdle: true
  37. testOnBorrow: false
  38. testOnReturn: false
  39. poolPreparedStatements: true
  40. #配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
  41. filters: stat,wall
  42. maxPoolPreparedStatementPerConnectionSize: 20
  43. useGlobalDataSourceStat: true
  44. connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500

mybatis-plus的各种配置

  1. mybatis-plus:
  2. mapper-locations: classpath:xml/*.xml
  3. #实体扫描,多个package用逗号或者分号分隔
  4. typeAliasesPackage: com.aiweiyun.apporder.entity
  5. #typeEnumsPackage: com.jw.entity.enums
  6. global-config:
  7. # 数据库相关配置
  8. db-config:
  9. #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
  10. # id-type: auto
  11. #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
  12. field-strategy: not_empty
  13. #驼峰下划线转换
  14. column-underline: true
  15. #数据库大写下划线转换
  16. #capital-mode: true
  17. #逻辑删除配置
  18. logic-delete-value: 0
  19. logic-not-delete-value: 1
  20. db-type: h2
  21. #刷新mapper 调试神器
  22. refresh: true
  23. # 原生配置
  24. configuration:
  25. # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  26. map-underscore-to-camel-case: true
  27. cache-enabled: false

Slf4j日志的配置

  1. #配置日志
  2. logging:
  3. #此处存放日志的路径
  4. file:
  5. path: logo
  6. #指定不同目录下的日志的级别
  7. level:
  8. com.shimain.springboot.mapper: DEBUG

ThreadPool的配置

  1. threadPool:
  2. corePoolSize: 10
  3. maxPoolSize: 100
  4. keepAliveSeconds: 60
  5. keepAliveTime: 20
  6. queueCapacity: 20000
  7. allowCoreThreadTimeout: false
  8. threadNamePrefix: qxf-news-

management的配置

  1. management:
  2. endpoints:
  3. web:
  4. exposure:
  5. include: "*"

父工程的pom.xml文件

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>com.aiweiyun</groupId>
  6. <artifactId>qixianfen</artifactId>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <name>qixianfen</name>
  9. <description>Demo project for Spring Boot</description>
  10. <packaging>pom</packaging>
  11. <modules>
  12. <module>gateway</module>
  13. <module>appauth</module>
  14. <module>appnews</module>
  15. <module>appim</module>
  16. <module>appinstitution</module>
  17. <module>appvideo</module>
  18. <module>apporder</module>
  19. </modules>
  20. <properties>
  21. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  22. <maven.compiler.source>1.8</maven.compiler.source>
  23. <maven.compiler.target>1.8</maven.compiler.target>
  24. <junit.version>4.12</junit.version>
  25. <log4j.version>1.2.17</log4j.version>
  26. <lombok.version>1.16.18</lombok.version>
  27. <mysql.version>8.0.22</mysql.version>
  28. <druid.version>1.1.16</druid.version>
  29. <springfox.swagger2>2.9.2</springfox.swagger2>
  30. <swagger.bootstrap>1.8.4</swagger.bootstrap>
  31. <mybatis.plus>3.1.0</mybatis.plus>
  32. <org.apache>2.0</org.apache>
  33. <mybatis.spring.boot.version>1.3.2</mybatis.spring.boot.version>
  34. <alipay.sdk>4.11.8.ALL</alipay.sdk>
  35. </properties>
  36. <!-- <dependencies>-->
  37. <!-- <dependency>-->
  38. <!-- <groupId>org.springframework.boot</groupId>-->
  39. <!-- <artifactId>spring-boot-starter</artifactId>-->
  40. <!-- </dependency>-->
  41. <!-- &lt;!&ndash; https://mvnrepository.com/artifact/com.alipay.sdk/alipay-easysdk &ndash;&gt;-->
  42. <!-- <dependency>-->
  43. <!-- <groupId>com.alipay.sdk</groupId>-->
  44. <!-- <artifactId>alipay-sdk-java</artifactId>-->
  45. <!-- <version>4.11.8.ALL</version>-->
  46. <!-- </dependency>-->
  47. <!-- <dependency>-->
  48. <!-- <groupId>org.springframework.boot</groupId>-->
  49. <!-- <artifactId>spring-boot-starter-test</artifactId>-->
  50. <!-- <scope>test</scope>-->
  51. <!-- </dependency>-->
  52. <!-- </dependencies>-->
  53. <!-- <build>-->
  54. <!-- <plugins>-->
  55. <!-- <plugin>-->
  56. <!-- <groupId>org.springframework.boot</groupId>-->
  57. <!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
  58. <!-- </plugin>-->
  59. <!-- </plugins>-->
  60. <!-- </build>-->
  61. <!-- 子模块继承之后,提供作用:锁定版本+子模块不用写groupId和version -->
  62. <dependencyManagement>
  63. <dependencies>
  64. <!-- https://mvnrepository.com/artifact/com.alipay.sdk/alipay-easysdk -->
  65. <dependency>
  66. <groupId>com.alipay.sdk</groupId>
  67. <artifactId>alipay-sdk-java</artifactId>
  68. <version>${alipay.sdk}</version>
  69. </dependency>
  70. <!-- springboot 2.2.2 -->
  71. <dependency>
  72. <groupId>org.springframework.boot</groupId>
  73. <artifactId>spring-boot-dependencies</artifactId>
  74. <version>2.2.0.RELEASE</version>
  75. <type>pom</type>
  76. <scope>import</scope>
  77. </dependency>
  78. <!-- springcloud cloud Hoxton.SR1 -->
  79. <dependency>
  80. <groupId>org.springframework.cloud</groupId>
  81. <artifactId>spring-cloud-dependencies</artifactId>
  82. <version>Hoxton.SR1</version>
  83. <type>pom</type>
  84. <scope>import</scope>
  85. </dependency>
  86. <!-- springcloud cloud alibaba 2.1.0.RELEASE -->
  87. <dependency>
  88. <groupId>com.alibaba.cloud</groupId>
  89. <artifactId>spring-cloud-alibaba-dependencies</artifactId>
  90. <version>2.1.0.RELEASE</version>
  91. <type>pom</type>
  92. <scope>import</scope>
  93. </dependency>
  94. <dependency>
  95. <groupId>mysql</groupId>
  96. <artifactId>mysql-connector-java</artifactId>
  97. <version>${mysql.version}</version>
  98. </dependency>
  99. <dependency>
  100. <groupId>com.alibaba</groupId>
  101. <artifactId>druid</artifactId>
  102. <version>${druid.version}</version>
  103. </dependency>
  104. <dependency>
  105. <groupId>log4j</groupId>
  106. <artifactId>log4j</artifactId>
  107. <version>${log4j.version}</version>
  108. </dependency>
  109. <dependency>
  110. <groupId>junit</groupId>
  111. <artifactId>junit</artifactId>
  112. <version>${junit.version}</version>
  113. </dependency>
  114. <!-- 构建Restful Api文档 -->
  115. <dependency>
  116. <groupId>io.springfox</groupId>
  117. <artifactId>springfox-swagger2</artifactId>
  118. <version>${springfox.swagger2}</version>
  119. </dependency>
  120. <!--引入swagger-ui包 -->
  121. <dependency>
  122. <groupId>io.springfox</groupId>
  123. <artifactId>springfox-swagger-ui</artifactId>
  124. <version>${springfox.swagger2}</version>
  125. </dependency>
  126. <!--引入swagger-bootstrap-ui包 -->
  127. <dependency>
  128. <groupId>com.github.xiaoymin</groupId>
  129. <artifactId>swagger-bootstrap-ui</artifactId>
  130. <version>${swagger.bootstrap}</version>
  131. </dependency>
  132. <dependency>
  133. <groupId>org.projectlombok</groupId>
  134. <artifactId>lombok</artifactId>
  135. <version>${lombok.version}</version>
  136. <optional>true</optional>
  137. </dependency>
  138. <!-- mybatis plus -->
  139. <dependency>
  140. <groupId>com.baomidou</groupId>
  141. <artifactId>mybatis-plus-boot-starter</artifactId>
  142. <version>${mybatis.plus}</version>
  143. </dependency>
  144. <dependency>
  145. <groupId>com.baomidou</groupId>
  146. <artifactId>mybatis-plus-generator</artifactId>
  147. <version>${mybatis.plus}</version>
  148. </dependency>
  149. <dependency>
  150. <groupId>org.apache.velocity</groupId>
  151. <artifactId>velocity-engine-core</artifactId>
  152. <version>${org.apache}</version>
  153. </dependency>
  154. <dependency>
  155. <groupId>org.apache.commons</groupId>
  156. <artifactId>commons-collections4</artifactId>
  157. <version>4.4</version>
  158. </dependency>
  159. </dependencies>
  160. </dependencyManagement>
  161. <build>
  162. <plugins>
  163. <plugin>
  164. <groupId>org.springframework.boot</groupId>
  165. <artifactId>spring-boot-maven-plugin</artifactId>
  166. <configuration>
  167. <!-- 指定该Main Class为全局的唯一入口 -->
  168. <mainClass>com.aiweiyun.appnews.AppnewsApplication</mainClass>
  169. <layout>ZIP</layout>
  170. </configuration>
  171. <executions>
  172. <execution>
  173. <goals>
  174. <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
  175. </goals>
  176. </execution>
  177. </executions>
  178. </plugin>
  179. </plugins>
  180. </build>
  181. </project>

子项目的pom.xml文件

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>com.aiweiyun</groupId>
  7. <artifactId>qixianfen</artifactId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. </parent>
  10. <groupId>com.aiweiyun</groupId>
  11. <artifactId>apporder</artifactId>
  12. <version>0.0.1-SNAPSHOT</version>
  13. <name>apporder</name>
  14. <description>Demo project for Spring Boot</description>
  15. <properties>
  16. <java.version>1.8</java.version>
  17. </properties>
  18. <dependencies>
  19. <dependency>
  20. <groupId>com.aliyun.oss</groupId>
  21. <artifactId>aliyun-sdk-oss</artifactId>
  22. <version>3.4.0</version>
  23. </dependency>
  24. <dependency>
  25. <groupId>cn.hutool</groupId>
  26. <artifactId>hutool-all</artifactId>
  27. <version>5.1.1</version>
  28. </dependency>
  29. <!--实名认证-->
  30. <dependency>
  31. <groupId>com.squareup.okhttp3</groupId>
  32. <artifactId>okhttp</artifactId>
  33. <version>3.13.1</version>
  34. </dependency>
  35. <!--Gson-->
  36. <dependency>
  37. <groupId>com.google.code.gson</groupId>
  38. <artifactId>gson</artifactId>
  39. <version>2.8.5</version>
  40. </dependency>
  41. <dependency>
  42. <groupId>com.github.wechatpay-apiv3</groupId>
  43. <artifactId>wechatpay-apache-httpclient</artifactId>
  44. <version>0.2.1</version>
  45. </dependency>
  46. <!--微信支付依赖-->
  47. <dependency>
  48. <groupId>com.github.wxpay</groupId>
  49. <artifactId>wxpay-sdk</artifactId>
  50. <version>0.0.3</version>
  51. </dependency>
  52. <dependency>
  53. <groupId>com.alipay.sdk</groupId>
  54. <artifactId>alipay-sdk-java</artifactId>
  55. </dependency>
  56. <dependency>
  57. <groupId>cn.hutool</groupId>
  58. <artifactId>hutool-all</artifactId>
  59. <version>5.1.1</version>
  60. </dependency>
  61. <dependency>
  62. <groupId>com.alibaba.cloud</groupId>
  63. <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
  64. </dependency>
  65. <!-- 构建Restful Api文档 -->
  66. <dependency>
  67. <groupId>io.springfox</groupId>
  68. <artifactId>springfox-swagger2</artifactId>
  69. </dependency>
  70. <dependency>
  71. <groupId>org.springframework.cloud</groupId>
  72. <artifactId>spring-cloud-starter-openfeign</artifactId>
  73. </dependency>
  74. <!--引入swagger-ui包 -->
  75. <dependency>
  76. <groupId>io.springfox</groupId>
  77. <artifactId>springfox-swagger-ui</artifactId>
  78. </dependency>
  79. <!--引入swagger-bootstrap-ui包 -->
  80. <dependency>
  81. <groupId>com.github.xiaoymin</groupId>
  82. <artifactId>swagger-bootstrap-ui</artifactId>
  83. </dependency>
  84. <!--阿里巴巴druid-->
  85. <dependency>
  86. <groupId>com.alibaba</groupId>
  87. <artifactId>druid-spring-boot-starter</artifactId>
  88. <version>1.1.21</version>
  89. </dependency>
  90. <dependency>
  91. <groupId>org.projectlombok</groupId>
  92. <artifactId>lombok</artifactId>
  93. <optional>true</optional>
  94. </dependency>
  95. <!-- mysql -->
  96. <dependency>
  97. <groupId>mysql</groupId>
  98. <artifactId>mysql-connector-java</artifactId>
  99. </dependency>
  100. <!-- mybatis plus -->
  101. <dependency>
  102. <groupId>com.baomidou</groupId>
  103. <artifactId>mybatis-plus-boot-starter</artifactId>
  104. </dependency>
  105. <dependency>
  106. <groupId>com.baomidou</groupId>
  107. <artifactId>mybatis-plus-generator</artifactId>
  108. </dependency>
  109. <dependency>
  110. <groupId>org.apache.velocity</groupId>
  111. <artifactId>velocity-engine-core</artifactId>
  112. </dependency>
  113. <!-- &lt;!&ndash; 后续做持久化用到 &ndash;&gt;-->
  114. <!-- <dependency>-->
  115. <!-- <groupId>com.alibaba.csp</groupId>-->
  116. <!-- <artifactId>sentinel-datasource-nacos</artifactId>-->
  117. <!-- </dependency>-->
  118. <!-- &lt;!&ndash; sentinel &ndash;&gt;-->
  119. <!-- <dependency>-->
  120. <!-- <groupId>com.alibaba.cloud</groupId>-->
  121. <!-- <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>-->
  122. <!-- </dependency>-->
  123. <!-- &lt;!&ndash; openfeign &ndash;&gt;-->
  124. <!-- <dependency>-->
  125. <!-- <groupId>org.springframework.cloud</groupId>-->
  126. <!-- <artifactId>spring-cloud-starter-openfeign</artifactId>-->
  127. <!-- </dependency>-->
  128. <dependency>
  129. <groupId>org.springframework.boot</groupId>
  130. <artifactId>spring-boot-starter-data-redis</artifactId>
  131. </dependency>
  132. <!-- web组件 -->
  133. <dependency>
  134. <groupId>org.springframework.boot</groupId>
  135. <artifactId>spring-boot-starter-web</artifactId>
  136. </dependency>
  137. <dependency>
  138. <groupId>org.springframework.boot</groupId>
  139. <artifactId>spring-boot-starter-actuator</artifactId>
  140. </dependency>
  141. <dependency>
  142. <groupId>org.springframework.boot</groupId>
  143. <artifactId>spring-boot-devtools</artifactId>
  144. <scope>runtime</scope>
  145. <optional>true</optional>
  146. </dependency>
  147. <dependency>
  148. <groupId>org.springframework.boot</groupId>
  149. <artifactId>spring-boot-starter-test</artifactId>
  150. <scope>test</scope>
  151. </dependency>
  152. <dependency>
  153. <groupId>com.belerweb</groupId>
  154. <artifactId>pinyin4j</artifactId>
  155. <version>2.5.1</version>
  156. </dependency>
  157. </dependencies>
  158. <build>
  159. <plugins>
  160. <plugin>
  161. <groupId>org.springframework.boot</groupId>
  162. <artifactId>spring-boot-maven-plugin</artifactId>
  163. <configuration>
  164. <!-- 指定该Main Class为全局的唯一入口 -->
  165. <mainClass>com.aiweiyun.apporder.ApporderApplication</mainClass>
  166. <layout>ZIP</layout>
  167. </configuration>
  168. <executions>
  169. <execution>
  170. <goals>
  171. <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
  172. </goals>
  173. </execution>
  174. </executions>
  175. </plugin>
  176. </plugins>
  177. </build>
  178. </project>

mapper.xml的配置文件

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.aiweiyun.apporder.mapper.CCustomerOrederMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.aiweiyun.apporder.entity.CCustomerOreder">
  6. <id column="id" property="id" />
  7. <result column="type" property="type" />
  8. <result column="price" property="price" />
  9. <result column="name" property="name" />
  10. <result column="pay_type" property="payType" />
  11. <result column="customer_id" property="customerId" />
  12. <result column="good_id" property="goodId" />
  13. <result column="create_time" property="createTime" />
  14. <result column="update_time" property="updateTime" />
  15. <result column="url" property="url" />
  16. <result column="status" property="status" />
  17. </resultMap>
  18. <select id="getVipPrice" resultType="java.lang.Integer">
  19. SELECT `standard` FROM c_vip_config WHERE state = 1 and type = 4 and time = #{time} Limit 1
  20. </select>
  21. </mapper>