模板管理

This commit is contained in:
2026-01-14 17:47:36 +08:00
parent fb6ea0bfd2
commit b3a0e377e5
13 changed files with 628 additions and 37 deletions

View File

@@ -0,0 +1,16 @@
package com.cczsa.xinghe.codegen.mapper;
import org.apache.ibatis.annotations.Mapper;
import com.mybatisflex.core.BaseMapper;
import com.cczsa.xinghe.codegen.entity.TemplateEntity;
/**
* 映射层。
*
* @author My
* @since 0.0.1
*/
@Mapper
public interface TemplateMapper extends BaseMapper<TemplateEntity> {
}

View File

@@ -0,0 +1,72 @@
package com.cczsa.xinghe.codegen.mapper.def;
import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;
import java.io.Serial;
/**
* 表定义层。
*
* @author My
* @since 0.0.1
*/
public class TemplateDef extends TableDef {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
public static final TemplateDef TEMPLATE_ENTITY = new TemplateDef();
/**
* 主键ID
*/
public final QueryColumn ID = new QueryColumn(this, "id");
/**
* 是否使用
*/
public final QueryColumn IS_USE = new QueryColumn(this, "is_use");
/**
* 正文
*/
public final QueryColumn CONTENT = new QueryColumn(this, "content");
/**
* 模板名称
*/
public final QueryColumn TEMPLATE_NAME = new QueryColumn(this, "template_name");
/**
* 模板类型
*/
public final QueryColumn TEMPLATE_TYPE = new QueryColumn(this, "template_type");
/**
* 所有字段。
*/
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
/**
* 默认字段,不包含逻辑删除或者 large 等字段。
*/
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, IS_USE, TEMPLATE_NAME, TEMPLATE_TYPE, CONTENT};
public TemplateDef() {
super("", "cg_template");
}
private TemplateDef(String schema, String name, String alisa) {
super(schema, name, alisa);
}
public TemplateDef as(String alias) {
String key = getNameWithSchema() + "." + alias;
return getCache(key, k -> new TemplateDef("", "cg_template", alias));
}
}