删除mybatis-flex.config文件,使用mybatis-flex的默认APT配置

This commit is contained in:
dataprince 2023-09-10 10:54:42 +08:00
parent 687564f377
commit 01f30b9e89
4 changed files with 2 additions and 215 deletions

View File

@ -1,13 +0,0 @@
# 自定义 TableDef 的字段风格upperCamelCase为首字母大写的驼峰命名例如UserName
# upperCase, lowerCase, upperCamelCase, lowerCamelCase
processor.tableDef.propertiesNameStyle = upperCamelCase
# APT开启Mapper生成 从 v1.1.9 开始, APT 的 Mapper 自动生成 功能是关闭的
processor.mappersGenerateEnable = false
# 自定义 Mapper 的父类
#processor.mapper.baseClass = com.ruoyi.mapper.FlexBaseMapper

View File

@ -1,14 +1,5 @@
package com.ruoyi.common.orm.config;
//import cn.hutool.core.net.NetUtil;
//import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
//import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
//import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
//import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
//import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
//import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
//import org.dromara.common.mybatis.handler.InjectionMetaObjectHandler;
//import org.dromara.common.mybatis.interceptor.PlusDataPermissionInterceptor;
import com.mybatisflex.core.audit.AuditManager;
import com.mybatisflex.core.datasource.DataSourceDecipher;
import com.ruoyi.common.orm.decipher.Decipher;
@ -40,7 +31,7 @@ public class MyBatisFlexConfig {
//设置 SQL 审计收集器
AuditManager.setMessageCollector(auditMessage ->
logger.info("{},{}ms", auditMessage.getFullSql()
logger.info("{},耗费{}ms", auditMessage.getFullSql()
, auditMessage.getElapsedTime())
);
}

View File

@ -14,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
public class MyConfigurationCustomizer implements ConfigurationCustomizer {
@Override
public void customize(FlexConfiguration configuration) {
//mybatis实现的打印sql到控制台便于调试
configuration.setLogImpl(StdOutImpl.class);
}
}

View File

@ -1,192 +0,0 @@
package com.ruoyi.common.orm.core.mapper;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.mybatisflex.core.BaseMapper;
import com.ruoyi.common.core.utils.MapstructUtils;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 自定义 Mapper 接口, 实现 自定义扩展
*
* @param <T> table 泛型
* @param <V> vo 泛型
* @author Lion Li
* @since 2021-05-13
*/
@SuppressWarnings("unchecked")
public interface BaseMapperFlex<T, V> extends BaseMapper<T> {
Log log = LogFactory.getLog(BaseMapperFlex.class);
// default Class<V> currentVoClass() {
// return (Class<V>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseMapperFlex.class, 1);
// }
//
// default Class<T> currentModelClass() {
// return (Class<T>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseMapperFlex.class, 0);
// }
//
// default List<T> selectList() {
// return this.selectList(new QueryWrapper<>());
// }
//
// /**
// * 批量插入
// */
// default boolean insertBatch(Collection<T> entityList) {
// return Db.saveBatch(entityList);
// }
//
// /**
// * 批量更新
// */
// default boolean updateBatchById(Collection<T> entityList) {
// return Db.updateBatchById(entityList);
// }
//
// /**
// * 批量插入或更新
// */
// default boolean insertOrUpdateBatch(Collection<T> entityList) {
// return Db.saveOrUpdateBatch(entityList);
// }
//
// /**
// * 批量插入(包含限制条数)
// */
// default boolean insertBatch(Collection<T> entityList, int batchSize) {
// return Db.saveBatch(entityList, batchSize);
// }
//
// /**
// * 批量更新(包含限制条数)
// */
// default boolean updateBatchById(Collection<T> entityList, int batchSize) {
// return Db.updateBatchById(entityList, batchSize);
// }
//
// /**
// * 批量插入或更新(包含限制条数)
// */
// default boolean insertOrUpdateBatch(Collection<T> entityList, int batchSize) {
// return Db.saveOrUpdateBatch(entityList, batchSize);
// }
//
// /**
// * 插入或更新(包含限制条数)
// */
// default boolean insertOrUpdate(T entity) {
// return Db.saveOrUpdate(entity);
// }
//
// default V selectVoById(Serializable id) {
// return selectVoById(id, this.currentVoClass());
// }
//
// /**
// * 根据 ID 查询
// */
// default <C> C selectVoById(Serializable id, Class<C> voClass) {
// T obj = this.selectById(id);
// if (ObjectUtil.isNull(obj)) {
// return null;
// }
// return MapstructUtils.convert(obj, voClass);
// }
//
// default List<V> selectVoBatchIds(Collection<? extends Serializable> idList) {
// return selectVoBatchIds(idList, this.currentVoClass());
// }
//
// /**
// * 查询根据ID 批量查询
// */
// default <C> List<C> selectVoBatchIds(Collection<? extends Serializable> idList, Class<C> voClass) {
// List<T> list = this.selectBatchIds(idList);
// if (CollUtil.isEmpty(list)) {
// return CollUtil.newArrayList();
// }
// return MapstructUtils.convert(list, voClass);
// }
//
// default List<V> selectVoByMap(Map<String, Object> map) {
// return selectVoByMap(map, this.currentVoClass());
// }
//
// /**
// * 查询根据 columnMap 条件
// */
// default <C> List<C> selectVoByMap(Map<String, Object> map, Class<C> voClass) {
// List<T> list = this.selectByMap(map);
// if (CollUtil.isEmpty(list)) {
// return CollUtil.newArrayList();
// }
// return MapstructUtils.convert(list, voClass);
// }
//
// default V selectVoOne(Wrapper<T> wrapper) {
// return selectVoOne(wrapper, this.currentVoClass());
// }
//
// /**
// * 根据 entity 条件查询一条记录
// */
// default <C> C selectVoOne(Wrapper<T> wrapper, Class<C> voClass) {
// T obj = this.selectOne(wrapper);
// if (ObjectUtil.isNull(obj)) {
// return null;
// }
// return MapstructUtils.convert(obj, voClass);
// }
//
// default List<V> selectVoList() {
// return selectVoList(new QueryWrapper<>(), this.currentVoClass());
// }
//
// default List<V> selectVoList(Wrapper<T> wrapper) {
// return selectVoList(wrapper, this.currentVoClass());
// }
//
// /**
// * 根据 entity 条件查询全部记录
// */
// default <C> List<C> selectVoList(Wrapper<T> wrapper, Class<C> voClass) {
// List<T> list = this.selectList(wrapper);
// if (CollUtil.isEmpty(list)) {
// return CollUtil.newArrayList();
// }
// return MapstructUtils.convert(list, voClass);
// }
//
// default <P extends IPage<V>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper) {
// return selectVoPage(page, wrapper, this.currentVoClass());
// }
//
// /**
// * 分页查询VO
// */
// default <C, P extends IPage<C>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper, Class<C> voClass) {
// IPage<T> pageData = this.selectPage(page, wrapper);
// IPage<C> voPage = new Page<>(pageData.getCurrent(), pageData.getSize(), pageData.getTotal());
// if (CollUtil.isEmpty(pageData.getRecords())) {
// return (P) voPage;
// }
// voPage.setRecords(MapstructUtils.convert(pageData.getRecords(), voClass));
// return (P) voPage;
// }
//
// default <C> List<C> selectObjs(Wrapper<T> wrapper, Function<? super Object, C> mapper) {
// return this.selectObjs(wrapper).stream().filter(Objects::nonNull).map(mapper).collect(Collectors.toList());
// }
}