From 45ac3a39b4b88e9a7f2fe1ccdc2f791e6f4ec4e5 Mon Sep 17 00:00:00 2001 From: Suomm <1474983351@qq.com> Date: Wed, 2 Aug 2023 20:53:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codegen/config/ServiceImplConfig.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java index 59c1858d..3eafaf45 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java @@ -15,9 +15,6 @@ */ package com.mybatisflex.codegen.config; -import com.mybatisflex.spring.service.impl.CacheableServiceImpl; -import com.mybatisflex.spring.service.impl.ServiceImpl; - /** * 生成 ServiceImpl 的配置。 * @@ -40,7 +37,7 @@ public class ServiceImplConfig { /** * 自定义 ServiceImpl 的父类。 */ - private Class superClass = ServiceImpl.class; + private Class superClass; /** * 是否覆盖之前生成的文件。 @@ -53,10 +50,16 @@ public class ServiceImplConfig { private boolean cacheExample; public String buildSuperClassImport() { + if (superClass == null) { + return "com.mybatisflex.spring.service.impl.ServiceImpl"; + } return superClass.getName(); } public String buildSuperClassName() { + if (superClass == null) { + return "ServiceImpl"; + } return superClass.getSimpleName(); } @@ -124,7 +127,7 @@ public class ServiceImplConfig { * 是否生成缓存例子。 */ public boolean isCacheExample() { - return CacheableServiceImpl.class.equals(superClass) && cacheExample; + return cacheExample; } /** @@ -135,4 +138,4 @@ public class ServiceImplConfig { return this; } -} \ No newline at end of file +}