Skip to content

Commit

Permalink
调整模板生成配置.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Mar 30, 2024
1 parent 81bcb97 commit 6782dff
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public LikeTable getNotLikeTable() {
return notLikeTable;
}

@Nullable
@NotNull
public IOutputFile getOutputFile() {
return outputFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
* 模板路径配置项
*
* @author tzg hubin
* @see StrategyConfig.Builder#entityBuilder()
* @see StrategyConfig.Builder#serviceBuilder()
* @see StrategyConfig.Builder#mapperBuilder()
* @see StrategyConfig.Builder#controllerBuilder()
* @since 2017-06-17
* @deprecated 3.5.6 {@link StrategyConfig}
*/
Expand Down Expand Up @@ -128,8 +132,18 @@ public String getEntity(boolean kotlin) {
*
* @param templateTypes 模板类型
* @return this
* @see Entity.Builder#disable()
* @see Service.Builder#disable()
* @see Service.Builder#disableService()
* @see Service.Builder#disableServiceImpl()
* @see Controller.Builder#disable()
* @see Mapper.Builder#disable()
* @see Mapper.Builder#disableMapper()
* @see Mapper.Builder#disableMapperXml()
* @since 3.3.2
* @deprecated 3.5.6
*/
@Deprecated
public TemplateConfig disable(@NotNull TemplateType... templateTypes) {
if (templateTypes != null) {
for (TemplateType templateType : templateTypes) {
Expand Down Expand Up @@ -166,8 +180,18 @@ public TemplateConfig disable(@NotNull TemplateType... templateTypes) {
* 禁用全部模板
*
* @return this
* @see Entity.Builder#disable()
* @see Service.Builder#disable()
* @see Service.Builder#disableService()
* @see Service.Builder#disableServiceImpl()
* @see Controller.Builder#disable()
* @see Mapper.Builder#disable()
* @see Mapper.Builder#disableMapper()
* @see Mapper.Builder#disableMapperXml()
* @since 3.5.0
* @deprecated 3.5.6
*/
@Deprecated
public TemplateConfig disable() {
return disable(TemplateType.values());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public Builder disable() {
* @return this
* @since 3.5.6
*/
public Builder template(String template) {
public Builder template(@NotNull String template) {
this.controller.templatePath = template;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private Entity() {

/**
* 自定义忽略字段
* https://github.com/baomidou/generator/issues/46
* <a href="https://github.com/baomidou/generator/issues/46">...</a>
*/
private final Set<String> ignoreColumns = new HashSet<>();

Expand Down Expand Up @@ -221,7 +221,7 @@ private Entity() {
* @since 3.5.6
*/
@Getter
private boolean generate;
private boolean generate = true;

/**
* <p>
Expand Down Expand Up @@ -665,6 +665,16 @@ public Builder kotlinTemplatePath(String template) {
return this;
}

/**
* 禁用实体生成
*
* @return this
* @since 3.5.6
*/
public Builder disable() {
this.entity.generate = false;
return this;
}

public Entity get() {
String superClass = this.entity.superClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public Builder enableFileOverride() {
* @return this
* @since 3.5.6
*/
public Builder mapperTemplate(String template) {
public Builder mapperTemplate(@NotNull String template) {
this.mapper.mapperTemplatePath = template;
return this;
}
Expand All @@ -357,11 +357,45 @@ public Builder mapperTemplate(String template) {
* @return this
* @since 3.5.6
*/
public Builder mapperXmlTemplate(String template) {
public Builder mapperXmlTemplate(@NotNull String template) {
this.mapper.mapperXmlTemplatePath = template;
return this;
}

/**
* 禁用Mapper生成
*
* @return this
* @since 3.5.6
*/
public Builder disable() {
this.mapper.generateMapper = false;
this.mapper.generateMapperXml = false;
return this;
}

/**
* 禁用Mapper接口生成
*
* @return this
* @since 3.5.6
*/
public Builder disableMapper() {
this.mapper.generateMapper = false;
return this;
}

/**
* 禁用MapperXml生成
*
* @return this
* @since 3.5.6
*/
public Builder disableMapperXml() {
this.mapper.generateMapperXml = false;
return this;
}

@NotNull
public Mapper get() {
return this.mapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private Service() {
* @since 3.5.6
*/
@Getter
private boolean generateServiceImpl = false;
private boolean generateServiceImpl = true;


/**
Expand All @@ -57,7 +57,7 @@ private Service() {
* @since 3.5.6
*/
@Getter
private boolean generateService = false;
private boolean generateService = true;

/**
* @since 3.5.6
Expand Down Expand Up @@ -252,6 +252,18 @@ public Builder enableFileOverride() {
return this;
}

/**
* 禁用生成Service
*
* @return this
* @since 3.5.6
*/
public Builder disable() {
this.service.generateService = false;
this.service.generateServiceImpl = false;
return this;
}

/**
* 禁用生成
*
Expand Down Expand Up @@ -280,7 +292,7 @@ public Builder disableServiceImpl() {
* @return this
* @since 3.5.6
*/
public Builder serviceTemplate(String template) {
public Builder serviceTemplate(@NotNull String template) {
this.service.serviceTemplate = template;
return this;
}
Expand All @@ -291,7 +303,7 @@ public Builder serviceTemplate(String template) {
* @return this
* @since 3.5.6
*/
public Builder serviceImplTemplate(String template) {
public Builder serviceImplTemplate(@NotNull String template) {
this.service.serviceImplTemplate = template;
return this;
}
Expand Down

0 comments on commit 6782dff

Please sign in to comment.