This commit is contained in:
@@ -2,6 +2,7 @@ package v1
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/example"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/pet"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/system"
|
||||
)
|
||||
|
||||
@@ -10,4 +11,5 @@ var ApiGroupApp = new(ApiGroup)
|
||||
type ApiGroup struct {
|
||||
SystemApiGroup system.ApiGroup
|
||||
ExampleApiGroup example.ApiGroup
|
||||
PetApiGroup pet.ApiGroup
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package pet
|
||||
|
||||
import "github.com/flipped-aurora/gin-vue-admin/server/service"
|
||||
|
||||
type ApiGroup struct {
|
||||
PetAdoptionApplicationsApi
|
||||
PetAdoptionPostsApi
|
||||
PetAiAssistantConversationsApi
|
||||
PetAiConversationsApi
|
||||
PetFamiliesApi
|
||||
PetFamilyInvitationsApi
|
||||
PetFamilyMembersApi
|
||||
PetFamilyPetsApi
|
||||
PetPetsApi
|
||||
PetRecordsApi
|
||||
}
|
||||
|
||||
var (
|
||||
petAdoptionApplicationsService = service.ServiceGroupApp.PetServiceGroup.PetAdoptionApplicationsService
|
||||
petAdoptionPostsService = service.ServiceGroupApp.PetServiceGroup.PetAdoptionPostsService
|
||||
petAiAssistantConversationsService = service.ServiceGroupApp.PetServiceGroup.PetAiAssistantConversationsService
|
||||
petAiConversationsService = service.ServiceGroupApp.PetServiceGroup.PetAiConversationsService
|
||||
petFamiliesService = service.ServiceGroupApp.PetServiceGroup.PetFamiliesService
|
||||
petFamilyInvitationsService = service.ServiceGroupApp.PetServiceGroup.PetFamilyInvitationsService
|
||||
petFamilyMembersService = service.ServiceGroupApp.PetServiceGroup.PetFamilyMembersService
|
||||
petFamilyPetsService = service.ServiceGroupApp.PetServiceGroup.PetFamilyPetsService
|
||||
petPetsService = service.ServiceGroupApp.PetServiceGroup.PetPetsService
|
||||
petRecordsService = service.ServiceGroupApp.PetServiceGroup.PetRecordsService
|
||||
)
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetAdoptionApplicationsApi struct{}
|
||||
|
||||
// CreatePetAdoptionApplications 创建petAdoptionApplications表
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 创建petAdoptionApplications表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAdoptionApplications true "创建petAdoptionApplications表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petAdoptionApplications/createPetAdoptionApplications [post]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) CreatePetAdoptionApplications(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAdoptionApplications pet.PetAdoptionApplications
|
||||
err := c.ShouldBindJSON(&petAdoptionApplications)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAdoptionApplicationsService.CreatePetAdoptionApplications(ctx, &petAdoptionApplications)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAdoptionApplications 删除petAdoptionApplications表
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 删除petAdoptionApplications表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAdoptionApplications true "删除petAdoptionApplications表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petAdoptionApplications/deletePetAdoptionApplications [delete]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) DeletePetAdoptionApplications(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petAdoptionApplicationsService.DeletePetAdoptionApplications(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAdoptionApplicationsByIds 批量删除petAdoptionApplications表
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 批量删除petAdoptionApplications表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petAdoptionApplications/deletePetAdoptionApplicationsByIds [delete]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) DeletePetAdoptionApplicationsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petAdoptionApplicationsService.DeletePetAdoptionApplicationsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetAdoptionApplications 更新petAdoptionApplications表
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 更新petAdoptionApplications表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAdoptionApplications true "更新petAdoptionApplications表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petAdoptionApplications/updatePetAdoptionApplications [put]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) UpdatePetAdoptionApplications(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAdoptionApplications pet.PetAdoptionApplications
|
||||
err := c.ShouldBindJSON(&petAdoptionApplications)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAdoptionApplicationsService.UpdatePetAdoptionApplications(ctx, petAdoptionApplications)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetAdoptionApplications 用id查询petAdoptionApplications表
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 用id查询petAdoptionApplications表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petAdoptionApplications表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetAdoptionApplications,msg=string} "查询成功"
|
||||
// @Router /petAdoptionApplications/findPetAdoptionApplications [get]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) FindPetAdoptionApplications(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetAdoptionApplications, err := petAdoptionApplicationsService.GetPetAdoptionApplications(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetAdoptionApplications, c)
|
||||
}
|
||||
|
||||
// GetPetAdoptionApplicationsList 分页获取petAdoptionApplications表列表
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 分页获取petAdoptionApplications表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetAdoptionApplicationsSearch true "分页获取petAdoptionApplications表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petAdoptionApplications/getPetAdoptionApplicationsList [get]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) GetPetAdoptionApplicationsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetAdoptionApplicationsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petAdoptionApplicationsService.GetPetAdoptionApplicationsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetAdoptionApplicationsPublic 不需要鉴权的petAdoptionApplications表接口
|
||||
// @Tags PetAdoptionApplications
|
||||
// @Summary 不需要鉴权的petAdoptionApplications表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petAdoptionApplications/getPetAdoptionApplicationsPublic [get]
|
||||
func (petAdoptionApplicationsApi *PetAdoptionApplicationsApi) GetPetAdoptionApplicationsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petAdoptionApplicationsService.GetPetAdoptionApplicationsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petAdoptionApplications表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetAdoptionPostsApi struct{}
|
||||
|
||||
// CreatePetAdoptionPosts 创建petAdoptionPosts表
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 创建petAdoptionPosts表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAdoptionPosts true "创建petAdoptionPosts表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petAdoptionPosts/createPetAdoptionPosts [post]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) CreatePetAdoptionPosts(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAdoptionPosts pet.PetAdoptionPosts
|
||||
err := c.ShouldBindJSON(&petAdoptionPosts)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAdoptionPostsService.CreatePetAdoptionPosts(ctx, &petAdoptionPosts)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAdoptionPosts 删除petAdoptionPosts表
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 删除petAdoptionPosts表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAdoptionPosts true "删除petAdoptionPosts表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petAdoptionPosts/deletePetAdoptionPosts [delete]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) DeletePetAdoptionPosts(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petAdoptionPostsService.DeletePetAdoptionPosts(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAdoptionPostsByIds 批量删除petAdoptionPosts表
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 批量删除petAdoptionPosts表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petAdoptionPosts/deletePetAdoptionPostsByIds [delete]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) DeletePetAdoptionPostsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petAdoptionPostsService.DeletePetAdoptionPostsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetAdoptionPosts 更新petAdoptionPosts表
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 更新petAdoptionPosts表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAdoptionPosts true "更新petAdoptionPosts表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petAdoptionPosts/updatePetAdoptionPosts [put]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) UpdatePetAdoptionPosts(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAdoptionPosts pet.PetAdoptionPosts
|
||||
err := c.ShouldBindJSON(&petAdoptionPosts)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAdoptionPostsService.UpdatePetAdoptionPosts(ctx, petAdoptionPosts)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetAdoptionPosts 用id查询petAdoptionPosts表
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 用id查询petAdoptionPosts表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petAdoptionPosts表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetAdoptionPosts,msg=string} "查询成功"
|
||||
// @Router /petAdoptionPosts/findPetAdoptionPosts [get]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) FindPetAdoptionPosts(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetAdoptionPosts, err := petAdoptionPostsService.GetPetAdoptionPosts(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetAdoptionPosts, c)
|
||||
}
|
||||
|
||||
// GetPetAdoptionPostsList 分页获取petAdoptionPosts表列表
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 分页获取petAdoptionPosts表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetAdoptionPostsSearch true "分页获取petAdoptionPosts表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petAdoptionPosts/getPetAdoptionPostsList [get]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) GetPetAdoptionPostsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetAdoptionPostsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petAdoptionPostsService.GetPetAdoptionPostsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetAdoptionPostsPublic 不需要鉴权的petAdoptionPosts表接口
|
||||
// @Tags PetAdoptionPosts
|
||||
// @Summary 不需要鉴权的petAdoptionPosts表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petAdoptionPosts/getPetAdoptionPostsPublic [get]
|
||||
func (petAdoptionPostsApi *PetAdoptionPostsApi) GetPetAdoptionPostsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petAdoptionPostsService.GetPetAdoptionPostsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petAdoptionPosts表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetAiAssistantConversationsApi struct{}
|
||||
|
||||
// CreatePetAiAssistantConversations 创建petAiAssistantConversations表
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 创建petAiAssistantConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAiAssistantConversations true "创建petAiAssistantConversations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petAiAssistantConversations/createPetAiAssistantConversations [post]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) CreatePetAiAssistantConversations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAiAssistantConversations pet.PetAiAssistantConversations
|
||||
err := c.ShouldBindJSON(&petAiAssistantConversations)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAiAssistantConversationsService.CreatePetAiAssistantConversations(ctx, &petAiAssistantConversations)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAiAssistantConversations 删除petAiAssistantConversations表
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 删除petAiAssistantConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAiAssistantConversations true "删除petAiAssistantConversations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petAiAssistantConversations/deletePetAiAssistantConversations [delete]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) DeletePetAiAssistantConversations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petAiAssistantConversationsService.DeletePetAiAssistantConversations(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAiAssistantConversationsByIds 批量删除petAiAssistantConversations表
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 批量删除petAiAssistantConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petAiAssistantConversations/deletePetAiAssistantConversationsByIds [delete]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) DeletePetAiAssistantConversationsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petAiAssistantConversationsService.DeletePetAiAssistantConversationsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetAiAssistantConversations 更新petAiAssistantConversations表
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 更新petAiAssistantConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAiAssistantConversations true "更新petAiAssistantConversations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petAiAssistantConversations/updatePetAiAssistantConversations [put]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) UpdatePetAiAssistantConversations(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAiAssistantConversations pet.PetAiAssistantConversations
|
||||
err := c.ShouldBindJSON(&petAiAssistantConversations)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAiAssistantConversationsService.UpdatePetAiAssistantConversations(ctx, petAiAssistantConversations)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetAiAssistantConversations 用id查询petAiAssistantConversations表
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 用id查询petAiAssistantConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petAiAssistantConversations表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetAiAssistantConversations,msg=string} "查询成功"
|
||||
// @Router /petAiAssistantConversations/findPetAiAssistantConversations [get]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) FindPetAiAssistantConversations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetAiAssistantConversations, err := petAiAssistantConversationsService.GetPetAiAssistantConversations(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetAiAssistantConversations, c)
|
||||
}
|
||||
|
||||
// GetPetAiAssistantConversationsList 分页获取petAiAssistantConversations表列表
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 分页获取petAiAssistantConversations表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetAiAssistantConversationsSearch true "分页获取petAiAssistantConversations表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petAiAssistantConversations/getPetAiAssistantConversationsList [get]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) GetPetAiAssistantConversationsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetAiAssistantConversationsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petAiAssistantConversationsService.GetPetAiAssistantConversationsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetAiAssistantConversationsPublic 不需要鉴权的petAiAssistantConversations表接口
|
||||
// @Tags PetAiAssistantConversations
|
||||
// @Summary 不需要鉴权的petAiAssistantConversations表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petAiAssistantConversations/getPetAiAssistantConversationsPublic [get]
|
||||
func (petAiAssistantConversationsApi *PetAiAssistantConversationsApi) GetPetAiAssistantConversationsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petAiAssistantConversationsService.GetPetAiAssistantConversationsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petAiAssistantConversations表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetAiConversationsApi struct{}
|
||||
|
||||
// CreatePetAiConversations 创建petAiConversations表
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 创建petAiConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAiConversations true "创建petAiConversations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petAiConversations/createPetAiConversations [post]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) CreatePetAiConversations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAiConversations pet.PetAiConversations
|
||||
err := c.ShouldBindJSON(&petAiConversations)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAiConversationsService.CreatePetAiConversations(ctx, &petAiConversations)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAiConversations 删除petAiConversations表
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 删除petAiConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAiConversations true "删除petAiConversations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petAiConversations/deletePetAiConversations [delete]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) DeletePetAiConversations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petAiConversationsService.DeletePetAiConversations(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetAiConversationsByIds 批量删除petAiConversations表
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 批量删除petAiConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petAiConversations/deletePetAiConversationsByIds [delete]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) DeletePetAiConversationsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petAiConversationsService.DeletePetAiConversationsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetAiConversations 更新petAiConversations表
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 更新petAiConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetAiConversations true "更新petAiConversations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petAiConversations/updatePetAiConversations [put]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) UpdatePetAiConversations(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petAiConversations pet.PetAiConversations
|
||||
err := c.ShouldBindJSON(&petAiConversations)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petAiConversationsService.UpdatePetAiConversations(ctx, petAiConversations)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetAiConversations 用id查询petAiConversations表
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 用id查询petAiConversations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petAiConversations表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetAiConversations,msg=string} "查询成功"
|
||||
// @Router /petAiConversations/findPetAiConversations [get]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) FindPetAiConversations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetAiConversations, err := petAiConversationsService.GetPetAiConversations(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetAiConversations, c)
|
||||
}
|
||||
|
||||
// GetPetAiConversationsList 分页获取petAiConversations表列表
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 分页获取petAiConversations表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetAiConversationsSearch true "分页获取petAiConversations表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petAiConversations/getPetAiConversationsList [get]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) GetPetAiConversationsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetAiConversationsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petAiConversationsService.GetPetAiConversationsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetAiConversationsPublic 不需要鉴权的petAiConversations表接口
|
||||
// @Tags PetAiConversations
|
||||
// @Summary 不需要鉴权的petAiConversations表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petAiConversations/getPetAiConversationsPublic [get]
|
||||
func (petAiConversationsApi *PetAiConversationsApi) GetPetAiConversationsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petAiConversationsService.GetPetAiConversationsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petAiConversations表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetFamiliesApi struct{}
|
||||
|
||||
// CreatePetFamilies 创建petFamilies表
|
||||
// @Tags PetFamilies
|
||||
// @Summary 创建petFamilies表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilies true "创建petFamilies表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petFamilies/createPetFamilies [post]
|
||||
func (petFamiliesApi *PetFamiliesApi) CreatePetFamilies(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilies pet.PetFamilies
|
||||
err := c.ShouldBindJSON(&petFamilies)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamiliesService.CreatePetFamilies(ctx, &petFamilies)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilies 删除petFamilies表
|
||||
// @Tags PetFamilies
|
||||
// @Summary 删除petFamilies表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilies true "删除petFamilies表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petFamilies/deletePetFamilies [delete]
|
||||
func (petFamiliesApi *PetFamiliesApi) DeletePetFamilies(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petFamiliesService.DeletePetFamilies(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamiliesByIds 批量删除petFamilies表
|
||||
// @Tags PetFamilies
|
||||
// @Summary 批量删除petFamilies表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petFamilies/deletePetFamiliesByIds [delete]
|
||||
func (petFamiliesApi *PetFamiliesApi) DeletePetFamiliesByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petFamiliesService.DeletePetFamiliesByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetFamilies 更新petFamilies表
|
||||
// @Tags PetFamilies
|
||||
// @Summary 更新petFamilies表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilies true "更新petFamilies表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petFamilies/updatePetFamilies [put]
|
||||
func (petFamiliesApi *PetFamiliesApi) UpdatePetFamilies(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilies pet.PetFamilies
|
||||
err := c.ShouldBindJSON(&petFamilies)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamiliesService.UpdatePetFamilies(ctx, petFamilies)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetFamilies 用id查询petFamilies表
|
||||
// @Tags PetFamilies
|
||||
// @Summary 用id查询petFamilies表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petFamilies表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetFamilies,msg=string} "查询成功"
|
||||
// @Router /petFamilies/findPetFamilies [get]
|
||||
func (petFamiliesApi *PetFamiliesApi) FindPetFamilies(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetFamilies, err := petFamiliesService.GetPetFamilies(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetFamilies, c)
|
||||
}
|
||||
|
||||
// GetPetFamiliesList 分页获取petFamilies表列表
|
||||
// @Tags PetFamilies
|
||||
// @Summary 分页获取petFamilies表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetFamiliesSearch true "分页获取petFamilies表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petFamilies/getPetFamiliesList [get]
|
||||
func (petFamiliesApi *PetFamiliesApi) GetPetFamiliesList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetFamiliesSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petFamiliesService.GetPetFamiliesInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetFamiliesPublic 不需要鉴权的petFamilies表接口
|
||||
// @Tags PetFamilies
|
||||
// @Summary 不需要鉴权的petFamilies表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petFamilies/getPetFamiliesPublic [get]
|
||||
func (petFamiliesApi *PetFamiliesApi) GetPetFamiliesPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petFamiliesService.GetPetFamiliesPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petFamilies表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetFamilyInvitationsApi struct{}
|
||||
|
||||
// CreatePetFamilyInvitations 创建petFamilyInvitations表
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 创建petFamilyInvitations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyInvitations true "创建petFamilyInvitations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petFamilyInvitations/createPetFamilyInvitations [post]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) CreatePetFamilyInvitations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilyInvitations pet.PetFamilyInvitations
|
||||
err := c.ShouldBindJSON(&petFamilyInvitations)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamilyInvitationsService.CreatePetFamilyInvitations(ctx, &petFamilyInvitations)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilyInvitations 删除petFamilyInvitations表
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 删除petFamilyInvitations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyInvitations true "删除petFamilyInvitations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petFamilyInvitations/deletePetFamilyInvitations [delete]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) DeletePetFamilyInvitations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petFamilyInvitationsService.DeletePetFamilyInvitations(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilyInvitationsByIds 批量删除petFamilyInvitations表
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 批量删除petFamilyInvitations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petFamilyInvitations/deletePetFamilyInvitationsByIds [delete]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) DeletePetFamilyInvitationsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petFamilyInvitationsService.DeletePetFamilyInvitationsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetFamilyInvitations 更新petFamilyInvitations表
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 更新petFamilyInvitations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyInvitations true "更新petFamilyInvitations表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petFamilyInvitations/updatePetFamilyInvitations [put]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) UpdatePetFamilyInvitations(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilyInvitations pet.PetFamilyInvitations
|
||||
err := c.ShouldBindJSON(&petFamilyInvitations)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamilyInvitationsService.UpdatePetFamilyInvitations(ctx, petFamilyInvitations)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetFamilyInvitations 用id查询petFamilyInvitations表
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 用id查询petFamilyInvitations表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petFamilyInvitations表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetFamilyInvitations,msg=string} "查询成功"
|
||||
// @Router /petFamilyInvitations/findPetFamilyInvitations [get]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) FindPetFamilyInvitations(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetFamilyInvitations, err := petFamilyInvitationsService.GetPetFamilyInvitations(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetFamilyInvitations, c)
|
||||
}
|
||||
|
||||
// GetPetFamilyInvitationsList 分页获取petFamilyInvitations表列表
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 分页获取petFamilyInvitations表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetFamilyInvitationsSearch true "分页获取petFamilyInvitations表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petFamilyInvitations/getPetFamilyInvitationsList [get]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) GetPetFamilyInvitationsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetFamilyInvitationsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petFamilyInvitationsService.GetPetFamilyInvitationsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetFamilyInvitationsPublic 不需要鉴权的petFamilyInvitations表接口
|
||||
// @Tags PetFamilyInvitations
|
||||
// @Summary 不需要鉴权的petFamilyInvitations表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petFamilyInvitations/getPetFamilyInvitationsPublic [get]
|
||||
func (petFamilyInvitationsApi *PetFamilyInvitationsApi) GetPetFamilyInvitationsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petFamilyInvitationsService.GetPetFamilyInvitationsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petFamilyInvitations表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetFamilyMembersApi struct{}
|
||||
|
||||
// CreatePetFamilyMembers 创建petFamilyMembers表
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 创建petFamilyMembers表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyMembers true "创建petFamilyMembers表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petFamilyMembers/createPetFamilyMembers [post]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) CreatePetFamilyMembers(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilyMembers pet.PetFamilyMembers
|
||||
err := c.ShouldBindJSON(&petFamilyMembers)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamilyMembersService.CreatePetFamilyMembers(ctx, &petFamilyMembers)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilyMembers 删除petFamilyMembers表
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 删除petFamilyMembers表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyMembers true "删除petFamilyMembers表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petFamilyMembers/deletePetFamilyMembers [delete]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) DeletePetFamilyMembers(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petFamilyMembersService.DeletePetFamilyMembers(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilyMembersByIds 批量删除petFamilyMembers表
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 批量删除petFamilyMembers表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petFamilyMembers/deletePetFamilyMembersByIds [delete]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) DeletePetFamilyMembersByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petFamilyMembersService.DeletePetFamilyMembersByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetFamilyMembers 更新petFamilyMembers表
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 更新petFamilyMembers表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyMembers true "更新petFamilyMembers表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petFamilyMembers/updatePetFamilyMembers [put]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) UpdatePetFamilyMembers(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilyMembers pet.PetFamilyMembers
|
||||
err := c.ShouldBindJSON(&petFamilyMembers)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamilyMembersService.UpdatePetFamilyMembers(ctx, petFamilyMembers)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetFamilyMembers 用id查询petFamilyMembers表
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 用id查询petFamilyMembers表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petFamilyMembers表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetFamilyMembers,msg=string} "查询成功"
|
||||
// @Router /petFamilyMembers/findPetFamilyMembers [get]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) FindPetFamilyMembers(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetFamilyMembers, err := petFamilyMembersService.GetPetFamilyMembers(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetFamilyMembers, c)
|
||||
}
|
||||
|
||||
// GetPetFamilyMembersList 分页获取petFamilyMembers表列表
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 分页获取petFamilyMembers表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetFamilyMembersSearch true "分页获取petFamilyMembers表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petFamilyMembers/getPetFamilyMembersList [get]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) GetPetFamilyMembersList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetFamilyMembersSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petFamilyMembersService.GetPetFamilyMembersInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetFamilyMembersPublic 不需要鉴权的petFamilyMembers表接口
|
||||
// @Tags PetFamilyMembers
|
||||
// @Summary 不需要鉴权的petFamilyMembers表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petFamilyMembers/getPetFamilyMembersPublic [get]
|
||||
func (petFamilyMembersApi *PetFamilyMembersApi) GetPetFamilyMembersPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petFamilyMembersService.GetPetFamilyMembersPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petFamilyMembers表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetFamilyPetsApi struct{}
|
||||
|
||||
// CreatePetFamilyPets 创建petFamilyPets表
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 创建petFamilyPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyPets true "创建petFamilyPets表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petFamilyPets/createPetFamilyPets [post]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) CreatePetFamilyPets(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilyPets pet.PetFamilyPets
|
||||
err := c.ShouldBindJSON(&petFamilyPets)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamilyPetsService.CreatePetFamilyPets(ctx, &petFamilyPets)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilyPets 删除petFamilyPets表
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 删除petFamilyPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyPets true "删除petFamilyPets表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petFamilyPets/deletePetFamilyPets [delete]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) DeletePetFamilyPets(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petFamilyPetsService.DeletePetFamilyPets(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetFamilyPetsByIds 批量删除petFamilyPets表
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 批量删除petFamilyPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petFamilyPets/deletePetFamilyPetsByIds [delete]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) DeletePetFamilyPetsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petFamilyPetsService.DeletePetFamilyPetsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetFamilyPets 更新petFamilyPets表
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 更新petFamilyPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetFamilyPets true "更新petFamilyPets表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petFamilyPets/updatePetFamilyPets [put]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) UpdatePetFamilyPets(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petFamilyPets pet.PetFamilyPets
|
||||
err := c.ShouldBindJSON(&petFamilyPets)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petFamilyPetsService.UpdatePetFamilyPets(ctx, petFamilyPets)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetFamilyPets 用id查询petFamilyPets表
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 用id查询petFamilyPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petFamilyPets表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetFamilyPets,msg=string} "查询成功"
|
||||
// @Router /petFamilyPets/findPetFamilyPets [get]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) FindPetFamilyPets(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetFamilyPets, err := petFamilyPetsService.GetPetFamilyPets(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetFamilyPets, c)
|
||||
}
|
||||
|
||||
// GetPetFamilyPetsList 分页获取petFamilyPets表列表
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 分页获取petFamilyPets表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetFamilyPetsSearch true "分页获取petFamilyPets表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petFamilyPets/getPetFamilyPetsList [get]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) GetPetFamilyPetsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetFamilyPetsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petFamilyPetsService.GetPetFamilyPetsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetFamilyPetsPublic 不需要鉴权的petFamilyPets表接口
|
||||
// @Tags PetFamilyPets
|
||||
// @Summary 不需要鉴权的petFamilyPets表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petFamilyPets/getPetFamilyPetsPublic [get]
|
||||
func (petFamilyPetsApi *PetFamilyPetsApi) GetPetFamilyPetsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petFamilyPetsService.GetPetFamilyPetsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petFamilyPets表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetPetsApi struct{}
|
||||
|
||||
// CreatePetPets 创建petPets表
|
||||
// @Tags PetPets
|
||||
// @Summary 创建petPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetPets true "创建petPets表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petPets/createPetPets [post]
|
||||
func (petPetsApi *PetPetsApi) CreatePetPets(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petPets pet.PetPets
|
||||
err := c.ShouldBindJSON(&petPets)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petPetsService.CreatePetPets(ctx, &petPets)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetPets 删除petPets表
|
||||
// @Tags PetPets
|
||||
// @Summary 删除petPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetPets true "删除petPets表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petPets/deletePetPets [delete]
|
||||
func (petPetsApi *PetPetsApi) DeletePetPets(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petPetsService.DeletePetPets(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetPetsByIds 批量删除petPets表
|
||||
// @Tags PetPets
|
||||
// @Summary 批量删除petPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petPets/deletePetPetsByIds [delete]
|
||||
func (petPetsApi *PetPetsApi) DeletePetPetsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petPetsService.DeletePetPetsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetPets 更新petPets表
|
||||
// @Tags PetPets
|
||||
// @Summary 更新petPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetPets true "更新petPets表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petPets/updatePetPets [put]
|
||||
func (petPetsApi *PetPetsApi) UpdatePetPets(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petPets pet.PetPets
|
||||
err := c.ShouldBindJSON(&petPets)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petPetsService.UpdatePetPets(ctx, petPets)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetPets 用id查询petPets表
|
||||
// @Tags PetPets
|
||||
// @Summary 用id查询petPets表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petPets表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetPets,msg=string} "查询成功"
|
||||
// @Router /petPets/findPetPets [get]
|
||||
func (petPetsApi *PetPetsApi) FindPetPets(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetPets, err := petPetsService.GetPetPets(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetPets, c)
|
||||
}
|
||||
|
||||
// GetPetPetsList 分页获取petPets表列表
|
||||
// @Tags PetPets
|
||||
// @Summary 分页获取petPets表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetPetsSearch true "分页获取petPets表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petPets/getPetPetsList [get]
|
||||
func (petPetsApi *PetPetsApi) GetPetPetsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetPetsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petPetsService.GetPetPetsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetPetsPublic 不需要鉴权的petPets表接口
|
||||
// @Tags PetPets
|
||||
// @Summary 不需要鉴权的petPets表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petPets/getPetPetsPublic [get]
|
||||
func (petPetsApi *PetPetsApi) GetPetPetsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petPetsService.GetPetPetsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petPets表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type PetRecordsApi struct{}
|
||||
|
||||
// CreatePetRecords 创建petRecords表
|
||||
// @Tags PetRecords
|
||||
// @Summary 创建petRecords表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetRecords true "创建petRecords表"
|
||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||
// @Router /petRecords/createPetRecords [post]
|
||||
func (petRecordsApi *PetRecordsApi) CreatePetRecords(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petRecords pet.PetRecords
|
||||
err := c.ShouldBindJSON(&petRecords)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petRecordsService.CreatePetRecords(ctx, &petRecords)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("创建失败!", zap.Error(err))
|
||||
response.FailWithMessage("创建失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("创建成功", c)
|
||||
}
|
||||
|
||||
// DeletePetRecords 删除petRecords表
|
||||
// @Tags PetRecords
|
||||
// @Summary 删除petRecords表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetRecords true "删除petRecords表"
|
||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||
// @Router /petRecords/deletePetRecords [delete]
|
||||
func (petRecordsApi *PetRecordsApi) DeletePetRecords(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
err := petRecordsService.DeletePetRecords(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
|
||||
// DeletePetRecordsByIds 批量删除petRecords表
|
||||
// @Tags PetRecords
|
||||
// @Summary 批量删除petRecords表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||
// @Router /petRecords/deletePetRecordsByIds [delete]
|
||||
func (petRecordsApi *PetRecordsApi) DeletePetRecordsByIds(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
IDs := c.QueryArray("IDs[]")
|
||||
err := petRecordsService.DeletePetRecordsByIds(ctx, IDs)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
|
||||
response.FailWithMessage("批量删除失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("批量删除成功", c)
|
||||
}
|
||||
|
||||
// UpdatePetRecords 更新petRecords表
|
||||
// @Tags PetRecords
|
||||
// @Summary 更新petRecords表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body pet.PetRecords true "更新petRecords表"
|
||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||
// @Router /petRecords/updatePetRecords [put]
|
||||
func (petRecordsApi *PetRecordsApi) UpdatePetRecords(c *gin.Context) {
|
||||
// 从ctx获取标准context进行业务行为
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var petRecords pet.PetRecords
|
||||
err := c.ShouldBindJSON(&petRecords)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
err = petRecordsService.UpdatePetRecords(ctx, petRecords)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMessage("更新失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMessage("更新成功", c)
|
||||
}
|
||||
|
||||
// FindPetRecords 用id查询petRecords表
|
||||
// @Tags PetRecords
|
||||
// @Summary 用id查询petRecords表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param ID query uint true "用id查询petRecords表"
|
||||
// @Success 200 {object} response.Response{data=pet.PetRecords,msg=string} "查询成功"
|
||||
// @Router /petRecords/findPetRecords [get]
|
||||
func (petRecordsApi *PetRecordsApi) FindPetRecords(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
ID := c.Query("ID")
|
||||
repetRecords, err := petRecordsService.GetPetRecords(ctx, ID)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("查询失败!", zap.Error(err))
|
||||
response.FailWithMessage("查询失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(repetRecords, c)
|
||||
}
|
||||
|
||||
// GetPetRecordsList 分页获取petRecords表列表
|
||||
// @Tags PetRecords
|
||||
// @Summary 分页获取petRecords表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query petReq.PetRecordsSearch true "分页获取petRecords表列表"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||
// @Router /petRecords/getPetRecordsList [get]
|
||||
func (petRecordsApi *PetRecordsApi) GetPetRecordsList(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
var pageInfo petReq.PetRecordsSearch
|
||||
err := c.ShouldBindQuery(&pageInfo)
|
||||
if err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := petRecordsService.GetPetRecordsInfoList(ctx, pageInfo)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
|
||||
// GetPetRecordsPublic 不需要鉴权的petRecords表接口
|
||||
// @Tags PetRecords
|
||||
// @Summary 不需要鉴权的petRecords表接口
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||
// @Router /petRecords/getPetRecordsPublic [get]
|
||||
func (petRecordsApi *PetRecordsApi) GetPetRecordsPublic(c *gin.Context) {
|
||||
// 创建业务用Context
|
||||
ctx := c.Request.Context()
|
||||
|
||||
// 此接口不需要鉴权
|
||||
// 示例为返回了一个固定的消息接口,一般本接口用于C端服务,需要自己实现业务逻辑
|
||||
petRecordsService.GetPetRecordsPublic(ctx)
|
||||
response.OkWithDetailed(gin.H{
|
||||
"info": "不需要鉴权的petRecords表接口信息",
|
||||
}, "获取成功", c)
|
||||
}
|
||||
Reference in New Issue
Block a user