// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
|
|
package pm
|
|
|
|
import (
|
|
model "LAPP_GAAS_GFrame_BACKEND/models/pm"
|
|
"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 : RegisterOneTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理单条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterOneTemplateServiceLst(party router.Party, httpMethod string, path string, method func(*models.Usertab, *model.TemplateServiceLst) 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.TemplateServiceLst)
|
|
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 : RegisterIDOfTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个通过主键处理单条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterIDOfTemplateServiceLst(party router.Party, httpMethod string, path string, method func(*models.Usertab, int, 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
|
|
mainTemplateNr, err := ctx.Params().GetInt("mainTemplateNr")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
mainServiceNr, err := ctx.Params().GetInt("mainServiceNr")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
|
|
err = method(user, mainTemplateNr, mainServiceNr)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertOneTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入单条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertOneTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, *model.TemplateServiceLst) error) {
|
|
|
|
RegisterOneTemplateServiceLst(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteOneTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除单条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteOneTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, int, int) error) {
|
|
|
|
RegisterIDOfTemplateServiceLst(party, "DELETE", path+"/{mainTemplateNr:int}/{mainServiceNr:int}", method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectOneTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查找单条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectOneTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, int, int) (*model.TemplateServiceLst, error)) {
|
|
|
|
party.Get(path+"/{mainTemplateNr:int}/{mainServiceNr:int}", func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
mainTemplateNr, err := ctx.Params().GetInt("mainTemplateNr")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
mainServiceNr, err := ctx.Params().GetInt("mainServiceNr")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
result, err := method(user, mainTemplateNr, mainServiceNr)
|
|
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 : RegisterUpdateOneTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改单条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateOneTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, *model.TemplateServiceLst) error) {
|
|
|
|
RegisterOneTemplateServiceLst(party, "PUT", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterMultiTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理多条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterMultiTemplateServiceLst(party router.Party, httpMethod string, path string, method func(*models.Usertab, *[]model.TemplateServiceLst) 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.TemplateServiceLst, 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 : RegisterInsertTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入多条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, *[]model.TemplateServiceLst) error) {
|
|
|
|
RegisterMultiTemplateServiceLst(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除多条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, *[]model.TemplateServiceLst) error) {
|
|
|
|
RegisterMultiTemplateServiceLst(party, "DELETE", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查询TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectTemplateServiceLst(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 : RegisterUpdateTemplateServiceLst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改多条TemplateServiceLst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-04-13 11:00:13
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateTemplateServiceLst(party router.Party, path string, method func(*models.Usertab, *[]model.TemplateServiceLst) error) {
|
|
|
|
RegisterMultiTemplateServiceLst(party, "PUT", path, method)
|
|
}
|