// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
|
|
package base
|
|
|
|
import (
|
|
model "LAPP_GAAS_GFrame_BACKEND/models/base"
|
|
"LAPP_GAAS_GFrame_BACKEND/web/middleware/jwts"
|
|
"LAPP_GAAS_GFrame_BACKEND/web/models"
|
|
"LAPP_GAAS_GFrame_BACKEND/web/supports"
|
|
"github.com/kataras/iris/v12"
|
|
"github.com/kataras/iris/v12/core/router"
|
|
)
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterOneLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理单条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterOneLabelParserDetailLst(party router.Party, httpMethod string, path string, method func(*models.Usertab, *model.LabelParserDetailLst) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
var err error = nil
|
|
|
|
entity := new(model.LabelParserDetailLst)
|
|
if ctx.GetContentLength() > 0 {
|
|
err := ctx.ReadJSON(entity)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
} else {
|
|
entity = nil
|
|
}
|
|
|
|
err = method(user, entity)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterIDOfLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个通过主键处理单条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterIDOfLabelParserDetailLst(party router.Party, httpMethod string, path string, method func(*models.Usertab, string, int) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
var err error = nil
|
|
parserId := ctx.Params().GetString("parserId")
|
|
pos, err := ctx.Params().GetInt("pos")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
|
|
err = method(user, parserId, pos)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertOneLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入单条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertOneLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, *model.LabelParserDetailLst) error) {
|
|
|
|
RegisterOneLabelParserDetailLst(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteOneLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除单条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteOneLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, string, int) error) {
|
|
|
|
RegisterIDOfLabelParserDetailLst(party, "DELETE", path+"/{parserId:string}/{pos:int}", method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectOneLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查找单条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectOneLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, string, int) (*model.LabelParserDetailLst, error)) {
|
|
|
|
party.Get(path+"/{parserId:string}/{pos:int}", func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
parserId := ctx.Params().GetString("parserId")
|
|
pos, err := ctx.Params().GetInt("pos")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
result, err := method(user, parserId, pos)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
if result == nil {
|
|
supports.Error(ctx, iris.StatusNotFound, supports.NotFound, nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, result)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterUpdateOneLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改单条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateOneLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, *model.LabelParserDetailLst) error) {
|
|
|
|
RegisterOneLabelParserDetailLst(party, "PUT", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterMultiLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理多条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterMultiLabelParserDetailLst(party router.Party, httpMethod string, path string, method func(*models.Usertab, *[]model.LabelParserDetailLst) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
entities := make([]model.LabelParserDetailLst, 0, 10)
|
|
err := ctx.ReadJSON(&entities)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
|
|
err = method(user, &entities)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入多条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, *[]model.LabelParserDetailLst) error) {
|
|
|
|
RegisterMultiLabelParserDetailLst(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除多条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, *[]model.LabelParserDetailLst) error) {
|
|
|
|
RegisterMultiLabelParserDetailLst(party, "DELETE", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查询LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, map[string]string) (interface{}, error)) {
|
|
|
|
party.Get(path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
result, err := method(user, ctx.URLParams())
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, result)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterUpdateLabelParserDetailLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改多条LabelParserDetailLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-06-02 09:38:09
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateLabelParserDetailLst(party router.Party, path string, method func(*models.Usertab, *[]model.LabelParserDetailLst) error) {
|
|
|
|
RegisterMultiLabelParserDetailLst(party, "PUT", path, method)
|
|
}
|