CodegenConverter.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.youlai.boot.module.codegen.converter;
  2. import com.youlai.boot.module.codegen.model.entity.GenConfig;
  3. import com.youlai.boot.module.codegen.model.entity.GenFieldConfig;
  4. import com.youlai.boot.module.codegen.model.form.GenConfigForm;
  5. import org.mapstruct.Mapper;
  6. import org.mapstruct.Mapping;
  7. import java.util.List;
  8. /**
  9. * 代码生成配置转换器
  10. *
  11. * @author Ray
  12. * @since 2.10.0
  13. */
  14. @Mapper(componentModel = "spring")
  15. public interface CodegenConverter {
  16. @Mapping(source = "genConfig.tableName", target = "tableName")
  17. @Mapping(source = "genConfig.businessName", target = "businessName")
  18. @Mapping(source = "genConfig.moduleName", target = "moduleName")
  19. @Mapping(source = "genConfig.packageName", target = "packageName")
  20. @Mapping(source = "genConfig.entityName", target = "entityName")
  21. @Mapping(source = "genConfig.author", target = "author")
  22. @Mapping(source = "fieldConfigs", target = "fieldConfigs")
  23. GenConfigForm toGenConfigForm(GenConfig genConfig, List<GenFieldConfig> fieldConfigs);
  24. List<GenConfigForm.FieldConfig> toGenFieldConfigForm(List<GenFieldConfig> fieldConfigs);
  25. GenConfigForm.FieldConfig toGenFieldConfigForm(GenFieldConfig genFieldConfig);
  26. GenConfig toGenConfig(GenConfigForm formData);
  27. List<GenFieldConfig> toGenFieldConfig(List<GenConfigForm.FieldConfig> fieldConfigs);
  28. GenFieldConfig toGenFieldConfig(GenConfigForm.FieldConfig fieldConfig);
  29. }