refactor: 代码生成支持排除指定表
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,6 @@ public class GeneratorProperties {
|
||||
*/
|
||||
private Map<String, TemplateConfig> templateConfigs = MapUtil.newHashMap(true);
|
||||
|
||||
|
||||
/**
|
||||
* 后端应用名
|
||||
*/
|
||||
@@ -42,6 +42,11 @@ public class GeneratorProperties {
|
||||
*/
|
||||
private String frontendAppName;
|
||||
|
||||
/**
|
||||
* 排除数据表
|
||||
*/
|
||||
private List<String> excludeTables;
|
||||
|
||||
/**
|
||||
* 模板配置
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.youlai.system.model.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.youlai.system.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据表分页查询对象
|
||||
*
|
||||
@@ -19,4 +22,10 @@ public class TablePageQuery extends BasePageQuery {
|
||||
@Schema(description="关键字(表名)")
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 排除的表名
|
||||
*/
|
||||
@JsonIgnore
|
||||
private List<String> excludeTables;
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
*/
|
||||
public Page<TablePageVO> getTablePage(TablePageQuery queryParams) {
|
||||
Page<TablePageVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
|
||||
// 设置排除的表
|
||||
List<String> excludeTables = generatorProperties.getExcludeTables();
|
||||
queryParams.setExcludeTables(excludeTables);
|
||||
|
||||
return databaseMapper.getTablePage(page, queryParams);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user