// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
|
|
package qm
|
|
|
|
import (
|
|
model "LAPP_LF_MOM_BACKEND/models/qm"
|
|
"LAPP_LF_MOM_BACKEND/web/middleware/jwts"
|
|
"LAPP_LF_MOM_BACKEND/web/models"
|
|
"LAPP_LF_MOM_BACKEND/web/supports"
|
|
"github.com/kataras/iris/v12"
|
|
"github.com/kataras/iris/v12/core/router"
|
|
)
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterOneViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理单条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterOneViewDefectlst(party router.Party, httpMethod string, path string, method func(*models.Usertab, *model.ViewDefectlst) 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.ViewDefectlst)
|
|
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 : RegisterIDOfViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个通过主键处理单条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterIDOfViewDefectlst(party router.Party, httpMethod string, path string, method func(*models.Usertab, string, string) 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
|
|
viewId := ctx.Params().GetString("viewId")
|
|
defectReasonId := ctx.Params().GetString("defectReasonId")
|
|
|
|
err = method(user, viewId, defectReasonId)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertOneViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入单条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertOneViewDefectlst(party router.Party, path string, method func(*models.Usertab, *model.ViewDefectlst) error) {
|
|
|
|
RegisterOneViewDefectlst(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteOneViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除单条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteOneViewDefectlst(party router.Party, path string, method func(*models.Usertab, string, string) error) {
|
|
|
|
RegisterIDOfViewDefectlst(party, "DELETE", path+"/{viewId:string}/{defectReasonId:string}", method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectOneViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查找单条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectOneViewDefectlst(party router.Party, path string, method func(*models.Usertab, string, string) (*model.ViewDefectlst, error)) {
|
|
|
|
party.Get(path+"/{viewId:string}/{defectReasonId:string}", func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
|
|
viewId := ctx.Params().GetString("viewId")
|
|
defectReasonId := ctx.Params().GetString("defectReasonId")
|
|
result, err := method(user, viewId, defectReasonId)
|
|
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 : RegisterUpdateOneViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改单条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateOneViewDefectlst(party router.Party, path string, method func(*models.Usertab, *model.ViewDefectlst) error) {
|
|
|
|
RegisterOneViewDefectlst(party, "PUT", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterMultiViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理多条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterMultiViewDefectlst(party router.Party, httpMethod string, path string, method func(*models.Usertab, *[]model.ViewDefectlst) 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.ViewDefectlst, 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 : RegisterInsertViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入多条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertViewDefectlst(party router.Party, path string, method func(*models.Usertab, *[]model.ViewDefectlst) error) {
|
|
|
|
RegisterMultiViewDefectlst(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除多条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteViewDefectlst(party router.Party, path string, method func(*models.Usertab, *[]model.ViewDefectlst) error) {
|
|
|
|
RegisterMultiViewDefectlst(party, "DELETE", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查询ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectViewDefectlst(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 : RegisterUpdateViewDefectlst
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改多条ViewDefectlst的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-03-18 22:49:12
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateViewDefectlst(party router.Party, path string, method func(*models.Usertab, *[]model.ViewDefectlst) error) {
|
|
|
|
RegisterMultiViewDefectlst(party, "PUT", path, method)
|
|
}
|