mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善代码生成
This commit is contained in:
@@ -31,6 +31,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
@@ -340,6 +343,37 @@ public class Codegen {
|
||||
.addMethod(
|
||||
MethodSpec.methodBuilder("toTreeDto")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
|
||||
.addAnnotation(
|
||||
AnnotationSpec.builder(Mappings.class)
|
||||
.addMember(
|
||||
"value",
|
||||
"{@$T(target = \"children\", qualifiedByName = \"toTreeDto\")}",
|
||||
|
||||
Mapping.class)
|
||||
.build())
|
||||
.addAnnotation(
|
||||
AnnotationSpec.builder(
|
||||
Named.class)
|
||||
.addMember("value", "$S", "toTreeDto")
|
||||
.build())
|
||||
.returns(ClassName.get(dtoPackage, treeDto.name))
|
||||
.addParameter(
|
||||
ClassName.get(entityPackage, entity.name),
|
||||
"entity")
|
||||
.build())
|
||||
|
||||
.addMethod(
|
||||
MethodSpec.methodBuilder("toTreeExcludeChildren")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
|
||||
.addAnnotation(
|
||||
AnnotationSpec.builder(Mappings.class)
|
||||
.addMember(
|
||||
"value",
|
||||
"{@$T(target = \"children\",ignore=true)}",
|
||||
|
||||
Mapping.class)
|
||||
.build())
|
||||
|
||||
.returns(ClassName.get(dtoPackage, treeDto.name))
|
||||
.addParameter(
|
||||
ClassName.get(entityPackage, entity.name),
|
||||
|
||||
Reference in New Issue
Block a user