// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved.
|
|
|
|
package jit
|
|
|
|
import (
|
|
"LAPP_ACURA_MOM_BACKEND/global"
|
|
"LAPP_ACURA_MOM_BACKEND/grmi"
|
|
model "LAPP_ACURA_MOM_BACKEND/models/jit"
|
|
"LAPP_ACURA_MOM_BACKEND/web/middleware/jwts"
|
|
"LAPP_ACURA_MOM_BACKEND/web/supports"
|
|
"github.com/kataras/iris/v12"
|
|
"github.com/kataras/iris/v12/core/router"
|
|
)
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterOneShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理单条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterOneShipOrderStatusHistory(party router.Party, httpMethod string, path string, method func(*global.User, *model.ShipOrderStatusHistory) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
var err error = nil
|
|
|
|
entity := new(model.ShipOrderStatusHistory)
|
|
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 : RegisterIDOfShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个通过主键处理单条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterIDOfShipOrderStatusHistory(party router.Party, httpMethod string, path string, method func(*global.User, string, int) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
var err error = nil
|
|
shipOrderId := ctx.Params().GetString("shipOrderId")
|
|
pos, err := ctx.Params().GetInt("pos")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
|
|
err = method(user, shipOrderId, pos)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, nil)
|
|
})
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterInsertOneShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入单条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertOneShipOrderStatusHistory(party router.Party, path string, method func(*global.User, *model.ShipOrderStatusHistory) error) {
|
|
|
|
RegisterOneShipOrderStatusHistory(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteOneShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除单条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteOneShipOrderStatusHistory(party router.Party, path string, method func(*global.User, string, int) error) {
|
|
|
|
RegisterIDOfShipOrderStatusHistory(party, "DELETE", path+"/{shipOrderId:string}/{pos:int}", method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectOneShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查找单条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectOneShipOrderStatusHistory(party router.Party, path string, method func(*global.User, string, int) (*model.ShipOrderStatusHistory, error)) {
|
|
|
|
party.Get(path+"/{shipOrderId:string}/{pos:int}", func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
shipOrderId := ctx.Params().GetString("shipOrderId")
|
|
pos, err := ctx.Params().GetInt("pos")
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil)
|
|
return
|
|
}
|
|
result, err := method(user, shipOrderId, 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 : RegisterUpdateOneShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改单条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateOneShipOrderStatusHistory(party router.Party, path string, method func(*global.User, *model.ShipOrderStatusHistory) error) {
|
|
|
|
RegisterOneShipOrderStatusHistory(party, "PUT", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterMultiShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个处理多条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : HTTP方法
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterMultiShipOrderStatusHistory(party router.Party, httpMethod string, path string, method func(*global.User, *[]model.ShipOrderStatusHistory) error) {
|
|
|
|
party.Handle(httpMethod, path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
entities := make([]model.ShipOrderStatusHistory, 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 : RegisterInsertShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个插入多条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterInsertShipOrderStatusHistory(party router.Party, path string, method func(*global.User, *[]model.ShipOrderStatusHistory) error) {
|
|
|
|
RegisterMultiShipOrderStatusHistory(party, "POST", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterDeleteShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个删除多条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterDeleteShipOrderStatusHistory(party router.Party, path string, method func(*global.User, *[]model.ShipOrderStatusHistory) error) {
|
|
|
|
RegisterMultiShipOrderStatusHistory(party, "DELETE", path, method)
|
|
}
|
|
|
|
/******************************************************************************
|
|
*
|
|
* @Function Name : RegisterSelectShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查询ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterSelectShipOrderStatusHistory(party router.Party, path string, method func(*global.User, map[string]string) ([]model.ShipOrderStatusHistory, error)) {
|
|
|
|
party.Get(path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
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 : RegisterQueryShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个查询ShipOrderStatusHistory并分页的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterQueryShipOrderStatusHistory(party router.Party, path string, method func(*global.User, map[string]string) (grmi.PagingResult, error)) {
|
|
|
|
party.Get(path, func(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
if !ok {
|
|
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 : RegisterUpdateShipOrderStatusHistory
|
|
*-----------------------------------------------------------------------------
|
|
*
|
|
* @Description : 为一个修改多条ShipOrderStatusHistory的方法注册路由
|
|
*
|
|
* @Function Parameters : 路由分组
|
|
*
|
|
* @Function Parameters : 路径
|
|
*
|
|
* @Function Parameters : 实际处理请求的方法
|
|
*
|
|
* @Author : 代码生成器创建
|
|
*
|
|
* @Date : 2021-10-19 10:26:40
|
|
*
|
|
******************************************************************************/
|
|
func RegisterUpdateShipOrderStatusHistory(party router.Party, path string, method func(*global.User, *[]model.ShipOrderStatusHistory) error) {
|
|
|
|
RegisterMultiShipOrderStatusHistory(party, "PUT", path, method)
|
|
}
|