优化 activiti 的配置,简单 Mapper XML 的配置,且减少 Mapper 的 SQL 日志的输出~

This commit is contained in:
YunaiV 2022-01-16 02:55:25 +08:00
parent db3c713122
commit 94c115a142
4 changed files with 15 additions and 80 deletions

View File

@ -148,6 +148,18 @@ spring:
logging:
file:
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
level:
# 配置自己写的 MyBatis Mapper 打印日志
cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql: debug
cn.iocoder.yudao.adminserver.modules.infra.dal.mysql: debug
cn.iocoder.yudao.adminserver.modules.pay.dal.mysql: debug
cn.iocoder.yudao.adminserver.modules.system.dal.mysql: debug
cn.iocoder.yudao.adminserver.modules.tool.dal.mysql: debug
cn.iocoder.yudao.coreservice.modules.bpm.dal.mysql: debug
cn.iocoder.yudao.coreservice.modules.infra.dal.mysql: debug
cn.iocoder.yudao.coreservice.modules.pay.dal.mysql: debug
cn.iocoder.yudao.coreservice.modules.system.dal.mysql: debug
cn.iocoder.yudao.coreservice.modules.tool.dal.mysql: debug
--- #################### 芋道相关配置 ####################
@ -194,3 +206,4 @@ justauth:
type: REDIS
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟

View File

@ -35,28 +35,13 @@ spring:
# MyBatis Plus 的配置项
mybatis-plus:
# 在 mybatis-config/mybatis-config.xml 中设置 TODO jason看看有没其它解决方案
# configuration:
# map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印日志
configuration:
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
global-config:
db-config:
id-type: AUTO # 自增 ID
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
mapper-locations: classpath*:mapper/*.xml
config-location: classpath:mybatis-config/mybatis-config.xml
configuration-properties:
prefix: ""
wildcardEscapeClause: ""
limitBefore: ""
limitAfter: "LIMIT #{maxResults} OFFSET #{firstResult}"
limitBetween: ""
limitOuterJoinBetween: ""
limitBeforeNativeQuery: ""
orderBy: "order by ${orderByColumns}"
blobType: "BLOB"
boolValue: "TRUE"
type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject, ${yudao.core-service.base-package}.modules.*.dal.dataobject
--- #################### 芋道相关配置 ####################

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="lazyLoadingEnabled" value="false" />
<setting name="mapUnderscoreToCamelCase" value="true"/>
<setting name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl"/> <!-- 如果不想打 SQL 日志,可以注释掉 -->
</settings>
<typeAliases>
<typeAlias type="org.activiti.engine.impl.persistence.ByteArrayRefTypeHandler" alias="ByteArrayRefTypeHandler"/>
<typeAlias type="org.activiti.engine.impl.db.IbatisVariableTypeHandler" alias="IbatisVariableTypeHandler"/>
</typeAliases>
<typeHandlers>
<typeHandler handler="ByteArrayRefTypeHandler"
javaType="org.activiti.engine.impl.persistence.entity.ByteArrayRef"
jdbcType="VARCHAR"/>
<typeHandler handler="IbatisVariableTypeHandler"
javaType="org.activiti.engine.impl.variable.VariableType"
jdbcType="VARCHAR"/>
</typeHandlers>
<mappers>
<mapper resource="org/activiti/db/mapping/common.xml" />
<mapper resource="org/activiti/db/mapping/entity/Attachment.xml" />
<mapper resource="org/activiti/db/mapping/entity/ByteArray.xml" />
<mapper resource="org/activiti/db/mapping/entity/Comment.xml" />
<mapper resource="org/activiti/db/mapping/entity/DeadLetterJob.xml" />
<mapper resource="org/activiti/db/mapping/entity/Deployment.xml" />
<mapper resource="org/activiti/db/mapping/entity/Execution.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricActivityInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricDetail.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricProcessInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricVariableInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricTaskInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/HistoricIdentityLink.xml" />
<mapper resource="org/activiti/db/mapping/entity/IdentityLink.xml" />
<mapper resource="org/activiti/db/mapping/entity/Job.xml" />
<mapper resource="org/activiti/db/mapping/entity/Model.xml" />
<mapper resource="org/activiti/db/mapping/entity/ProcessDefinition.xml" />
<mapper resource="org/activiti/db/mapping/entity/ProcessDefinitionInfo.xml" />
<mapper resource="org/activiti/db/mapping/entity/Property.xml" />
<mapper resource="org/activiti/db/mapping/entity/Resource.xml" />
<mapper resource="org/activiti/db/mapping/entity/SuspendedJob.xml" />
<mapper resource="org/activiti/db/mapping/entity/TableData.xml" />
<mapper resource="org/activiti/db/mapping/entity/Task.xml" />
<mapper resource="org/activiti/db/mapping/entity/TimerJob.xml" />
<mapper resource="org/activiti/db/mapping/entity/VariableInstance.xml" />
<mapper resource="org/activiti/db/mapping/entity/EventSubscription.xml" />
<mapper resource="org/activiti/db/mapping/entity/EventLogEntry.xml" />
<mapper resource="org/activiti/db/mapping/entity/IntegrationContext.xml" />
</mappers>
</configuration>

View File

@ -4,8 +4,6 @@ import cn.iocoder.yudao.framework.activiti.core.web.ActivitiWebFilter;
import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
import org.activiti.image.ProcessDiagramGenerator;
import org.activiti.image.impl.DefaultProcessDiagramGenerator;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -21,14 +19,6 @@ public class YudaoActivitiConfiguration {
return new DefaultProcessDiagramGenerator();
}
/**
* ProcessEngineConfigurationConfigurer 实现类设置使用 MyBatis SqlSessionFactory
*/
@Bean
public ProcessEngineConfigurationConfigurer processEngineConfigurationConfigurer(SqlSessionFactory sqlSessionFactory) {
return springProcessEngineConfiguration -> springProcessEngineConfiguration.setSqlSessionFactory(sqlSessionFactory);
}
@Bean
public FilterRegistrationBean<ActivitiWebFilter> activitiWebFilter() {
FilterRegistrationBean<ActivitiWebFilter> registrationBean = new FilterRegistrationBean<>();