mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
【更新】更新restful
This commit is contained in:
@@ -15,17 +15,6 @@ type DictApi struct {
|
||||
DictData services.SysDictDataModel
|
||||
}
|
||||
|
||||
// @Summary 字典类型列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Param dictName query string false "DictName"
|
||||
// @Param dictName query string false "dictType"
|
||||
// @Param status query string false "status"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/type/list [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictTypeList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||
@@ -42,28 +31,11 @@ func (p *DictApi) GetDictTypeList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取字典类型
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictId path int true "dictId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/type/{dictId} [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictType(rc *restfulx.ReqCtx) {
|
||||
dictId := restfulx.PathParamInt(rc, "dictId")
|
||||
p.DictType.FindOne(int64(dictId))
|
||||
}
|
||||
|
||||
// @Summary 添加字典类型
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictType true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/type [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) InsertDictType(rc *restfulx.ReqCtx) {
|
||||
var dict entity.SysDictType
|
||||
restfulx.BindQuery(rc, &dict)
|
||||
@@ -72,16 +44,6 @@ func (p *DictApi) InsertDictType(rc *restfulx.ReqCtx) {
|
||||
p.DictType.Insert(dict)
|
||||
}
|
||||
|
||||
// @Summary 修改字典类型
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictType true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/type [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) UpdateDictType(rc *restfulx.ReqCtx) {
|
||||
var dict entity.SysDictType
|
||||
restfulx.BindQuery(rc, &dict)
|
||||
@@ -90,13 +52,6 @@ func (p *DictApi) UpdateDictType(rc *restfulx.ReqCtx) {
|
||||
p.DictType.Update(dict)
|
||||
}
|
||||
|
||||
// @Summary 删除字典类型
|
||||
// @Description 删除数据
|
||||
// @Tags 字典
|
||||
// @Param dictId path string true "dictId "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/{dictId} [delete]
|
||||
func (p *DictApi) DeleteDictType(rc *restfulx.ReqCtx) {
|
||||
dictId := restfulx.PathParam(rc, "dictId")
|
||||
dictIds := utils.IdsStrToIdsIntGroup(dictId)
|
||||
@@ -114,15 +69,6 @@ func (p *DictApi) DeleteDictType(rc *restfulx.ReqCtx) {
|
||||
p.DictType.Delete(deList)
|
||||
}
|
||||
|
||||
// @Summary 导出字典类型
|
||||
// @Description 导出数据
|
||||
// @Tags 字典
|
||||
// @Param dictName query string false "DictName"
|
||||
// @Param dictName query string false "dictType"
|
||||
// @Param status query string false "status"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/type/export [get]
|
||||
func (p *DictApi) ExportDictType(rc *restfulx.ReqCtx) {
|
||||
filename := restfulx.QueryParam(rc, "filename")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
@@ -135,15 +81,6 @@ func (p *DictApi) ExportDictType(rc *restfulx.ReqCtx) {
|
||||
rc.Download(fileName)
|
||||
}
|
||||
|
||||
// @Summary 字典数据列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictLabel query string false "dictLabel"
|
||||
// @Param dictType query string false "dictType"
|
||||
// @Param status query string false "status"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/list [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictDataList(rc *restfulx.ReqCtx) {
|
||||
dictLabel := restfulx.QueryParam(rc, "dictLabel")
|
||||
dictType := restfulx.QueryParam(rc, "dictType")
|
||||
@@ -151,41 +88,17 @@ func (p *DictApi) GetDictDataList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = p.DictData.FindList(entity.SysDictData{Status: status, DictType: dictType, DictLabel: dictLabel})
|
||||
}
|
||||
|
||||
// @Summary 字典数据获取
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictType path string false "dictType"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/type [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictDataListByDictType(rc *restfulx.ReqCtx) {
|
||||
dictType := restfulx.QueryParam(rc, "dictType")
|
||||
biz.IsTrue(dictType != "", "请传入字典类型")
|
||||
rc.ResData = p.DictData.FindList(entity.SysDictData{DictType: dictType})
|
||||
}
|
||||
|
||||
// @Summary 获取字典数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Param dictCode path int true "dictCode"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/dict/data/{dictCode} [get]
|
||||
// @Security
|
||||
func (p *DictApi) GetDictData(rc *restfulx.ReqCtx) {
|
||||
dictCode := restfulx.PathParamInt(rc, "dictCode")
|
||||
p.DictData.FindOne(int64(dictCode))
|
||||
}
|
||||
|
||||
// @Summary 添加字典数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictData true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/data [post]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) InsertDictData(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysDictData
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -193,16 +106,6 @@ func (p *DictApi) InsertDictData(rc *restfulx.ReqCtx) {
|
||||
p.DictData.Insert(data)
|
||||
}
|
||||
|
||||
// @Summary 修改字典数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysDictData true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/dict/data [put]
|
||||
// @Security X-TOKEN
|
||||
func (p *DictApi) UpdateDictData(rc *restfulx.ReqCtx) {
|
||||
var data entity.SysDictData
|
||||
restfulx.BindQuery(rc, &data)
|
||||
@@ -211,13 +114,6 @@ func (p *DictApi) UpdateDictData(rc *restfulx.ReqCtx) {
|
||||
p.DictData.Update(data)
|
||||
}
|
||||
|
||||
// @Summary 删除字典数据
|
||||
// @Description 删除数据
|
||||
// @Tags 字典
|
||||
// @Param dictCode path string true "dictCode "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/dict/data/{dictCode} [delete]
|
||||
func (p *DictApi) DeleteDictData(rc *restfulx.ReqCtx) {
|
||||
dictCode := restfulx.PathParam(rc, "dictCode")
|
||||
p.DictData.Delete(utils.IdsStrToIdsIntGroup(dictCode))
|
||||
|
||||
Reference in New Issue
Block a user