签入脚本
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"easygoadmin/api/v1"
|
||||
"easygoadmin/internal/service"
|
||||
)
|
||||
|
||||
// ============================== 字典控制器 ==============================
|
||||
|
||||
// CDict 字典控制器
|
||||
// 薄层控制器,仅负责参数透传,业务逻辑由 service.Dict() 处理
|
||||
type CDict struct{}
|
||||
|
||||
// Page 字典分页
|
||||
// 按查询条件分页返回字典列表
|
||||
func (c *CDict) Page(ctx context.Context, req *v1.DictPageReq) (res *v1.DictPageRes, err error) {
|
||||
return service.Dict().Page(ctx, req)
|
||||
}
|
||||
|
||||
// Detail 字典详情
|
||||
// 按字典ID查询详情及其下的字典项集合
|
||||
func (c *CDict) Detail(ctx context.Context, req *v1.DictDetailReq) (res *v1.DictDetailRes, err error) {
|
||||
return service.Dict().Detail(ctx, req)
|
||||
}
|
||||
|
||||
// Add 新增字典
|
||||
// 新增成功后返回新记录ID
|
||||
func (c *CDict) Add(ctx context.Context, req *v1.DictAddReq) (res *v1.IdRes, err error) {
|
||||
return service.Dict().Add(ctx, req)
|
||||
}
|
||||
|
||||
// Update 修改字典
|
||||
// 按字典ID更新记录
|
||||
func (c *CDict) Update(ctx context.Context, req *v1.DictUpdateReq) (res *v1.DictUpdateRes, err error) {
|
||||
return service.Dict().Update(ctx, req)
|
||||
}
|
||||
|
||||
// Delete 删除字典
|
||||
// 按字典ID删除单条记录
|
||||
func (c *CDict) Delete(ctx context.Context, req *v1.DictDeleteReq) (res *v1.DictDeleteRes, err error) {
|
||||
return service.Dict().Delete(ctx, req)
|
||||
}
|
||||
|
||||
// BatchDelete 批量删除字典
|
||||
// 按字典ID列表批量删除记录
|
||||
func (c *CDict) BatchDelete(ctx context.Context, req *v1.DictBatchDeleteReq) (res *v1.DictBatchDeleteRes, err error) {
|
||||
return service.Dict().BatchDelete(ctx, req)
|
||||
}
|
||||
|
||||
// RefreshCache 刷新字典缓存
|
||||
// 按字典编码刷新缓存,编码为空时刷新全部
|
||||
func (c *CDict) RefreshCache(ctx context.Context, req *v1.DictRefreshCacheReq) (res *v1.DictRefreshCacheRes, err error) {
|
||||
return service.Dict().RefreshCache(ctx, req)
|
||||
}
|
||||
|
||||
// AliasList 字典别名列表
|
||||
// 登录用户即可访问,供前端字典查询场景使用
|
||||
func (c *CDict) AliasList(ctx context.Context, req *v1.DictAliasListReq) (res v1.DictAliasListRes, err error) {
|
||||
return service.Dict().AliasList(ctx, req)
|
||||
}
|
||||
|
||||
// AliasInfo 字典别名详情
|
||||
// 登录用户即可访问,按字典编码查询字典及其字典项
|
||||
func (c *CDict) AliasInfo(ctx context.Context, req *v1.DictAliasInfoReq) (res *v1.DictAliasInfoRes, err error) {
|
||||
return service.Dict().AliasInfo(ctx, req)
|
||||
}
|
||||
Reference in New Issue
Block a user