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: db-config:
#主键类型 #主键类型
id-type: ASSIGN_ID id-type: ASSIGN_ID
#逻辑删除配置
logic-delete-value: 0
logic-not-delete-value: 1
logic-delete-field: valid
banner: false banner: false
#原生配置 #原生配置
configuration: configuration:

View File

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