diff --git a/ym-gateway/src/main/resources/application.yml b/ym-gateway/src/main/resources/application.yml index 3d651ce..d3ab12d 100644 --- a/ym-gateway/src/main/resources/application.yml +++ b/ym-gateway/src/main/resources/application.yml @@ -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: diff --git a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java index a133634..1b2682c 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java +++ b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java @@ -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 -> {