From 105c991259fab1110bfc916e895568f38f19fde5 Mon Sep 17 00:00:00 2001 From: tanghanzheng Date: Fri, 2 Jun 2023 17:14:18 +0800 Subject: [PATCH] concept cloud plugin generate code action --- .../plugin/intellij/GenerateCodeAction.java | 13 + .../intellij/GenerateModuleCodeAction.java | 12 +- .../plugin/intellij/builder/JavaBuilder.kt | 94 ++++--- .../intellij/module/ModuleFileGenerator.kt | 237 +++++++++++++++--- .../$PACKAGE$/token/TokenWebInterceptor.java | 1 + .../pluginew/java/1.0.0/build.gradle | 6 +- .../pluginew/java/1.0.0/template.zip | Bin 195279 -> 195291 bytes concept-cloud/pluginew/starter_new.json | 8 +- 8 files changed, 300 insertions(+), 71 deletions(-) diff --git a/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateCodeAction.java b/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateCodeAction.java index 34b9fb230..3bb01575c 100644 --- a/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateCodeAction.java +++ b/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateCodeAction.java @@ -47,6 +47,19 @@ public static class Context { String userClassName; Object model; + + public void withParentPackage() { + if (psiPackage == null || path == null) { + return; + } + PsiPackage parentPackage = psiPackage.getParentPackage(); + File parentFile = new File(path).getParentFile(); + if (parentPackage == null || parentFile == null) { + return; + } + psiPackage = parentPackage; + path = parentFile.getPath(); + } } @Override diff --git a/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateModuleCodeAction.java b/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateModuleCodeAction.java index f34fcd500..7315c5e6b 100644 --- a/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateModuleCodeAction.java +++ b/concept-cloud/concept-cloud-plugin-intellij/src/main/java/com/github/linyuzai/cloud/plugin/intellij/GenerateModuleCodeAction.java @@ -60,9 +60,12 @@ public DialogBuilder createDialogBuilder(Context context) { String domainRepositoryClassName = domainRepositoryClass == null ? "" : domainRepositoryClass.getQualifiedName(); + context.withParentPackage();//to domain + context.withParentPackage();//to module + final ModuleModel model = new ModuleModel(context.userClassName, loginAnnotationClassName == null ? "" : loginAnnotationClassName, - context.selectModule, context.fullPackage, + context.selectModule, getModulePackage(context.psiPackage), domainObjectClassName == null ? "" : domainObjectClassName, domainCollectionClassName == null ? "" : domainCollectionClassName, domainServiceClassName == null ? "" : domainServiceClassName, @@ -74,6 +77,13 @@ public DialogBuilder createDialogBuilder(Context context) { return ModuleComponents.createGenerateModuleCodeDialog(context.project, model, getDialogTitle()); } + private String getModulePackage(PsiPackage psiPackage) { + if (psiPackage == null) { + return ""; + } + return psiPackage.getQualifiedName(); + } + private String getDomainDescriptionByComment(PsiClass psiClass) { if (psiClass == null) { return ""; diff --git a/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/builder/JavaBuilder.kt b/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/builder/JavaBuilder.kt index 66049c670..ef65004bd 100644 --- a/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/builder/JavaBuilder.kt +++ b/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/builder/JavaBuilder.kt @@ -14,8 +14,12 @@ const val ANNOTATION_DELETE_MAPPING = "org.springframework.web.bind.annotation.D const val ANNOTATION_GET_MAPPING = "org.springframework.web.bind.annotation.GetMapping" const val ANNOTATION_PATH_VARIABLE = "org.springframework.web.bind.annotation.PathVariable" const val ANNOTATION_SERVICE = "org.springframework.stereotype.Service" +const val ANNOTATION_REPOSITORY = "org.springframework.stereotype.Repository" const val ANNOTATION_COMPONENT = "org.springframework.stereotype.Component" const val ANNOTATION_AUTOWIRED = "org.springframework.beans.factory.annotation.Autowired" +const val ANNOTATION_CONFIGURATION = "org.springframework.context.annotation.Configuration" +const val ANNOTATION_BEAN = "org.springframework.context.annotation.Bean" +const val ANNOTATION_CONDITIONAL_ON_MISSING_BEAN = "org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean" const val ANNOTATION_GETTER = "lombok.Getter" const val ANNOTATION_DATA = "lombok.Data" const val ANNOTATION_NO_ARGS_CONSTRUCTOR = "lombok.NoArgsConstructor" @@ -25,10 +29,16 @@ const val ANNOTATION_TAG = "io.swagger.v3.oas.annotations.tags.Tag" const val ANNOTATION_SCHEMA = "io.swagger.v3.oas.annotations.media.Schema" const val ANNOTATION_OPERATION = "io.swagger.v3.oas.annotations.Operation" const val ANNOTATION_PARAMETER = "io.swagger.v3.oas.annotations.Parameter" +const val ANNOTATION_TABLE_NAME = "com.baomidou.mybatisplus.annotation.TableName" +const val ANNOTATION_TABLE_ID = "com.baomidou.mybatisplus.annotation.TableId" +const val ANNOTATION_TABLE_LOGIC = "com.baomidou.mybatisplus.annotation.TableLogic" +const val TYPE_BOOLEAN = "java.lang.Boolean" const val TYPE_STRING = "java.lang.String" +const val TYPE_DATE = "java.util.Date" const val TYPE_LIST = "java.util.List" const val TYPE_COLLECTORS = "java.util.stream.Collectors" +const val TYPE_IDENTIFIABLE = "com.github.linyuzai.domain.core.Identifiable" const val TYPE_DOMAIN_VALUE = "com.github.linyuzai.domain.core.DomainValue" const val TYPE_DOMAIN_ENTITY = "com.github.linyuzai.domain.core.DomainEntity" const val TYPE_DOMAIN_COLLECTION = "com.github.linyuzai.domain.core.DomainCollection" @@ -40,12 +50,16 @@ const val TYPE_PAGES = "com.github.linyuzai.domain.core.page.Pages" const val TYPE_DOMAIN_CONDITIONS = "com.github.linyuzai.domain.core.condition.Conditions" const val TYPE_DOMAIN_LAMBDA_CONDITIONS = "com.github.linyuzai.domain.core.condition.LambdaConditions" const val TYPE_DOMAIN_NOT_FOUND_EXCEPTION = "com.github.linyuzai.domain.core.exception.DomainNotFoundException" +const val TYPE_MBP_DOMAIN_REPOSITORY = "com.github.linyuzai.domain.mbp.MBPDomainRepository" +const val TYPE_MBP_DOMAIN_ID_GENERATOR = "com.github.linyuzai.domain.mbp.MBPDomainIdGenerator" +const val TYPE_BASE_MAPPER = "com.baomidou.mybatisplus.core.mapper.BaseMapper" const val PARAM_ID = "id" const val PARAM_DESCRIPTION = "description" const val PARAM_NAME = "name" const val PARAM_SUMMARY = "summary" val PARAM_ACCESS_PROTECTED = "access" to ("lombok.AccessLevel" to "PROTECTED") +val PARAM_ID_TYPE_INPUT = "type" to ("com.baomidou.mybatisplus.annotation.IdType" to "INPUT") fun schemaDescription(desc: String): Pair> { return PARAM_DESCRIPTION to ("" to "\"$desc\"") } @@ -66,6 +80,8 @@ fun annotationValue(value: String): Pair> { return "" to ("" to "\"$value\"") } +val IGNORE_CLASS_ARRAY = arrayOf("Pages.Args") + data class JavaBuilder(val _name: String) : ContentGenerator() { private var _package = "" @@ -102,10 +118,12 @@ data class JavaBuilder(val _name: String) : ContentGenerator() { override fun content(): String { return buildString { append("package $_package;\n") - _imports.filterNot { it.startsWith("java.lang.") } + _imports.asSequence() + .filterNot { it.startsWith("java.lang.") } + .filterNot { IGNORE_CLASS_ARRAY.contains(it) } .filter { it.isNotBlank() } .filter { it.contains(".") } - .sorted() + .sorted().toList() .forEach { append("import $it;\n") } @@ -195,11 +213,17 @@ data class ClassBuilder(val _java: JavaBuilder, val _name: String) : ContentGene fun _extends(_type: String, vararg _generic: String) { this._extends = _type to _generic this._java._import(_type) + _generic.forEach { + this._java._import(it) + } } fun _implements(_type: String, vararg _generic: String) { - _interfaces.add(_type to _generic) - _java._import(_type) + this._interfaces.add(_type to _generic) + this._java._import(_type) + _generic.forEach { + this._java._import(it) + } } fun _field(_name: String, _init: FieldBuilder.() -> Unit): FieldBuilder { @@ -244,11 +268,7 @@ data class ClassBuilder(val _java: JavaBuilder, val _name: String) : ContentGene if (_extends.first.isNotEmpty()) { append("extends ") - append(_extends.first.toSampleName()) - if (_extends.second.isNotEmpty()) { - append(_extends.second.joinToString(",", "<", ">") - { s -> s.toSampleName() }) - } + addGeneric(_extends) append(" ") } @@ -267,7 +287,7 @@ data class MethodBuilder(private val _java: JavaBuilder, private val _name: Stri private val _params = mutableListOf() - private var _return = "void" + private var _return = Pair>("void", emptyArray()) private val _annotations = mutableListOf>>>>() @@ -292,10 +312,11 @@ data class MethodBuilder(private val _java: JavaBuilder, private val _name: Stri return builder } - fun _return(_return: String, _import: Boolean = true) { - this._return = _return - if (_import) { - this._java._import(_return) + fun _return(_type: String, vararg _generic: String) { + this._return = _type to _generic + this._java._import(_type) + _generic.forEach { + this._java._import(it) } } @@ -343,7 +364,8 @@ data class MethodBuilder(private val _java: JavaBuilder, private val _name: Stri val args = _params.joinToString(",") { it._asParam() } - append("${_return.toSampleName()} $_name($args)") + addGeneric(_return) + append(" $_name($args)") if (_hasBody) { append("{\n") @@ -362,12 +384,16 @@ data class FieldBuilder(private val _java: JavaBuilder, private val _name: Strin private var _final = false - private var _type = "" + private var _type = Pair>("", emptyArray()) private val _annotations = mutableListOf>>>>() private var _comment = "" + fun _private() { + this._access = "private" + } + fun _protected() { this._access = "protected" } @@ -376,10 +402,11 @@ data class FieldBuilder(private val _java: JavaBuilder, private val _name: Strin this._final = true } - fun _type(_type: String, _import: Boolean = true) { - this._type = _type - if (_import) { - this._java._import(_type) + fun _type(_type: String, vararg _generic: String) { + this._type = _type to _generic + this._java._import(_type) + _generic.forEach { + this._java._import(it) } } @@ -401,7 +428,8 @@ data class FieldBuilder(private val _java: JavaBuilder, private val _name: Strin addAccess(_access) - append("${_type.toSampleName()} $_name") + addGeneric(_type) + append(" $_name") } } @@ -417,7 +445,8 @@ data class FieldBuilder(private val _java: JavaBuilder, private val _name: Strin append("final ") } - append("${_type.toSampleName()} $_name;\n") + addGeneric(_type) + append(" $_name;\n") } } } @@ -447,9 +476,8 @@ inline fun _java(_name: String, init: JavaBuilder.() -> Unit): JavaBuilder { return builder } -val IGNORE_SAMPLE_NAME_ARRAY = arrayOf("Pages.Args") -fun String.toSampleName() = if (IGNORE_SAMPLE_NAME_ARRAY.contains(this)) { +fun String.toSampleName() = if (IGNORE_CLASS_ARRAY.contains(this)) { this } else { this.substringAfterLast(".") @@ -468,6 +496,10 @@ fun String.toGetter(ifIs: Boolean): String { } } +fun String.toUnderlineCase(): String { + return replace(Regex("[A-Z]"), "_\$0").lowercase() +} + fun StringBuilder.addComment(_comment: String) { if (_comment.isNotBlank()) { append("/**\n") @@ -509,14 +541,18 @@ fun StringBuilder.addInterfaces(implementsOrExtends: String, _interfaces: List

") - { s -> s.toSampleName() }) - } + addGeneric(it) } append(" ") } } +fun StringBuilder.addGeneric(pair: Pair>) { + append(pair.first.toSampleName()) + if (pair.second.isNotEmpty()) { + append(pair.second.joinToString(",", "<", ">") + { s -> s.toSampleName() }) + } +} + diff --git a/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/module/ModuleFileGenerator.kt b/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/module/ModuleFileGenerator.kt index 4f14dd3d5..03f2e704d 100644 --- a/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/module/ModuleFileGenerator.kt +++ b/concept-cloud/concept-cloud-plugin-intellij/src/main/kotlin/com/github/linyuzai/cloud/plugin/intellij/module/ModuleFileGenerator.kt @@ -13,17 +13,20 @@ object ModuleFileGenerator { val domainObjectClass = model.domainObjectClass.get() val domainObjectClassName = domainObjectClass.toSampleName() val domainObjectParam = domainObjectClassName.lowercaseFirst() + val domainCollectionClass = model.domainCollectionClass.get() val domainServiceClass = model.domainServiceClass.get() val domainServiceClassName = domainServiceClass.toSampleName() val domainServiceParam = domainServiceClassName.lowercaseFirst() val domainRepositoryClass = model.domainRepositoryClass.get() val domainRepositoryClassName = domainRepositoryClass.toSampleName() val domainRepositoryParam = domainRepositoryClassName.lowercaseFirst() - val description = model.domainDescription.get() - val viewPackage = "$modulePackage.view" - val viewDir = File(dir, "view") + val domainPackage = "$modulePackage.domain.${domainObjectClassName.lowercase()}" + val domainDir = File(dir, "domain/${domainObjectClassName.lowercase()}") + + val viewPackage = "$domainPackage.view" + val viewDir = File(domainDir, "view") val createCommandClassName = "${domainObjectClassName}CreateCommand" _java("$createCommandClassName.java") { @@ -91,20 +94,21 @@ object ModuleFileGenerator { }.writeTo(viewDir) val idGeneratorClassName = "${domainObjectClassName}IdGenerator" + val idGeneratorParam = idGeneratorClassName.lowercaseFirst() _java("$idGeneratorClassName.java") { - _package(modulePackage) + _package(domainPackage) _interface(idGeneratorClassName) { _public() _comment("${description}ID生成器") _extends(TYPE_DOMAIN_ID_GENERATOR, "$viewPackage.$createCommandClassName") } - }.writeTo(dir) + }.writeTo(domainDir) val facadeAdapterClassName = "${domainObjectClassName}FacadeAdapter" val facadeAdapterParam = facadeAdapterClassName.lowercaseFirst() _java("$facadeAdapterClassName.java") { - _package(modulePackage) + _package(domainPackage) _interface(facadeAdapterClassName) { _public() _comment("领域模型/视图 转换适配器") @@ -144,11 +148,11 @@ object ModuleFileGenerator { _comment("查询转条件") } } - }.writeTo(dir) + }.writeTo(domainDir) val facadeAdapterImplClassName = "${facadeAdapterClassName}Impl" _java("$facadeAdapterImplClassName.java") { - _package(modulePackage) + _package(domainPackage) _class(facadeAdapterImplClassName) { _public() _comment("领域模型/视图 转换适配器实现") @@ -212,12 +216,12 @@ object ModuleFileGenerator { _import(TYPE_DOMAIN_LAMBDA_CONDITIONS) } } - }.writeTo(dir) + }.writeTo(domainDir) val searcherClassName = "${domainObjectClassName}Searcher" val searcherParam = searcherClassName.lowercaseFirst() _java("$searcherClassName.java") { - _package(modulePackage) + _package(domainPackage) _interface(searcherClassName) { _public() _comment("搜索") @@ -231,8 +235,7 @@ object ModuleFileGenerator { } _method("list") { - _return("List<$voClassName>", false) - _import(TYPE_LIST) + _return(TYPE_LIST, voClassName) _param("query") { _type("$viewPackage.$queryClassName") } @@ -240,22 +243,21 @@ object ModuleFileGenerator { } _method("page") { - _return("Pages<$voClassName>", false) - _import(TYPE_PAGES) + _return(TYPE_PAGES, voClassName) _param("query") { _type("$viewPackage.$queryClassName") } _param("page") { - _type("Pages.Args", false) + _type("Pages.Args") } _comment("分页查询") } } - }.writeTo(dir) + }.writeTo(domainDir) val searcherImplClassName = "${searcherClassName}Impl" _java("$searcherImplClassName.java") { - _package(modulePackage) + _package(domainPackage) _class(searcherImplClassName) { _public() _annotation(ANNOTATION_COMPONENT) @@ -293,8 +295,7 @@ object ModuleFileGenerator { _method("list") { _override() _public() - _return("List<$voClassName>", false) - _import(TYPE_LIST) + _return(TYPE_LIST, voClassName) _param("query") { _type("$viewPackage.$queryClassName") } @@ -311,13 +312,12 @@ object ModuleFileGenerator { _method("page") { _override() _public() - _return("Pages<$voClassName>", false) - _import(TYPE_PAGES) + _return(TYPE_PAGES, voClassName) _param("query") { _type("$viewPackage.$queryClassName") } _param("page") { - _type("Pages.Args", false) + _type("Pages.Args") } _body( "return $domainRepositoryParam", @@ -326,12 +326,12 @@ object ModuleFileGenerator { ) } } - }.writeTo(dir) + }.writeTo(domainDir) val applicationServiceClassName = "${domainObjectClassName}ApplicationService" val applicationServiceParam = applicationServiceClassName.lowercaseFirst() _java("$applicationServiceClassName.java") { - _package(modulePackage) + _package(domainPackage) _class(applicationServiceClassName) { _public() _comment("应用服务") @@ -406,11 +406,12 @@ object ModuleFileGenerator { _import(TYPE_DOMAIN_NOT_FOUND_EXCEPTION) } } - }.writeTo(dir) + }.writeTo(domainDir) val controllerClassName = "${domainObjectClassName}Controller" + val controllerParam = controllerClassName.lowercaseFirst() _java("$controllerClassName.java") { - _package(modulePackage) + _package(domainPackage) _class(controllerClassName) { _public() @@ -492,8 +493,7 @@ object ModuleFileGenerator { _public() _annotation(ANNOTATION_OPERATION, operationSummary("${description}列表")) _annotation(ANNOTATION_GET_MAPPING, annotationValue("list")) - _return("List<$voClassName>", false) - _import(TYPE_LIST) + _return(TYPE_LIST, voClassName) _param("query") { _type("$viewPackage.$queryClassName") } @@ -504,23 +504,192 @@ object ModuleFileGenerator { _public() _annotation(ANNOTATION_OPERATION, operationSummary("${description}分页")) _annotation(ANNOTATION_GET_MAPPING, annotationValue("page")) - _return("Pages<$voClassName>", false) - _import(TYPE_PAGES) + _return(TYPE_PAGES, voClassName) _param("query") { _type("$viewPackage.$queryClassName") } _param("page") { - _type("Pages.Args", false) + _type("Pages.Args") } _body("return $searcherParam.page(query, page);") } } - }.writeTo(dir) + }.writeTo(domainDir) + val mbpPackage = "$modulePackage.infrastructure.${domainObjectParam.lowercase()}.mbp" if (model.myBatisPlus.get()) { - val mbpPackage = "$modulePackage.infrastructure.${domainObjectClass.uppercase()}.mbp" - val mbpDir = File(dir, "infrastructure/${domainObjectClass.uppercase()}/mbp") + val mbpDir = File(dir, "infrastructure/${domainObjectParam.lowercase()}/mbp") + + val poClassName = "${domainObjectClassName}PO" + _java("$poClassName.java") { + _package(mbpPackage) + _class(poClassName) { + _annotation(ANNOTATION_DATA) + _annotation(ANNOTATION_TABLE_NAME, annotationValue("t${domainObjectClassName.toUnderlineCase()}")) + + _implements(TYPE_IDENTIFIABLE) + + _field(PARAM_ID) { + _private() + _annotation(ANNOTATION_TABLE_ID, PARAM_ID_TYPE_INPUT) + _type(TYPE_STRING) + } + + _field("createTime") { + _private() + _type(TYPE_DATE) + } + + _field("deleted") { + _private() + _annotation(ANNOTATION_TABLE_LOGIC) + _type(TYPE_BOOLEAN) + } + } + }.writeTo(mbpDir) + + val mapperClassName = "${domainObjectClassName}Mapper" + val mapperParam = mapperClassName.lowercaseFirst() + _java("$mapperClassName.java") { + _package(mbpPackage) + _interface(mapperClassName) { + _extends(TYPE_BASE_MAPPER, poClassName) + } + }.writeTo(mbpDir) + + val mbpRepositoryClassName = "MBP$domainRepositoryClassName" + _java("$mbpRepositoryClassName.java") { + _package(mbpPackage) + _class(mbpRepositoryClassName) { + _public() + _annotation(ANNOTATION_REPOSITORY) + + _extends( + TYPE_MBP_DOMAIN_REPOSITORY, + domainObjectClass, domainCollectionClass, poClassName + ) + + _implements(domainRepositoryClass) + + _field(mapperParam) { + _private() + _annotation(ANNOTATION_AUTOWIRED) + _type(mapperClassName) + } + + _field("validator") { + _private() + _annotation(ANNOTATION_AUTOWIRED) + _type(TYPE_DOMAIN_VALIDATOR) + } + + _method("do2po") { + _override() + _public() + _return(poClassName) + _param(domainObjectParam) { + _type(domainObjectClass) + } + _todo() + } + _method("po2do") { + _override() + _public() + _return(domainObjectClass) + _param("po") { + _type(poClassName) + } + _todo() + } + + _method("getBaseMapper") { + _override() + _public() + _return(TYPE_BASE_MAPPER, poClassName) + _body("return $mapperParam;") + } + } + }.writeTo(mbpDir) } + + val configPackage = "$modulePackage.config" + val configDir = File(dir, "config") + + val configurationClassName = "Domain${domainObjectClassName}Configuration" + _java("$configurationClassName.java") { + _package(configPackage) + _class(configurationClassName) { + _public() + _annotation(ANNOTATION_CONFIGURATION) + + _method(controllerParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return("$domainPackage.$controllerClassName") + _body("return new $controllerClassName();") + } + + _method(domainServiceParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return(domainServiceClass) + _body("return new $domainServiceClassName();") + } + + _method(applicationServiceParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return("$domainPackage.$applicationServiceClassName") + _body("return new $applicationServiceClassName();") + } + + _method(facadeAdapterParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return("$domainPackage.$facadeAdapterClassName") + _body("return new $facadeAdapterImplClassName();") + } + + _method(searcherParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return("$domainPackage.$searcherClassName") + _body("return new $searcherImplClassName();") + } + + if (model.myBatisPlus.get()) { + + _class("MyBatisPlusConfiguration") { + _public() + _static() + _annotation(ANNOTATION_CONFIGURATION) + + _method(idGeneratorParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return("$domainPackage.$idGeneratorClassName") + _body("return MBPDomainIdGenerator.create($idGeneratorClassName.class);") + _import(TYPE_MBP_DOMAIN_ID_GENERATOR) + } + + _method(domainRepositoryParam) { + _public() + _annotation(ANNOTATION_BEAN) + _annotation(ANNOTATION_CONDITIONAL_ON_MISSING_BEAN) + _return(domainRepositoryClass) + _body("return new MBP$domainRepositoryClassName();") + _import("$mbpPackage.MBP$domainRepositoryClassName") + } + } + } + } + }.writeTo(configDir) } } \ No newline at end of file diff --git a/concept-cloud/pluginew/java/1.0.0/$ARTIFACT$-token/src/main/java/$PACKAGE$/token/TokenWebInterceptor.java b/concept-cloud/pluginew/java/1.0.0/$ARTIFACT$-token/src/main/java/$PACKAGE$/token/TokenWebInterceptor.java index be99af8b2..54fccdec9 100644 --- a/concept-cloud/pluginew/java/1.0.0/$ARTIFACT$-token/src/main/java/$PACKAGE$/token/TokenWebInterceptor.java +++ b/concept-cloud/pluginew/java/1.0.0/$ARTIFACT$-token/src/main/java/$PACKAGE$/token/TokenWebInterceptor.java @@ -45,6 +45,7 @@ public Object intercept(WebContext context, ValueReturner returner, WebIntercept LoginContext.setToken(token); } } + return chain.next(context, returner); } private boolean shouldIntercept(Request request) { diff --git a/concept-cloud/pluginew/java/1.0.0/build.gradle b/concept-cloud/pluginew/java/1.0.0/build.gradle index fad09b033..41b18b8df 100644 --- a/concept-cloud/pluginew/java/1.0.0/build.gradle +++ b/concept-cloud/pluginew/java/1.0.0/build.gradle @@ -81,7 +81,7 @@ allprojects { String prefix = '$ARTIFACT$' if (project.name.contains("application-")) { bootJar.enabled = true - bootJar.archiveBaseName = "$prefix-${project.name}" + bootJar.archiveBaseName.set("$prefix-${project.name}") jar.enabled = false } else { jar.enabled = true @@ -89,9 +89,9 @@ allprojects { //指定名称 //前缀aa方便查看压缩包 if (project.depth <= 1) { - jar.archiveBaseName = "aa-${project.name}" + jar.archiveBaseName.set("aa-${project.name}") } else { - jar.archiveBaseName = "aa-$prefix-${project.name}" + jar.archiveBaseName.set("aa-$prefix-${project.name}") } bootJar.enabled = false diff --git a/concept-cloud/pluginew/java/1.0.0/template.zip b/concept-cloud/pluginew/java/1.0.0/template.zip index 4f865955e0dab96ce1d2de3a4595bc2e8b0aa10b..e74c322f9d7162f04152257483fd2378a2210b55 100644 GIT binary patch delta 3212 zcmaJ@c{r478=v=`F&z7ZOo|Y)Gh=NmS&}_Mj9r$5VI<2~Y9=N`C%ZQZS+ay9>tu<< zK}q8z*_X5kWzCY%H`V#h^8N8W*Y#ZY_5SYP?|JY0xvuB>-Sl;~v2`{|9q>U4Orb#Y zQou>J)PitNr^0YgMoc>^DF8iJ2H0t5r2$O@Duwdc7WU_2{RIXyg!07zG&C&(9EMJ= zfN1h}Z8~Frk0B&B7=Ty@U@!zPLsNOioH(F}Zk@Hm4|2{aJDqa6XDoBqeSmVxoqodV2qUY zKRv;8v-l%ECz&@cy`05D_>lnCBkifrMewoxyRw^gQx<^W%JT#=VTMb zl6H-|{o;haz2$GIg?Z;Em!NpXF7Xs8Z&J^#mLSxdC|RrhNr)$IkADZqoRs^Al8j0( zBuy;mrbeZ*#s_dHOgmemj%ms#_Jou@dbffO%=1%2e%xR+hYs{m4M}PD6Em=raKLE!?{zKA>S^&Lxd1E7XEQX(`%KY$XjC0)$hg-eW#Lq?3rGs*B z)TCp3gGIH(_C0mj){N$U;_IWIaJdg}Fyzf|H+$H(($Tu)nYJcEtA*7S{?uXAWpIp28Dq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d|eq?+r;d@+vdu04_XZC^u zWYMP!nQjzy#z+K5W((oXWtW+*XA1F|9eLoRd&mEa`Z0Zk*-alKBQa(k@u1UkH4j)X zmvYw;3Qo09Pr7U%TuRp7a<0AVr~188pMEy%xx1`ZGyiPJv&l)fq@jVau~@me5=5L! ze-T)^y4PRV^4tf2dUP8~ni=X07FHZB7e2e2HfJ%)`lrDWSu$Qf*pa8|zRIMTgk=Ud zg`tZ~m~#{R@D z@g;nI+I)3m3?+v{L{5ucTpaJHE?e(iT&-HP8XF7r_v|D)-kQEhz7_jq6Vgn#cy05d zx}Qata+WZ#meh}9a}i7zSSfvMFP@c|!ZOifdaY>8Zc>Or@+XEGz;tA`5TZCSQcEPgY0X zpV~93nOUSl6&*Ti3)IeHd2eG`^MU@MWLE)Vvuqe`t0e_*<8# z$}N;b5Qqrny%v=EUJKZK3X`&K1)b6XL2&Flpz^;yk!u;?qUtXIbpXdNpZKq)f$U3w zGyA{R5DX^)M?lOxzzdd<0S@Rnuwn^_1KJe8r7-{rF3tf0Ao?`)5Ga2F$^iy10|e+9 z@Y^zw0d4=4w7};-feV103Rt-WXoAfuPy43ejsFqN-)^-ad{h#?0D+BBx&)Pw!8pN&v zzR+1PcMS-Deg^s154a9d0Q?~e$o;(+Sh#+`HG=I29q1BxWCOSW6-_a+8$KGF$W{RE6|7F@lC**X%YiKQkTL7K+`Qi52lO-KxZs~{f%*fY~26{QzZ5P ZYT^9{q8~uJzo5=7fa4Ha0XTSt{{Vf$g!BLa diff --git a/concept-cloud/pluginew/starter_new.json b/concept-cloud/pluginew/starter_new.json index 4ebe1c969..e19d08327 100644 --- a/concept-cloud/pluginew/starter_new.json +++ b/concept-cloud/pluginew/starter_new.json @@ -16,13 +16,13 @@ "springBoot": "2.7.6", "springDependencyManagement": "1.1.0", "springCloudDependencyManagement": "2021.0.4", - "conceptDomain": "1.7.0", - "conceptCloudWeb": "1.5.2", + "conceptDomain": "1.7.1", + "conceptCloudWeb": "1.5.3", "myBatisPlus": "3.5.2" }, "dependencies": { "websocket-loadbalance": [ - "implementation 'com.github.linyuzai:concept-websocket-loadbalance-spring-boot-starter:1.0.4'", + "implementation 'com.github.linyuzai:concept-websocket-loadbalance-spring-boot-starter:1.1.0'", "implementation 'org.springframework.boot:spring-boot-starter-websocket'" ], "download": [ @@ -38,7 +38,7 @@ "implementation 'com.github.linyuzai:concept-plugin-jar:1.0.1'" ], "router": [ - "implementation 'com.github.linyuzai:concept-router-spring-boot-starter:1.0.0'" + "implementation 'com.github.linyuzai:concept-router-spring-boot-starter:1.1.0'" ], "sync-waiting": [ "implementation 'com.github.linyuzai:concept-sync-waiting:1.0.0'"