Commit 94c115a142e2a9e7fcc3c33dc8f09ccd9d3585d2
1 parent
db3c7131
优化 activiti 的配置,简单 Mapper XML 的配置,且减少 Mapper 的 SQL 日志的输出~
Showing
4 changed files
with
15 additions
and
80 deletions
yudao-admin-server/src/main/resources/application-local.yaml
| @@ -148,6 +148,18 @@ spring: | @@ -148,6 +148,18 @@ spring: | ||
| 148 | logging: | 148 | logging: |
| 149 | file: | 149 | file: |
| 150 | name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 | 150 | name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 |
| 151 | + level: | ||
| 152 | + # 配置自己写的 MyBatis Mapper 打印日志 | ||
| 153 | + cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql: debug | ||
| 154 | + cn.iocoder.yudao.adminserver.modules.infra.dal.mysql: debug | ||
| 155 | + cn.iocoder.yudao.adminserver.modules.pay.dal.mysql: debug | ||
| 156 | + cn.iocoder.yudao.adminserver.modules.system.dal.mysql: debug | ||
| 157 | + cn.iocoder.yudao.adminserver.modules.tool.dal.mysql: debug | ||
| 158 | + cn.iocoder.yudao.coreservice.modules.bpm.dal.mysql: debug | ||
| 159 | + cn.iocoder.yudao.coreservice.modules.infra.dal.mysql: debug | ||
| 160 | + cn.iocoder.yudao.coreservice.modules.pay.dal.mysql: debug | ||
| 161 | + cn.iocoder.yudao.coreservice.modules.system.dal.mysql: debug | ||
| 162 | + cn.iocoder.yudao.coreservice.modules.tool.dal.mysql: debug | ||
| 151 | 163 | ||
| 152 | --- #################### 芋道相关配置 #################### | 164 | --- #################### 芋道相关配置 #################### |
| 153 | 165 | ||
| @@ -194,3 +206,4 @@ justauth: | @@ -194,3 +206,4 @@ justauth: | ||
| 194 | type: REDIS | 206 | type: REDIS |
| 195 | prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: | 207 | prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: |
| 196 | timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 | 208 | timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 |
| 209 | + |
yudao-admin-server/src/main/resources/application.yaml
| @@ -35,28 +35,13 @@ spring: | @@ -35,28 +35,13 @@ spring: | ||
| 35 | 35 | ||
| 36 | # MyBatis Plus 的配置项 | 36 | # MyBatis Plus 的配置项 |
| 37 | mybatis-plus: | 37 | mybatis-plus: |
| 38 | -# 在 mybatis-config/mybatis-config.xml 中设置 TODO jason:看看有没其它解决方案 | ||
| 39 | -# configuration: | ||
| 40 | -# map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 | ||
| 41 | -# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志 | 38 | + configuration: |
| 39 | + map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 | ||
| 42 | global-config: | 40 | global-config: |
| 43 | db-config: | 41 | db-config: |
| 44 | id-type: AUTO # 自增 ID | 42 | id-type: AUTO # 自增 ID |
| 45 | logic-delete-value: 1 # 逻辑已删除值(默认为 1) | 43 | logic-delete-value: 1 # 逻辑已删除值(默认为 1) |
| 46 | logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) | 44 | logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) |
| 47 | - mapper-locations: classpath*:mapper/*.xml | ||
| 48 | - config-location: classpath:mybatis-config/mybatis-config.xml | ||
| 49 | - configuration-properties: | ||
| 50 | - prefix: "" | ||
| 51 | - wildcardEscapeClause: "" | ||
| 52 | - limitBefore: "" | ||
| 53 | - limitAfter: "LIMIT #{maxResults} OFFSET #{firstResult}" | ||
| 54 | - limitBetween: "" | ||
| 55 | - limitOuterJoinBetween: "" | ||
| 56 | - limitBeforeNativeQuery: "" | ||
| 57 | - orderBy: "order by ${orderByColumns}" | ||
| 58 | - blobType: "BLOB" | ||
| 59 | - boolValue: "TRUE" | ||
| 60 | type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject, ${yudao.core-service.base-package}.modules.*.dal.dataobject | 45 | type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject, ${yudao.core-service.base-package}.modules.*.dal.dataobject |
| 61 | 46 | ||
| 62 | --- #################### 芋道相关配置 #################### | 47 | --- #################### 芋道相关配置 #################### |
yudao-admin-server/src/main/resources/mybatis-config/mybatis-config.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | - | ||
| 3 | -<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
| 4 | - | ||
| 5 | -<configuration> | ||
| 6 | - <settings> | ||
| 7 | - <setting name="lazyLoadingEnabled" value="false" /> | ||
| 8 | - <setting name="mapUnderscoreToCamelCase" value="true"/> | ||
| 9 | - <setting name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl"/> <!-- 如果不想打 SQL 日志,可以注释掉 --> | ||
| 10 | - </settings> | ||
| 11 | - <typeAliases> | ||
| 12 | - <typeAlias type="org.activiti.engine.impl.persistence.ByteArrayRefTypeHandler" alias="ByteArrayRefTypeHandler"/> | ||
| 13 | - <typeAlias type="org.activiti.engine.impl.db.IbatisVariableTypeHandler" alias="IbatisVariableTypeHandler"/> | ||
| 14 | - </typeAliases> | ||
| 15 | - <typeHandlers> | ||
| 16 | - <typeHandler handler="ByteArrayRefTypeHandler" | ||
| 17 | - javaType="org.activiti.engine.impl.persistence.entity.ByteArrayRef" | ||
| 18 | - jdbcType="VARCHAR"/> | ||
| 19 | - <typeHandler handler="IbatisVariableTypeHandler" | ||
| 20 | - javaType="org.activiti.engine.impl.variable.VariableType" | ||
| 21 | - jdbcType="VARCHAR"/> | ||
| 22 | - </typeHandlers> | ||
| 23 | - <mappers> | ||
| 24 | - <mapper resource="org/activiti/db/mapping/common.xml" /> | ||
| 25 | - <mapper resource="org/activiti/db/mapping/entity/Attachment.xml" /> | ||
| 26 | - <mapper resource="org/activiti/db/mapping/entity/ByteArray.xml" /> | ||
| 27 | - <mapper resource="org/activiti/db/mapping/entity/Comment.xml" /> | ||
| 28 | - <mapper resource="org/activiti/db/mapping/entity/DeadLetterJob.xml" /> | ||
| 29 | - <mapper resource="org/activiti/db/mapping/entity/Deployment.xml" /> | ||
| 30 | - <mapper resource="org/activiti/db/mapping/entity/Execution.xml" /> | ||
| 31 | - <mapper resource="org/activiti/db/mapping/entity/HistoricActivityInstance.xml" /> | ||
| 32 | - <mapper resource="org/activiti/db/mapping/entity/HistoricDetail.xml" /> | ||
| 33 | - <mapper resource="org/activiti/db/mapping/entity/HistoricProcessInstance.xml" /> | ||
| 34 | - <mapper resource="org/activiti/db/mapping/entity/HistoricVariableInstance.xml" /> | ||
| 35 | - <mapper resource="org/activiti/db/mapping/entity/HistoricTaskInstance.xml" /> | ||
| 36 | - <mapper resource="org/activiti/db/mapping/entity/HistoricIdentityLink.xml" /> | ||
| 37 | - <mapper resource="org/activiti/db/mapping/entity/IdentityLink.xml" /> | ||
| 38 | - <mapper resource="org/activiti/db/mapping/entity/Job.xml" /> | ||
| 39 | - <mapper resource="org/activiti/db/mapping/entity/Model.xml" /> | ||
| 40 | - <mapper resource="org/activiti/db/mapping/entity/ProcessDefinition.xml" /> | ||
| 41 | - <mapper resource="org/activiti/db/mapping/entity/ProcessDefinitionInfo.xml" /> | ||
| 42 | - <mapper resource="org/activiti/db/mapping/entity/Property.xml" /> | ||
| 43 | - <mapper resource="org/activiti/db/mapping/entity/Resource.xml" /> | ||
| 44 | - <mapper resource="org/activiti/db/mapping/entity/SuspendedJob.xml" /> | ||
| 45 | - <mapper resource="org/activiti/db/mapping/entity/TableData.xml" /> | ||
| 46 | - <mapper resource="org/activiti/db/mapping/entity/Task.xml" /> | ||
| 47 | - <mapper resource="org/activiti/db/mapping/entity/TimerJob.xml" /> | ||
| 48 | - <mapper resource="org/activiti/db/mapping/entity/VariableInstance.xml" /> | ||
| 49 | - <mapper resource="org/activiti/db/mapping/entity/EventSubscription.xml" /> | ||
| 50 | - <mapper resource="org/activiti/db/mapping/entity/EventLogEntry.xml" /> | ||
| 51 | - <mapper resource="org/activiti/db/mapping/entity/IntegrationContext.xml" /> | ||
| 52 | - </mappers> | ||
| 53 | -</configuration> |
yudao-framework/yudao-spring-boot-starter-activiti/src/main/java/cn/iocoder/yudao/framework/activiti/config/YudaoActivitiConfiguration.java
| @@ -4,8 +4,6 @@ import cn.iocoder.yudao.framework.activiti.core.web.ActivitiWebFilter; | @@ -4,8 +4,6 @@ import cn.iocoder.yudao.framework.activiti.core.web.ActivitiWebFilter; | ||
| 4 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; | 4 | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; |
| 5 | import org.activiti.image.ProcessDiagramGenerator; | 5 | import org.activiti.image.ProcessDiagramGenerator; |
| 6 | import org.activiti.image.impl.DefaultProcessDiagramGenerator; | 6 | import org.activiti.image.impl.DefaultProcessDiagramGenerator; |
| 7 | -import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer; | ||
| 8 | -import org.apache.ibatis.session.SqlSessionFactory; | ||
| 9 | import org.springframework.boot.web.servlet.FilterRegistrationBean; | 7 | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| 10 | import org.springframework.context.annotation.Bean; | 8 | import org.springframework.context.annotation.Bean; |
| 11 | import org.springframework.context.annotation.Configuration; | 9 | import org.springframework.context.annotation.Configuration; |
| @@ -21,14 +19,6 @@ public class YudaoActivitiConfiguration { | @@ -21,14 +19,6 @@ public class YudaoActivitiConfiguration { | ||
| 21 | return new DefaultProcessDiagramGenerator(); | 19 | return new DefaultProcessDiagramGenerator(); |
| 22 | } | 20 | } |
| 23 | 21 | ||
| 24 | - /** | ||
| 25 | - * ProcessEngineConfigurationConfigurer 实现类,设置使用 MyBatis SqlSessionFactory | ||
| 26 | - */ | ||
| 27 | - @Bean | ||
| 28 | - public ProcessEngineConfigurationConfigurer processEngineConfigurationConfigurer(SqlSessionFactory sqlSessionFactory) { | ||
| 29 | - return springProcessEngineConfiguration -> springProcessEngineConfiguration.setSqlSessionFactory(sqlSessionFactory); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | @Bean | 22 | @Bean |
| 33 | public FilterRegistrationBean<ActivitiWebFilter> activitiWebFilter() { | 23 | public FilterRegistrationBean<ActivitiWebFilter> activitiWebFilter() { |
| 34 | FilterRegistrationBean<ActivitiWebFilter> registrationBean = new FilterRegistrationBean<>(); | 24 | FilterRegistrationBean<ActivitiWebFilter> registrationBean = new FilterRegistrationBean<>(); |