You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.9 KiB
144 lines
4.9 KiB
package app
|
|
|
|
import (
|
|
"ln/nft/global"
|
|
"ln/nft/model/app"
|
|
"ln/nft/model/common/request"
|
|
appReq "ln/nft/model/app/request"
|
|
"ln/nft/model/common/response"
|
|
"ln/nft/service"
|
|
"github.com/gin-gonic/gin"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type AppHerbsNApi struct {
|
|
}
|
|
|
|
var appHerbsSService = service.ServiceGroupApp.AppServiceGroup.AppHerbsNService
|
|
|
|
|
|
// CreateAppHerbsN 创建AppHerbsN
|
|
// @Tags AppHerbsN
|
|
// @Summary 创建AppHerbsN
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body app.AppHerbsN true "创建AppHerbsN"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
|
// @Router /appHerbsS/createAppHerbsN [post]
|
|
func (appHerbsSApi *AppHerbsNApi) CreateAppHerbsN(c *gin.Context) {
|
|
var appHerbsS app.AppHerbsN
|
|
_ = c.ShouldBindJSON(&appHerbsS)
|
|
if err := appHerbsSService.CreateAppHerbsN(appHerbsS); err != nil {
|
|
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
|
response.FailWithMessage("创建失败", c)
|
|
} else {
|
|
response.OkWithMessage("创建成功", c)
|
|
}
|
|
}
|
|
|
|
// DeleteAppHerbsN 删除AppHerbsN
|
|
// @Tags AppHerbsN
|
|
// @Summary 删除AppHerbsN
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body app.AppHerbsN true "删除AppHerbsN"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
|
// @Router /appHerbsS/deleteAppHerbsN [delete]
|
|
func (appHerbsSApi *AppHerbsNApi) DeleteAppHerbsN(c *gin.Context) {
|
|
var appHerbsS app.AppHerbsN
|
|
_ = c.ShouldBindJSON(&appHerbsS)
|
|
if err := appHerbsSService.DeleteAppHerbsN(appHerbsS); err != nil {
|
|
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
|
response.FailWithMessage("删除失败", c)
|
|
} else {
|
|
response.OkWithMessage("删除成功", c)
|
|
}
|
|
}
|
|
|
|
// DeleteAppHerbsNByIds 批量删除AppHerbsN
|
|
// @Tags AppHerbsN
|
|
// @Summary 批量删除AppHerbsN
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.IdsReq true "批量删除AppHerbsN"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
|
|
// @Router /appHerbsS/deleteAppHerbsNByIds [delete]
|
|
func (appHerbsSApi *AppHerbsNApi) DeleteAppHerbsNByIds(c *gin.Context) {
|
|
var IDS request.IdsReq
|
|
_ = c.ShouldBindJSON(&IDS)
|
|
if err := appHerbsSService.DeleteAppHerbsNByIds(IDS); err != nil {
|
|
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
|
response.FailWithMessage("批量删除失败", c)
|
|
} else {
|
|
response.OkWithMessage("批量删除成功", c)
|
|
}
|
|
}
|
|
|
|
// UpdateAppHerbsN 更新AppHerbsN
|
|
// @Tags AppHerbsN
|
|
// @Summary 更新AppHerbsN
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body app.AppHerbsN true "更新AppHerbsN"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
|
// @Router /appHerbsS/updateAppHerbsN [put]
|
|
func (appHerbsSApi *AppHerbsNApi) UpdateAppHerbsN(c *gin.Context) {
|
|
var appHerbsS app.AppHerbsN
|
|
_ = c.ShouldBindJSON(&appHerbsS)
|
|
if err := appHerbsSService.UpdateAppHerbsN(appHerbsS); err != nil {
|
|
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
|
response.FailWithMessage("更新失败", c)
|
|
} else {
|
|
response.OkWithMessage("更新成功", c)
|
|
}
|
|
}
|
|
|
|
// FindAppHerbsN 用id查询AppHerbsN
|
|
// @Tags AppHerbsN
|
|
// @Summary 用id查询AppHerbsN
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data query app.AppHerbsN true "用id查询AppHerbsN"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
|
// @Router /appHerbsS/findAppHerbsN [get]
|
|
func (appHerbsSApi *AppHerbsNApi) FindAppHerbsN(c *gin.Context) {
|
|
var appHerbsS app.AppHerbsN
|
|
_ = c.ShouldBindQuery(&appHerbsS)
|
|
if reappHerbsS, err := appHerbsSService.GetAppHerbsN(appHerbsS.ID); err != nil {
|
|
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
|
response.FailWithMessage("查询失败", c)
|
|
} else {
|
|
response.OkWithData(gin.H{"reappHerbsS": reappHerbsS}, c)
|
|
}
|
|
}
|
|
|
|
// GetAppHerbsNList 分页获取AppHerbsN列表
|
|
// @Tags AppHerbsN
|
|
// @Summary 分页获取AppHerbsN列表
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data query appReq.AppHerbsNSearch true "分页获取AppHerbsN列表"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
|
// @Router /appHerbsS/getAppHerbsNList [get]
|
|
func (appHerbsSApi *AppHerbsNApi) GetAppHerbsNList(c *gin.Context) {
|
|
var pageInfo appReq.AppHerbsNSearch
|
|
_ = c.ShouldBindQuery(&pageInfo)
|
|
if list, total, err := appHerbsSService.GetAppHerbsNInfoList(pageInfo); err != nil {
|
|
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
|
response.FailWithMessage("获取失败", c)
|
|
} else {
|
|
response.OkWithDetailed(response.PageResult{
|
|
List: list,
|
|
Total: total,
|
|
Page: pageInfo.Page,
|
|
PageSize: pageInfo.PageSize,
|
|
}, "获取成功", c)
|
|
}
|
|
}
|