feat(codegen): 新增分支配置支持并更新默认配置前缀

- 修改PREFIX为pigx.codegen以增强配置项命名空间隔离性
- 新增branch字段用于指定代码生成模板仓库的分支
- 更新GenTemplateServiceImpl中模板文件获取逻辑以支持多分支
- 默认分支设置为master保持向后兼容性
This commit is contained in:
PIG AI committed 2025-06-23 16:19:58 +08:00
1 parent 78874c1646
commit 52e5be9442
2 files changed
+7 -2

No files matched your search

@@ -18,13 +18,18 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties(prefix = PigxCodeGenDefaultProperties.PREFIX)
public class PigxCodeGenDefaultProperties implements InitializingBean {
public static final String PREFIX = "codegen";
public static final String PREFIX = "pigx.codegen";
/**
* 是否开启在线更新
*/
private boolean autoCheckVersion = true;
/**
* 分支名称,默认为master
*/
private String branch = "master";
/**
* 模板项目地址
*/
@@ -188,7 +188,7 @@ public class GenTemplateServiceImpl extends ServiceImpl<GenTemplateMapper, GenTe
* @return {@link String }
*/
private String getCGTMFile(String fileName) {
HttpResponse response = HttpRequest.get(String.format("%s/CGTM/raw/master/%s", DefaultConstants.CGTM_URL, fileName))
HttpResponse response = HttpRequest.get(String.format("%s/CGTM/raw/%s/%s", DefaultConstants.CGTM_URL, defaultProperties.getBranch(), fileName))
.execute();
if (response.getStatus() == HttpStatus.HTTP_OK || StrUtil.isNotBlank(response.body())) {