feat: 逻辑删除

逻辑删除实现,修改了生成器和yml
This commit is contained in:
徐晨晨 2022-07-05 10:44:09 +08:00
parent 1f85905317
commit cd1d203d87
2 changed files with 9 additions and 13 deletions

View File

@ -58,6 +58,10 @@ mybatis-plus:
db-config:
#主键类型
id-type: ASSIGN_ID
#逻辑删除配置
logic-delete-value: 0
logic-not-delete-value: 1
logic-delete-field: valid
banner: false
#原生配置
configuration:

View File

@ -1,23 +1,13 @@
package com.cnbm.generator.build;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import com.baomidou.mybatisplus.generator.function.ConverterFileName;
import com.cnbm.generator.config.DataConfig;
import com.cnbm.generator.engine.EnhanceVelocityTemplateEngine;
import com.cnbm.generator.utils.IdWorker;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.*;
import java.util.function.BiConsumer;
import static com.baomidou.mybatisplus.generator.config.ConstVal.MODULE_NAME;
import java.util.HashMap;
import java.util.Map;
/**
* @Author weihongyang
@ -63,7 +53,9 @@ public class CodeGenerator {
//设置需要生成的表名
builder.addInclude(include)
//设置过滤表前缀
.addTablePrefix("sys_");
.addTablePrefix("sys_")
//添加逻辑删除列
.entityBuilder().logicDeleteColumnName("valid").build();
})
.injectionConfig(consumer -> {