From cd1d203d875aab0400c546f8441812ecec88a5b8 Mon Sep 17 00:00:00 2001 From: Lin-XCC <754310653@QQ.COM> Date: Tue, 5 Jul 2022 10:44:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=BB=E8=BE=91=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 逻辑删除实现,修改了生成器和yml --- ym-gateway/src/main/resources/application.yml | 4 ++++ .../cnbm/generator/build/CodeGenerator.java | 18 +++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) 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 -> {