111 lines
5.3 KiB
Go
111 lines
5.3 KiB
Go
package v1
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/util/gmeta"
|
|
)
|
|
|
|
// ============================== 字典项模块 ==============================
|
|
|
|
// DictItemItemRow 字典项行数据
|
|
// 用于字典项分页列表等场景的字典项基础信息
|
|
type DictItemItemRow struct {
|
|
Id int64 `json:"id"` // 主键ID
|
|
DictId int64 `json:"dictId"` // 所属字典ID
|
|
DictName string `json:"dictName"` // 所属字典名称
|
|
DictCode string `json:"dictCode"` // 所属字典编码
|
|
Name string `json:"name"` // 字典项名称
|
|
Value string `json:"value"` // 字典项值
|
|
Sort int `json:"sort"` // 排序
|
|
Note string `json:"note"` // 备注
|
|
CreateUser string `json:"createUser"` // 创建人
|
|
}
|
|
|
|
// DictItemPageReq 字典项分页请求
|
|
// 支持关键词、字典项名称、所属字典等条件组合查询
|
|
type DictItemPageReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/dict/item/page" summary:"字典项分页" permission:"sys:dictitem:page" log:"字典项管理-查询分页记录" logType:"query"`
|
|
PageReq // 分页基础参数
|
|
Keyword string `json:"keyword" dc:"关键词(名称/值模糊)"` // 关键词,名称或值模糊匹配
|
|
Name string `json:"name" dc:"字典项名称模糊"` // 字典项名称模糊匹配
|
|
DictId int64 `json:"dictId" dc:"所属字典ID"` // 所属字典ID
|
|
}
|
|
|
|
// DictItemPageRes 字典项分页结果
|
|
type DictItemPageRes = PageData[DictItemItemRow]
|
|
|
|
// DictItemDetailReq 字典项详情请求
|
|
type DictItemDetailReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/dict/item/detail/:id" summary:"字典项详情" permission:"sys:dictitem:detail" log:"字典项管理-查询详情" logType:"query"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"字典项ID"` // 字典项ID
|
|
}
|
|
|
|
// DictItemDetailRes 字典项详情结果
|
|
type DictItemDetailRes struct {
|
|
Id int64 `json:"id"` // 主键ID
|
|
DictId int64 `json:"dictId"` // 所属字典ID
|
|
Name string `json:"name"` // 字典项名称
|
|
Value string `json:"value"` // 字典项值
|
|
Sort int `json:"sort"` // 排序
|
|
Note string `json:"note"` // 备注
|
|
}
|
|
|
|
// DictItemAddReq 新增字典项请求
|
|
type DictItemAddReq struct {
|
|
gmeta.Meta `method:"post" path:"/api/dict/item/add" summary:"新增字典项" permission:"sys:dictitem:add" log:"字典项管理-新增记录" logType:"add"`
|
|
DictId int64 `json:"dictId" v:"required#请选择所属字典" dc:"所属字典ID"` // 所属字典ID
|
|
Name string `json:"name" v:"required#请输入字典项名称" dc:"字典项名称"` // 字典项名称
|
|
Value string `json:"value" v:"required#请输入字典项值" dc:"字典项值"` // 字典项值
|
|
Sort int `json:"sort" dc:"排序"` // 排序
|
|
Note string `json:"note" dc:"备注"` // 备注
|
|
}
|
|
|
|
// DictItemUpdateReq 修改字典项请求
|
|
type DictItemUpdateReq struct {
|
|
gmeta.Meta `method:"put" path:"/api/dict/item/update" summary:"修改字典项" permission:"sys:dictitem:update" log:"字典项管理-修改记录" logType:"update"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"字典项ID"` // 字典项ID
|
|
DictId int64 `json:"dictId" dc:"所属字典ID"` // 所属字典ID
|
|
Name string `json:"name" v:"required#请输入字典项名称" dc:"字典项名称"` // 字典项名称
|
|
Value string `json:"value" v:"required#请输入字典项值" dc:"字典项值"` // 字典项值
|
|
Sort int `json:"sort" dc:"排序"` // 排序
|
|
Note string `json:"note" dc:"备注"` // 备注
|
|
}
|
|
|
|
// DictItemUpdateRes 修改字典项结果
|
|
type DictItemUpdateRes struct{}
|
|
|
|
// DictItemDeleteReq 删除字典项请求
|
|
type DictItemDeleteReq struct {
|
|
gmeta.Meta `method:"delete" path:"/api/dict/item/delete/:id" summary:"删除字典项" permission:"sys:dictitem:delete" log:"字典项管理-删除记录" logType:"delete"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"字典项ID"` // 字典项ID
|
|
}
|
|
|
|
// DictItemDeleteRes 删除字典项结果
|
|
type DictItemDeleteRes struct{}
|
|
|
|
// DictItemBatchDeleteReq 批量删除字典项请求
|
|
type DictItemBatchDeleteReq struct {
|
|
gmeta.Meta `method:"delete" path:"/api/dict/item/batchDelete" summary:"批量删除字典项" permission:"sys:dictitem:batchDelete" log:"字典项管理-批量删除记录" logType:"delete"`
|
|
Ids []int64 `json:"ids" v:"required#请选择要删除的记录" dc:"字典项ID列表"` // 字典项ID列表
|
|
}
|
|
|
|
// DictItemBatchDeleteRes 批量删除结果
|
|
type DictItemBatchDeleteRes struct{}
|
|
|
|
// DictItemQuickListReq 快捷字典项列表请求
|
|
// 登录用户即可访问,按字典编码查询并走缓存
|
|
type DictItemQuickListReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/dict/item/getDictItemList/:code" summary:"按编码查询字典项" log:"字典项管理-查询列表" logType:"query"`
|
|
Code string `json:"code" v:"required#请输入字典编码" dc:"字典编码"` // 字典编码
|
|
}
|
|
|
|
// DictItemQuickRow 快捷字典项行数据
|
|
// 精简结构,仅包含前端下拉等场景所需字段
|
|
type DictItemQuickRow struct {
|
|
Id int64 `json:"id"` // 主键ID
|
|
Name string `json:"name"` // 字典项名称
|
|
Value string `json:"value"` // 字典项值
|
|
}
|
|
|
|
// DictItemQuickListRes 快捷字典项列表结果
|
|
type DictItemQuickListRes = []DictItemQuickRow
|