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)
|
||||
}
|
||||
+11
-11
@@ -84,7 +84,7 @@ hua-wei-obs:
|
||||
access-key: you-access-key
|
||||
secret-key: you-secret-key
|
||||
jwt:
|
||||
signing-key: 9b6f669b-4473-4b74-906b-da61f8452488
|
||||
signing-key: d78561f8-2826-4df2-984f-0f136d922eff
|
||||
expires-time: 7d
|
||||
buffer-time: 1d
|
||||
issuer: qmPlus
|
||||
@@ -130,8 +130,8 @@ mssql:
|
||||
path: ""
|
||||
engine: ""
|
||||
log-mode: ""
|
||||
max-idle-conns: 10
|
||||
max-open-conns: 100
|
||||
max-idle-conns: 0
|
||||
max-open-conns: 0
|
||||
singular: false
|
||||
log-zap: false
|
||||
mysql:
|
||||
@@ -237,11 +237,14 @@ tencent-cos:
|
||||
base-url: https://gin.vue.admin
|
||||
path-prefix: github.com/flipped-aurora/gin-vue-admin/server
|
||||
volcengine:
|
||||
access-key: "your-access-key"
|
||||
secret-key: "your-secret-key"
|
||||
region: "cn-beijing"
|
||||
endpoint: "https://ark.cn-beijing.volces.com"
|
||||
default-model: "ep-xxx"
|
||||
access-key: your-access-key
|
||||
secret-key: your-secret-key
|
||||
region: cn-beijing
|
||||
endpoint: https://ark.cn-beijing.volces.com
|
||||
default-model: ep-xxx
|
||||
wechat:
|
||||
mini-app-id: wx0f5dc17ba3f9fe31
|
||||
mini-app-secret: 5e700810a6f56717e28af76dbb63983d
|
||||
zap:
|
||||
level: info
|
||||
prefix: '[github.com/flipped-aurora/gin-vue-admin/server]'
|
||||
@@ -252,6 +255,3 @@ zap:
|
||||
show-line: true
|
||||
log-in-console: true
|
||||
retention-day: -1
|
||||
wechat:
|
||||
mini-app-id: "wx0f5dc17ba3f9fe31" # 微信小程序 AppID
|
||||
mini-app-secret: "5e700810a6f56717e28af76dbb63983d" # 微信小程序 AppSecret
|
||||
|
||||
@@ -2,11 +2,12 @@ package initialize
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
)
|
||||
|
||||
func bizModel() error {
|
||||
db := global.GVA_DB
|
||||
err := db.AutoMigrate()
|
||||
err := db.AutoMigrate(pet.PetAdoptionApplications{}, pet.PetAdoptionPosts{}, pet.PetAiAssistantConversations{}, pet.PetAiConversations{}, pet.PetFamilies{}, pet.PetFamilyInvitations{}, pet.PetFamilyMembers{}, pet.PetFamilyPets{}, pet.PetPets{}, pet.PetRecords{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,15 +5,25 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 占位方法,保证文件可以正确加载,避免go空变量检测报错,请勿删除。
|
||||
func holder(routers ...*gin.RouterGroup) {
|
||||
_ = routers
|
||||
_ = router.RouterGroupApp
|
||||
}
|
||||
|
||||
func initBizRouter(routers ...*gin.RouterGroup) {
|
||||
privateGroup := routers[0]
|
||||
publicGroup := routers[1]
|
||||
|
||||
holder(publicGroup, privateGroup)
|
||||
{
|
||||
petRouter := router.RouterGroupApp.Pet
|
||||
petRouter.InitPetAdoptionApplicationsRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetAdoptionPostsRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetAiAssistantConversationsRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetAiConversationsRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetFamiliesRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetFamilyInvitationsRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetFamilyMembersRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetFamilyPetsRouter(privateGroup, publicGroup)
|
||||
petRouter.InitPetPetsRouter(privateGroup, publicGroup) // 占位方法,保证文件可以正确加载,避免go空变量检测报错,请勿删除。
|
||||
petRouter.InitPetRecordsRouter(privateGroup, publicGroup)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// 自动生成模板PetAdoptionApplications
|
||||
package pet
|
||||
|
||||
import
|
||||
import (
|
||||
"time"
|
||||
pped-aurora/gin-vue-
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
// petAdoptionApplications表 结构体 PetAdoptionApplications
|
||||
global.GVA_MODEL
|
||||
PostId *int `json:"postId" form:"postId" gorm:"comment:领养帖子ID;column:post_id;size:20;" binding:"required"` //领养帖子ID
|
||||
ApplicantId *int `json:"applicantId" form:"applicantId" gorm:"comment:申请者用户ID;column:applicant_id;size:20;" binding:"required"` //申请者用户ID
|
||||
ApplicationReason *string `json:"applicationReason" form:"applicationReason" gorm:"comment:申请理由;column:application_reason;" binding:"required"` //申请理由
|
||||
QuestionnaireAnswers datatypes.JSON `json:"questionnaireAnswers" form:"questionnaireAnswers" gorm:"comment:问卷回答(JSON格式);column:questionnaire_answers;" swaggertype:"object"` //问卷回答(JSON格式)
|
||||
Status *string `json:"status" form:"status" gorm:"comment:申请状态:pending-待审核,approved-已通过,rejected-已拒绝;column:status;size:20;"` //申请状态:pending-待审核,approved-已通过,rejected-已拒绝
|
||||
ReviewedAt *time.Time `json:"reviewedAt" form:"reviewedAt" gorm:"comment:审核时间;column:reviewed_at;"` //审核时间
|
||||
ReviewerNotes *string `json:"reviewerNotes" form:"reviewerNotes" gorm:"comment:审核备注;column:reviewer_notes;"` //审核备注
|
||||
ReviewerNotes *string `json:"reviewerNotes" form:"reviewerNotes" gorm:"comment:审核备注;column:reviewer_notes;"` //审核备注
|
||||
}
|
||||
|
||||
// TableName petAdoptionApplications表 PetAdoptionApplications自定义表名 pet_adoption_applications
|
||||
return "pet_adoption_applications"
|
||||
return "pet_adoption_applications"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// 自动生成模板PetAdoptionPosts
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"gorm.io/datatypes"
|
||||
"time"
|
||||
)
|
||||
|
||||
// petAdoptionPosts表 结构体 PetAdoptionPosts
|
||||
type PetAdoptionPosts struct {
|
||||
global.GVA_MODEL
|
||||
PublisherId *int `json:"publisherId" form:"publisherId" gorm:"comment:发布者用户ID;column:publisher_id;size:20;" binding:"required"` //发布者用户ID
|
||||
PetName *string `json:"petName" form:"petName" gorm:"comment:宠物名字;column:pet_name;size:100;"` //宠物名字
|
||||
PetAge *int `json:"petAge" form:"petAge" gorm:"comment:宠物年龄(月);column:pet_age;size:10;"` //宠物年龄(月)
|
||||
PetGender *string `json:"petGender" form:"petGender" gorm:"comment:宠物性别:male-公,female-母;column:pet_gender;size:20;"` //宠物性别:male-公,female-母
|
||||
IsNeutered *bool `json:"isNeutered" form:"isNeutered" gorm:"comment:是否绝育:0-否,1-是;column:is_neutered;"` //是否绝育:0-否,1-是
|
||||
Breed *string `json:"breed" form:"breed" gorm:"comment:品种;column:breed;size:100;"` //品种
|
||||
Weight *float64 `json:"weight" form:"weight" gorm:"comment:体重(单位:kg);column:weight;size:5;"` //体重(单位:kg)
|
||||
Personality *string `json:"personality" form:"personality" gorm:"comment:性格描述;column:personality;"` //性格描述
|
||||
Content *string `json:"content" form:"content" gorm:"comment:领养帖子内容描述;column:content;" binding:"required"` //领养帖子内容描述
|
||||
City *string `json:"city" form:"city" gorm:"comment:所在城市;column:city;size:100;"` //所在城市
|
||||
Images datatypes.JSON `json:"images" form:"images" gorm:"comment:宠物图片URLs(JSON数组);column:images;" swaggertype:"array,object"` //宠物图片URLs(JSON数组)
|
||||
Videos datatypes.JSON `json:"videos" form:"videos" gorm:"comment:宠物视频URLs(JSON数组);column:videos;" swaggertype:"array,object"` //宠物视频URLs(JSON数组)
|
||||
HealthStatus *string `json:"healthStatus" form:"healthStatus" gorm:"comment:健康状况:healthy-健康,sick-生病;column:health_status;size:20;"` //健康状况:healthy-健康,sick-生病
|
||||
HealthDescription *string `json:"healthDescription" form:"healthDescription" gorm:"comment:健康状况详细描述;column:health_description;"` //健康状况详细描述
|
||||
AdoptionRequirements *string `json:"adoptionRequirements" form:"adoptionRequirements" gorm:"comment:领养要求和条件;column:adoption_requirements;"` //领养要求和条件
|
||||
Questionnaire datatypes.JSON `json:"questionnaire" form:"questionnaire" gorm:"comment:领养问卷配置(JSON格式);column:questionnaire;" swaggertype:"object"` //领养问卷配置(JSON格式)
|
||||
Deadline *time.Time `json:"deadline" form:"deadline" gorm:"comment:申请截止时间;column:deadline;"` //申请截止时间
|
||||
ContactPhone *string `json:"contactPhone" form:"contactPhone" gorm:"comment:联系电话;column:contact_phone;size:20;"` //联系电话
|
||||
Status *string `json:"status" form:"status" gorm:"comment:帖子状态:active-活跃,closed-已关闭,expired-已过期;column:status;size:20;"` //帖子状态:active-活跃,closed-已关闭,expired-已过期
|
||||
ViewCount *int `json:"viewCount" form:"viewCount" gorm:"comment:浏览次数;column:view_count;size:10;"` //浏览次数
|
||||
ApplicationCount *int `json:"applicationCount" form:"applicationCount" gorm:"comment:申请次数;column:application_count;size:10;"` //申请次数
|
||||
}
|
||||
|
||||
// TableName petAdoptionPosts表 PetAdoptionPosts自定义表名 pet_adoption_posts
|
||||
func (PetAdoptionPosts) TableName() string {
|
||||
return "pet_adoption_posts"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// 自动生成模板PetAiAssistantConversations
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
)
|
||||
|
||||
// petAiAssistantConversations表 结构体 PetAiAssistantConversations
|
||||
type PetAiAssistantConversations struct {
|
||||
global.GVA_MODEL
|
||||
UserId *int `json:"userId" form:"userId" gorm:"comment:用户ID;column:user_id;size:20;" binding:"required"` //用户ID
|
||||
MessageContent *string `json:"messageContent" form:"messageContent" gorm:"comment:消息内容;column:message_content;" binding:"required"` //消息内容
|
||||
Role *string `json:"role" form:"role" gorm:"comment:发送者角色:user-用户,assistant-AI助手;column:role;size:20;" binding:"required"` //发送者角色:user-用户,assistant-AI助手
|
||||
}
|
||||
|
||||
// TableName petAiAssistantConversations表 PetAiAssistantConversations自定义表名 pet_ai_assistant_conversations
|
||||
func (PetAiAssistantConversations) TableName() string {
|
||||
return "pet_ai_assistant_conversations"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// 自动生成模板PetAiConversations
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
)
|
||||
|
||||
// petAiConversations表 结构体 PetAiConversations
|
||||
type PetAiConversations struct {
|
||||
global.GVA_MODEL
|
||||
UserId *int `json:"userId" form:"userId" gorm:"comment:用户ID;column:user_id;size:20;" binding:"required"` //用户ID
|
||||
PetId *int `json:"petId" form:"petId" gorm:"comment:宠物ID;column:pet_id;size:20;" binding:"required"` //宠物ID
|
||||
MessageContent *string `json:"messageContent" form:"messageContent" gorm:"comment:消息内容;column:message_content;" binding:"required"` //消息内容
|
||||
Role *string `json:"role" form:"role" gorm:"comment:发送者角色:user-用户,assistant-AI助手;column:role;size:20;" binding:"required"` //发送者角色:user-用户,assistant-AI助手
|
||||
}
|
||||
|
||||
// TableName petAiConversations表 PetAiConversations自定义表名 pet_ai_conversations
|
||||
func (PetAiConversations) TableName() string {
|
||||
return "pet_ai_conversations"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// 自动生成模板PetFamilies
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
)
|
||||
|
||||
// petFamilies表 结构体 PetFamilies
|
||||
type PetFamilies struct {
|
||||
global.GVA_MODEL
|
||||
Name *string `json:"name" form:"name" gorm:"comment:家庭名称;column:name;size:100;"` //家庭名称
|
||||
CreatorId *int `json:"creatorId" form:"creatorId" gorm:"comment:创建者用户ID;column:creator_id;size:20;" binding:"required"` //创建者用户ID
|
||||
MemberCount *int `json:"memberCount" form:"memberCount" gorm:"comment:当前成员数量;column:member_count;size:10;"` //当前成员数量
|
||||
MaxMembers *int `json:"maxMembers" form:"maxMembers" gorm:"comment:最大成员数量;column:max_members;size:10;"` //最大成员数量
|
||||
Description *string `json:"description" form:"description" gorm:"comment:家庭描述;column:description;"` //家庭描述
|
||||
}
|
||||
|
||||
// TableName petFamilies表 PetFamilies自定义表名 pet_families
|
||||
func (PetFamilies) TableName() string {
|
||||
return "pet_families"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// 自动生成模板PetFamilyInvitations
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// petFamilyInvitations表 结构体 PetFamilyInvitations
|
||||
type PetFamilyInvitations struct {
|
||||
global.GVA_MODEL
|
||||
FamilyId *int `json:"familyId" form:"familyId" gorm:"comment:家庭ID;column:family_id;size:20;" binding:"required"` //家庭ID
|
||||
InviterId *int `json:"inviterId" form:"inviterId" gorm:"comment:邀请者用户ID;column:inviter_id;size:20;" binding:"required"` //邀请者用户ID
|
||||
InviteePhone *string `json:"inviteePhone" form:"inviteePhone" gorm:"comment:被邀请者手机号;column:invitee_phone;size:20;" binding:"required"` //被邀请者手机号
|
||||
InvitationCode *string `json:"invitationCode" form:"invitationCode" gorm:"comment:邀请码;column:invitation_code;size:32;" binding:"required"` //邀请码
|
||||
Status *string `json:"status" form:"status" gorm:"comment:邀请状态:pending-待处理,accepted-已接受,rejected-已拒绝,expired-已过期;column:status;size:20;"` //邀请状态:pending-待处理,accepted-已接受,rejected-已拒绝,expired-已过期
|
||||
ExpiresAt *time.Time `json:"expiresAt" form:"expiresAt" gorm:"comment:过期时间;column:expires_at;"` //过期时间
|
||||
Message *string `json:"message" form:"message" gorm:"comment:邀请留言;column:message;size:200;"` //邀请留言
|
||||
}
|
||||
|
||||
// TableName petFamilyInvitations表 PetFamilyInvitations自定义表名 pet_family_invitations
|
||||
func (PetFamilyInvitations) TableName() string {
|
||||
return "pet_family_invitations"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// 自动生成模板PetFamilyMembers
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// petFamilyMembers表 结构体 PetFamilyMembers
|
||||
type PetFamilyMembers struct {
|
||||
global.GVA_MODEL
|
||||
UserId *int `json:"userId" form:"userId" gorm:"comment:用户ID;column:user_id;size:20;" binding:"required"` //用户ID
|
||||
FamilyId *int `json:"familyId" form:"familyId" gorm:"comment:家庭ID;column:family_id;size:20;" binding:"required"` //家庭ID
|
||||
Role *string `json:"role" form:"role" gorm:"comment:角色:creator-创建者,member-成员;column:role;size:20;" binding:"required"` //角色:creator-创建者,member-成员
|
||||
JoinedAt *time.Time `json:"joinedAt" form:"joinedAt" gorm:"comment:加入时间;column:joined_at;"` //加入时间
|
||||
Nickname *string `json:"nickname" form:"nickname" gorm:"comment:在家庭中的昵称;column:nickname;size:50;"` //在家庭中的昵称
|
||||
}
|
||||
|
||||
// TableName petFamilyMembers表 PetFamilyMembers自定义表名 pet_family_members
|
||||
func (PetFamilyMembers) TableName() string {
|
||||
return "pet_family_members"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// 自动生成模板PetFamilyPets
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// petFamilyPets表 结构体 PetFamilyPets
|
||||
type PetFamilyPets struct {
|
||||
global.GVA_MODEL
|
||||
FamilyId *int `json:"familyId" form:"familyId" gorm:"comment:家庭ID;column:family_id;size:20;" binding:"required"` //家庭ID
|
||||
PetId *int `json:"petId" form:"petId" gorm:"comment:宠物ID;column:pet_id;size:20;" binding:"required"` //宠物ID
|
||||
AddedBy *int `json:"addedBy" form:"addedBy" gorm:"comment:添加者用户ID;column:added_by;size:20;" binding:"required"` //添加者用户ID
|
||||
AddedAt *time.Time `json:"addedAt" form:"addedAt" gorm:"comment:添加时间;column:added_at;" binding:"required"` //添加时间
|
||||
}
|
||||
|
||||
// TableName petFamilyPets表 PetFamilyPets自定义表名 pet_family_pets
|
||||
func (PetFamilyPets) TableName() string {
|
||||
return "pet_family_pets"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 自动生成模板PetPets
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
// petPets表 结构体 PetPets
|
||||
type PetPets struct {
|
||||
global.GVA_MODEL
|
||||
AvatarUrl *string `json:"avatarUrl" form:"avatarUrl" gorm:"comment:宠物头像URL;column:avatar_url;size:500;"` //宠物头像URL
|
||||
Name *string `json:"name" form:"name" gorm:"comment:宠物名字;column:name;size:100;" binding:"required"` //宠物名字
|
||||
PetType *string `json:"petType" form:"petType" gorm:"comment:宠物类型:cat-猫咪,dog-狗狗;column:pet_type;size:20;"` //宠物类型:cat-猫咪,dog-狗狗
|
||||
Breed *string `json:"breed" form:"breed" gorm:"comment:品种;column:breed;size:100;"` //品种
|
||||
Gender *string `json:"gender" form:"gender" gorm:"comment:性别:male-公,female-母;column:gender;size:20;"` //性别:male-公,female-母
|
||||
IsNeutered *bool `json:"isNeutered" form:"isNeutered" gorm:"comment:是否绝育:0-否,1-是;column:is_neutered;"` //是否绝育:0-否,1-是
|
||||
BirthDate *time.Time `json:"birthDate" form:"birthDate" gorm:"comment:出生日期;column:birth_date;"` //出生日期
|
||||
AdoptionDate *time.Time `json:"adoptionDate" form:"adoptionDate" gorm:"comment:到家日期;column:adoption_date;"` //到家日期
|
||||
Weight *float64 `json:"weight" form:"weight" gorm:"comment:体重(单位:kg);column:weight;size:5;"` //体重(单位:kg)
|
||||
Personality *string `json:"personality" form:"personality" gorm:"comment:性格描述;column:personality;"` //性格描述
|
||||
Prompt *string `json:"prompt" form:"prompt" gorm:"comment:宠物提示词/个性化描述;column:prompt;"` //宠物提示词/个性化描述
|
||||
CreatorId *int `json:"creatorId" form:"creatorId" gorm:"comment:创建者用户ID;column:creator_id;size:20;" binding:"required"` //创建者用户ID
|
||||
}
|
||||
|
||||
// TableName petPets表 PetPets自定义表名 pet_pets
|
||||
func (PetPets) TableName() string {
|
||||
return "pet_pets"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// 自动生成模板PetRecords
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"gorm.io/datatypes"
|
||||
"time"
|
||||
)
|
||||
|
||||
// petRecords表 结构体 PetRecords
|
||||
type PetRecords struct {
|
||||
global.GVA_MODEL
|
||||
PetId *int `json:"petId" form:"petId" gorm:"comment:关联的宠物ID;column:pet_id;size:20;" binding:"required"` //关联的宠物ID
|
||||
RecordType *string `json:"recordType" form:"recordType" gorm:"comment:记录类型:casual-随手记,milestone-大事记,daily-日常记录,health-健康记录,grooming-洗护记录,cleaning-清洁记录;column:record_type;size:20;" binding:"required"` //记录类型:casual-随手记,milestone-大事记,daily-日常记录,health-健康记录,grooming-洗护记录,cleaning-清洁记录
|
||||
RecordTime *time.Time `json:"recordTime" form:"recordTime" gorm:"comment:记录时间;column:record_time;" binding:"required"` //记录时间
|
||||
Content *string `json:"content" form:"content" gorm:"comment:具体内容(JSON格式,根据记录类型存储不同结构);column:content;"` //具体内容(JSON格式,根据记录类型存储不同结构)
|
||||
Description *string `json:"description" form:"description" gorm:"comment:文字内容描述;column:description;"` //文字内容描述
|
||||
ImageUrls datatypes.JSON `json:"imageUrls" form:"imageUrls" gorm:"comment:图片URLs(JSON数组);column:image_urls;" swaggertype:"array,object"` //图片URLs(JSON数组)
|
||||
VideoUrls datatypes.JSON `json:"videoUrls" form:"videoUrls" gorm:"comment:视频URLs(JSON数组);column:video_urls;" swaggertype:"array,object"` //视频URLs(JSON数组)
|
||||
Visibility *string `json:"visibility" form:"visibility" gorm:"comment:可见范围:public-公开,family-家人,private-私有;column:visibility;size:20;"` //可见范围:public-公开,family-家人,private-私有
|
||||
CreatorId *int `json:"creatorId" form:"creatorId" gorm:"comment:创建者用户ID;column:creator_id;size:20;" binding:"required"` //创建者用户ID
|
||||
}
|
||||
|
||||
// TableName petRecords表 PetRecords自定义表名 pet_records
|
||||
func (PetRecords) TableName() string {
|
||||
return "pet_records"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetAdoptionApplicationsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetAdoptionPostsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetAiAssistantConversationsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetAiConversationsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetFamiliesSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetFamilyInvitationsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetFamilyMembersSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetFamilyPetsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetPetsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PetRecordsSearch struct {
|
||||
CreatedAtRange []time.Time `json:"createdAtRange" form:"createdAtRange[]"`
|
||||
request.PageInfo
|
||||
}
|
||||
@@ -125,8 +125,9 @@ func (m *MpDraftService) GetDraftList(page, pageSize int, title, author string)
|
||||
|
||||
// getOfficialAccount 获取微信公众号实例
|
||||
func (m *MpDraftService) getOfficialAccount() (*officialaccount.OfficialAccount, error) {
|
||||
// 使用账号服务获取默认公众号实例
|
||||
return nil, nil
|
||||
// 使用用户服务获取公众号实例
|
||||
mpUserService := &MpUserService{}
|
||||
return mpUserService.GetOfficialAccount()
|
||||
}
|
||||
|
||||
// GetDraftInfo 获取草稿详情(通过MediaID)
|
||||
|
||||
@@ -2,6 +2,7 @@ package router
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/router/example"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/router/pet"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/router/system"
|
||||
)
|
||||
|
||||
@@ -10,4 +11,5 @@ var RouterGroupApp = new(RouterGroup)
|
||||
type RouterGroup struct {
|
||||
System system.RouterGroup
|
||||
Example example.RouterGroup
|
||||
Pet pet.RouterGroup
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package pet
|
||||
|
||||
import api "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
|
||||
|
||||
type RouterGroup struct {
|
||||
PetAdoptionApplicationsRouter
|
||||
PetAdoptionPostsRouter
|
||||
PetAiAssistantConversationsRouter
|
||||
PetAiConversationsRouter
|
||||
PetFamiliesRouter
|
||||
PetFamilyInvitationsRouter
|
||||
PetFamilyMembersRouter
|
||||
PetFamilyPetsRouter
|
||||
PetPetsRouter
|
||||
PetRecordsRouter
|
||||
}
|
||||
|
||||
var (
|
||||
petAdoptionApplicationsApi = api.ApiGroupApp.PetApiGroup.PetAdoptionApplicationsApi
|
||||
petAdoptionPostsApi = api.ApiGroupApp.PetApiGroup.PetAdoptionPostsApi
|
||||
petAiAssistantConversationsApi = api.ApiGroupApp.PetApiGroup.PetAiAssistantConversationsApi
|
||||
petAiConversationsApi = api.ApiGroupApp.PetApiGroup.PetAiConversationsApi
|
||||
petFamiliesApi = api.ApiGroupApp.PetApiGroup.PetFamiliesApi
|
||||
petFamilyInvitationsApi = api.ApiGroupApp.PetApiGroup.PetFamilyInvitationsApi
|
||||
petFamilyMembersApi = api.ApiGroupApp.PetApiGroup.PetFamilyMembersApi
|
||||
petFamilyPetsApi = api.ApiGroupApp.PetApiGroup.PetFamilyPetsApi
|
||||
petPetsApi = api.ApiGroupApp.PetApiGroup.PetPetsApi
|
||||
petRecordsApi = api.ApiGroupApp.PetApiGroup.PetRecordsApi
|
||||
)
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetAdoptionApplicationsRouter struct{}
|
||||
|
||||
// InitPetAdoptionApplicationsRouter 初始化 petAdoptionApplications表 路由信息
|
||||
func (s *PetAdoptionApplicationsRouter) InitPetAdoptionApplicationsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petAdoptionApplicationsRouter := Router.Group("petAdoptionApplications").Use(middleware.OperationRecord())
|
||||
petAdoptionApplicationsRouterWithoutRecord := Router.Group("petAdoptionApplications")
|
||||
petAdoptionApplicationsRouterWithoutAuth := PublicRouter.Group("petAdoptionApplications")
|
||||
{
|
||||
petAdoptionApplicationsRouter.POST("createPetAdoptionApplications", petAdoptionApplicationsApi.CreatePetAdoptionApplications) // 新建petAdoptionApplications表
|
||||
petAdoptionApplicationsRouter.DELETE("deletePetAdoptionApplications", petAdoptionApplicationsApi.DeletePetAdoptionApplications) // 删除petAdoptionApplications表
|
||||
petAdoptionApplicationsRouter.DELETE("deletePetAdoptionApplicationsByIds", petAdoptionApplicationsApi.DeletePetAdoptionApplicationsByIds) // 批量删除petAdoptionApplications表
|
||||
petAdoptionApplicationsRouter.PUT("updatePetAdoptionApplications", petAdoptionApplicationsApi.UpdatePetAdoptionApplications) // 更新petAdoptionApplications表
|
||||
}
|
||||
{
|
||||
petAdoptionApplicationsRouterWithoutRecord.GET("findPetAdoptionApplications", petAdoptionApplicationsApi.FindPetAdoptionApplications) // 根据ID获取petAdoptionApplications表
|
||||
petAdoptionApplicationsRouterWithoutRecord.GET("getPetAdoptionApplicationsList", petAdoptionApplicationsApi.GetPetAdoptionApplicationsList) // 获取petAdoptionApplications表列表
|
||||
}
|
||||
{
|
||||
petAdoptionApplicationsRouterWithoutAuth.GET("getPetAdoptionApplicationsPublic", petAdoptionApplicationsApi.GetPetAdoptionApplicationsPublic) // petAdoptionApplications表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetAdoptionPostsRouter struct{}
|
||||
|
||||
// InitPetAdoptionPostsRouter 初始化 petAdoptionPosts表 路由信息
|
||||
func (s *PetAdoptionPostsRouter) InitPetAdoptionPostsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petAdoptionPostsRouter := Router.Group("petAdoptionPosts").Use(middleware.OperationRecord())
|
||||
petAdoptionPostsRouterWithoutRecord := Router.Group("petAdoptionPosts")
|
||||
petAdoptionPostsRouterWithoutAuth := PublicRouter.Group("petAdoptionPosts")
|
||||
{
|
||||
petAdoptionPostsRouter.POST("createPetAdoptionPosts", petAdoptionPostsApi.CreatePetAdoptionPosts) // 新建petAdoptionPosts表
|
||||
petAdoptionPostsRouter.DELETE("deletePetAdoptionPosts", petAdoptionPostsApi.DeletePetAdoptionPosts) // 删除petAdoptionPosts表
|
||||
petAdoptionPostsRouter.DELETE("deletePetAdoptionPostsByIds", petAdoptionPostsApi.DeletePetAdoptionPostsByIds) // 批量删除petAdoptionPosts表
|
||||
petAdoptionPostsRouter.PUT("updatePetAdoptionPosts", petAdoptionPostsApi.UpdatePetAdoptionPosts) // 更新petAdoptionPosts表
|
||||
}
|
||||
{
|
||||
petAdoptionPostsRouterWithoutRecord.GET("findPetAdoptionPosts", petAdoptionPostsApi.FindPetAdoptionPosts) // 根据ID获取petAdoptionPosts表
|
||||
petAdoptionPostsRouterWithoutRecord.GET("getPetAdoptionPostsList", petAdoptionPostsApi.GetPetAdoptionPostsList) // 获取petAdoptionPosts表列表
|
||||
}
|
||||
{
|
||||
petAdoptionPostsRouterWithoutAuth.GET("getPetAdoptionPostsPublic", petAdoptionPostsApi.GetPetAdoptionPostsPublic) // petAdoptionPosts表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetAiAssistantConversationsRouter struct{}
|
||||
|
||||
// InitPetAiAssistantConversationsRouter 初始化 petAiAssistantConversations表 路由信息
|
||||
func (s *PetAiAssistantConversationsRouter) InitPetAiAssistantConversationsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petAiAssistantConversationsRouter := Router.Group("petAiAssistantConversations").Use(middleware.OperationRecord())
|
||||
petAiAssistantConversationsRouterWithoutRecord := Router.Group("petAiAssistantConversations")
|
||||
petAiAssistantConversationsRouterWithoutAuth := PublicRouter.Group("petAiAssistantConversations")
|
||||
{
|
||||
petAiAssistantConversationsRouter.POST("createPetAiAssistantConversations", petAiAssistantConversationsApi.CreatePetAiAssistantConversations) // 新建petAiAssistantConversations表
|
||||
petAiAssistantConversationsRouter.DELETE("deletePetAiAssistantConversations", petAiAssistantConversationsApi.DeletePetAiAssistantConversations) // 删除petAiAssistantConversations表
|
||||
petAiAssistantConversationsRouter.DELETE("deletePetAiAssistantConversationsByIds", petAiAssistantConversationsApi.DeletePetAiAssistantConversationsByIds) // 批量删除petAiAssistantConversations表
|
||||
petAiAssistantConversationsRouter.PUT("updatePetAiAssistantConversations", petAiAssistantConversationsApi.UpdatePetAiAssistantConversations) // 更新petAiAssistantConversations表
|
||||
}
|
||||
{
|
||||
petAiAssistantConversationsRouterWithoutRecord.GET("findPetAiAssistantConversations", petAiAssistantConversationsApi.FindPetAiAssistantConversations) // 根据ID获取petAiAssistantConversations表
|
||||
petAiAssistantConversationsRouterWithoutRecord.GET("getPetAiAssistantConversationsList", petAiAssistantConversationsApi.GetPetAiAssistantConversationsList) // 获取petAiAssistantConversations表列表
|
||||
}
|
||||
{
|
||||
petAiAssistantConversationsRouterWithoutAuth.GET("getPetAiAssistantConversationsPublic", petAiAssistantConversationsApi.GetPetAiAssistantConversationsPublic) // petAiAssistantConversations表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetAiConversationsRouter struct{}
|
||||
|
||||
// InitPetAiConversationsRouter 初始化 petAiConversations表 路由信息
|
||||
func (s *PetAiConversationsRouter) InitPetAiConversationsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petAiConversationsRouter := Router.Group("petAiConversations").Use(middleware.OperationRecord())
|
||||
petAiConversationsRouterWithoutRecord := Router.Group("petAiConversations")
|
||||
petAiConversationsRouterWithoutAuth := PublicRouter.Group("petAiConversations")
|
||||
{
|
||||
petAiConversationsRouter.POST("createPetAiConversations", petAiConversationsApi.CreatePetAiConversations) // 新建petAiConversations表
|
||||
petAiConversationsRouter.DELETE("deletePetAiConversations", petAiConversationsApi.DeletePetAiConversations) // 删除petAiConversations表
|
||||
petAiConversationsRouter.DELETE("deletePetAiConversationsByIds", petAiConversationsApi.DeletePetAiConversationsByIds) // 批量删除petAiConversations表
|
||||
petAiConversationsRouter.PUT("updatePetAiConversations", petAiConversationsApi.UpdatePetAiConversations) // 更新petAiConversations表
|
||||
}
|
||||
{
|
||||
petAiConversationsRouterWithoutRecord.GET("findPetAiConversations", petAiConversationsApi.FindPetAiConversations) // 根据ID获取petAiConversations表
|
||||
petAiConversationsRouterWithoutRecord.GET("getPetAiConversationsList", petAiConversationsApi.GetPetAiConversationsList) // 获取petAiConversations表列表
|
||||
}
|
||||
{
|
||||
petAiConversationsRouterWithoutAuth.GET("getPetAiConversationsPublic", petAiConversationsApi.GetPetAiConversationsPublic) // petAiConversations表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetFamiliesRouter struct{}
|
||||
|
||||
// InitPetFamiliesRouter 初始化 petFamilies表 路由信息
|
||||
func (s *PetFamiliesRouter) InitPetFamiliesRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petFamiliesRouter := Router.Group("petFamilies").Use(middleware.OperationRecord())
|
||||
petFamiliesRouterWithoutRecord := Router.Group("petFamilies")
|
||||
petFamiliesRouterWithoutAuth := PublicRouter.Group("petFamilies")
|
||||
{
|
||||
petFamiliesRouter.POST("createPetFamilies", petFamiliesApi.CreatePetFamilies) // 新建petFamilies表
|
||||
petFamiliesRouter.DELETE("deletePetFamilies", petFamiliesApi.DeletePetFamilies) // 删除petFamilies表
|
||||
petFamiliesRouter.DELETE("deletePetFamiliesByIds", petFamiliesApi.DeletePetFamiliesByIds) // 批量删除petFamilies表
|
||||
petFamiliesRouter.PUT("updatePetFamilies", petFamiliesApi.UpdatePetFamilies) // 更新petFamilies表
|
||||
}
|
||||
{
|
||||
petFamiliesRouterWithoutRecord.GET("findPetFamilies", petFamiliesApi.FindPetFamilies) // 根据ID获取petFamilies表
|
||||
petFamiliesRouterWithoutRecord.GET("getPetFamiliesList", petFamiliesApi.GetPetFamiliesList) // 获取petFamilies表列表
|
||||
}
|
||||
{
|
||||
petFamiliesRouterWithoutAuth.GET("getPetFamiliesPublic", petFamiliesApi.GetPetFamiliesPublic) // petFamilies表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetFamilyInvitationsRouter struct{}
|
||||
|
||||
// InitPetFamilyInvitationsRouter 初始化 petFamilyInvitations表 路由信息
|
||||
func (s *PetFamilyInvitationsRouter) InitPetFamilyInvitationsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petFamilyInvitationsRouter := Router.Group("petFamilyInvitations").Use(middleware.OperationRecord())
|
||||
petFamilyInvitationsRouterWithoutRecord := Router.Group("petFamilyInvitations")
|
||||
petFamilyInvitationsRouterWithoutAuth := PublicRouter.Group("petFamilyInvitations")
|
||||
{
|
||||
petFamilyInvitationsRouter.POST("createPetFamilyInvitations", petFamilyInvitationsApi.CreatePetFamilyInvitations) // 新建petFamilyInvitations表
|
||||
petFamilyInvitationsRouter.DELETE("deletePetFamilyInvitations", petFamilyInvitationsApi.DeletePetFamilyInvitations) // 删除petFamilyInvitations表
|
||||
petFamilyInvitationsRouter.DELETE("deletePetFamilyInvitationsByIds", petFamilyInvitationsApi.DeletePetFamilyInvitationsByIds) // 批量删除petFamilyInvitations表
|
||||
petFamilyInvitationsRouter.PUT("updatePetFamilyInvitations", petFamilyInvitationsApi.UpdatePetFamilyInvitations) // 更新petFamilyInvitations表
|
||||
}
|
||||
{
|
||||
petFamilyInvitationsRouterWithoutRecord.GET("findPetFamilyInvitations", petFamilyInvitationsApi.FindPetFamilyInvitations) // 根据ID获取petFamilyInvitations表
|
||||
petFamilyInvitationsRouterWithoutRecord.GET("getPetFamilyInvitationsList", petFamilyInvitationsApi.GetPetFamilyInvitationsList) // 获取petFamilyInvitations表列表
|
||||
}
|
||||
{
|
||||
petFamilyInvitationsRouterWithoutAuth.GET("getPetFamilyInvitationsPublic", petFamilyInvitationsApi.GetPetFamilyInvitationsPublic) // petFamilyInvitations表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetFamilyMembersRouter struct{}
|
||||
|
||||
// InitPetFamilyMembersRouter 初始化 petFamilyMembers表 路由信息
|
||||
func (s *PetFamilyMembersRouter) InitPetFamilyMembersRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petFamilyMembersRouter := Router.Group("petFamilyMembers").Use(middleware.OperationRecord())
|
||||
petFamilyMembersRouterWithoutRecord := Router.Group("petFamilyMembers")
|
||||
petFamilyMembersRouterWithoutAuth := PublicRouter.Group("petFamilyMembers")
|
||||
{
|
||||
petFamilyMembersRouter.POST("createPetFamilyMembers", petFamilyMembersApi.CreatePetFamilyMembers) // 新建petFamilyMembers表
|
||||
petFamilyMembersRouter.DELETE("deletePetFamilyMembers", petFamilyMembersApi.DeletePetFamilyMembers) // 删除petFamilyMembers表
|
||||
petFamilyMembersRouter.DELETE("deletePetFamilyMembersByIds", petFamilyMembersApi.DeletePetFamilyMembersByIds) // 批量删除petFamilyMembers表
|
||||
petFamilyMembersRouter.PUT("updatePetFamilyMembers", petFamilyMembersApi.UpdatePetFamilyMembers) // 更新petFamilyMembers表
|
||||
}
|
||||
{
|
||||
petFamilyMembersRouterWithoutRecord.GET("findPetFamilyMembers", petFamilyMembersApi.FindPetFamilyMembers) // 根据ID获取petFamilyMembers表
|
||||
petFamilyMembersRouterWithoutRecord.GET("getPetFamilyMembersList", petFamilyMembersApi.GetPetFamilyMembersList) // 获取petFamilyMembers表列表
|
||||
}
|
||||
{
|
||||
petFamilyMembersRouterWithoutAuth.GET("getPetFamilyMembersPublic", petFamilyMembersApi.GetPetFamilyMembersPublic) // petFamilyMembers表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetFamilyPetsRouter struct{}
|
||||
|
||||
// InitPetFamilyPetsRouter 初始化 petFamilyPets表 路由信息
|
||||
func (s *PetFamilyPetsRouter) InitPetFamilyPetsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petFamilyPetsRouter := Router.Group("petFamilyPets").Use(middleware.OperationRecord())
|
||||
petFamilyPetsRouterWithoutRecord := Router.Group("petFamilyPets")
|
||||
petFamilyPetsRouterWithoutAuth := PublicRouter.Group("petFamilyPets")
|
||||
{
|
||||
petFamilyPetsRouter.POST("createPetFamilyPets", petFamilyPetsApi.CreatePetFamilyPets) // 新建petFamilyPets表
|
||||
petFamilyPetsRouter.DELETE("deletePetFamilyPets", petFamilyPetsApi.DeletePetFamilyPets) // 删除petFamilyPets表
|
||||
petFamilyPetsRouter.DELETE("deletePetFamilyPetsByIds", petFamilyPetsApi.DeletePetFamilyPetsByIds) // 批量删除petFamilyPets表
|
||||
petFamilyPetsRouter.PUT("updatePetFamilyPets", petFamilyPetsApi.UpdatePetFamilyPets) // 更新petFamilyPets表
|
||||
}
|
||||
{
|
||||
petFamilyPetsRouterWithoutRecord.GET("findPetFamilyPets", petFamilyPetsApi.FindPetFamilyPets) // 根据ID获取petFamilyPets表
|
||||
petFamilyPetsRouterWithoutRecord.GET("getPetFamilyPetsList", petFamilyPetsApi.GetPetFamilyPetsList) // 获取petFamilyPets表列表
|
||||
}
|
||||
{
|
||||
petFamilyPetsRouterWithoutAuth.GET("getPetFamilyPetsPublic", petFamilyPetsApi.GetPetFamilyPetsPublic) // petFamilyPets表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetPetsRouter struct{}
|
||||
|
||||
// InitPetPetsRouter 初始化 petPets表 路由信息
|
||||
func (s *PetPetsRouter) InitPetPetsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petPetsRouter := Router.Group("petPets").Use(middleware.OperationRecord())
|
||||
petPetsRouterWithoutRecord := Router.Group("petPets")
|
||||
petPetsRouterWithoutAuth := PublicRouter.Group("petPets")
|
||||
{
|
||||
petPetsRouter.POST("createPetPets", petPetsApi.CreatePetPets) // 新建petPets表
|
||||
petPetsRouter.DELETE("deletePetPets", petPetsApi.DeletePetPets) // 删除petPets表
|
||||
petPetsRouter.DELETE("deletePetPetsByIds", petPetsApi.DeletePetPetsByIds) // 批量删除petPets表
|
||||
petPetsRouter.PUT("updatePetPets", petPetsApi.UpdatePetPets) // 更新petPets表
|
||||
}
|
||||
{
|
||||
petPetsRouterWithoutRecord.GET("findPetPets", petPetsApi.FindPetPets) // 根据ID获取petPets表
|
||||
petPetsRouterWithoutRecord.GET("getPetPetsList", petPetsApi.GetPetPetsList) // 获取petPets表列表
|
||||
}
|
||||
{
|
||||
petPetsRouterWithoutAuth.GET("getPetPetsPublic", petPetsApi.GetPetPetsPublic) // petPets表开放接口
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PetRecordsRouter struct{}
|
||||
|
||||
// InitPetRecordsRouter 初始化 petRecords表 路由信息
|
||||
func (s *PetRecordsRouter) InitPetRecordsRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
|
||||
petRecordsRouter := Router.Group("petRecords").Use(middleware.OperationRecord())
|
||||
petRecordsRouterWithoutRecord := Router.Group("petRecords")
|
||||
petRecordsRouterWithoutAuth := PublicRouter.Group("petRecords")
|
||||
{
|
||||
petRecordsRouter.POST("createPetRecords", petRecordsApi.CreatePetRecords) // 新建petRecords表
|
||||
petRecordsRouter.DELETE("deletePetRecords", petRecordsApi.DeletePetRecords) // 删除petRecords表
|
||||
petRecordsRouter.DELETE("deletePetRecordsByIds", petRecordsApi.DeletePetRecordsByIds) // 批量删除petRecords表
|
||||
petRecordsRouter.PUT("updatePetRecords", petRecordsApi.UpdatePetRecords) // 更新petRecords表
|
||||
}
|
||||
{
|
||||
petRecordsRouterWithoutRecord.GET("findPetRecords", petRecordsApi.FindPetRecords) // 根据ID获取petRecords表
|
||||
petRecordsRouterWithoutRecord.GET("getPetRecordsList", petRecordsApi.GetPetRecordsList) // 获取petRecords表列表
|
||||
}
|
||||
{
|
||||
petRecordsRouterWithoutAuth.GET("getPetRecordsPublic", petRecordsApi.GetPetRecordsPublic) // petRecords表开放接口
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/service/example"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/service/pet"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/service/system"
|
||||
)
|
||||
|
||||
@@ -10,4 +11,5 @@ var ServiceGroupApp = new(ServiceGroup)
|
||||
type ServiceGroup struct {
|
||||
SystemServiceGroup system.ServiceGroup
|
||||
ExampleServiceGroup example.ServiceGroup
|
||||
PetServiceGroup pet.ServiceGroup
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package pet
|
||||
|
||||
type ServiceGroup struct {
|
||||
PetAdoptionApplicationsService
|
||||
PetAdoptionPostsService
|
||||
PetAiAssistantConversationsService
|
||||
PetAiConversationsService
|
||||
PetFamiliesService
|
||||
PetFamilyInvitationsService
|
||||
PetFamilyMembersService
|
||||
PetFamilyPetsService
|
||||
PetPetsService
|
||||
PetRecordsService
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetAdoptionApplicationsService struct{}
|
||||
|
||||
// CreatePetAdoptionApplications 创建petAdoptionApplications表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) CreatePetAdoptionApplications(ctx context.Context, petAdoptionApplications *pet.PetAdoptionApplications) (err error) {
|
||||
err = global.GVA_DB.Create(petAdoptionApplications).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAdoptionApplications 删除petAdoptionApplications表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) DeletePetAdoptionApplications(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetAdoptionApplications{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAdoptionApplicationsByIds 批量删除petAdoptionApplications表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) DeletePetAdoptionApplicationsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetAdoptionApplications{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetAdoptionApplications 更新petAdoptionApplications表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) UpdatePetAdoptionApplications(ctx context.Context, petAdoptionApplications pet.PetAdoptionApplications) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetAdoptionApplications{}).Where("id = ?", petAdoptionApplications.ID).Updates(&petAdoptionApplications).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetAdoptionApplications 根据ID获取petAdoptionApplications表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) GetPetAdoptionApplications(ctx context.Context, ID string) (petAdoptionApplications pet.PetAdoptionApplications, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petAdoptionApplications).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetAdoptionApplicationsInfoList 分页获取petAdoptionApplications表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) GetPetAdoptionApplicationsInfoList(ctx context.Context, info petReq.PetAdoptionApplicationsSearch) (list []pet.PetAdoptionApplications, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetAdoptionApplications{})
|
||||
var petAdoptionApplicationss []pet.PetAdoptionApplications
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petAdoptionApplicationss).Error
|
||||
return petAdoptionApplicationss, total, err
|
||||
}
|
||||
func (petAdoptionApplicationsService *PetAdoptionApplicationsService) GetPetAdoptionApplicationsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetAdoptionPostsService struct{}
|
||||
|
||||
// CreatePetAdoptionPosts 创建petAdoptionPosts表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) CreatePetAdoptionPosts(ctx context.Context, petAdoptionPosts *pet.PetAdoptionPosts) (err error) {
|
||||
err = global.GVA_DB.Create(petAdoptionPosts).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAdoptionPosts 删除petAdoptionPosts表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) DeletePetAdoptionPosts(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetAdoptionPosts{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAdoptionPostsByIds 批量删除petAdoptionPosts表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) DeletePetAdoptionPostsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetAdoptionPosts{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetAdoptionPosts 更新petAdoptionPosts表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) UpdatePetAdoptionPosts(ctx context.Context, petAdoptionPosts pet.PetAdoptionPosts) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetAdoptionPosts{}).Where("id = ?", petAdoptionPosts.ID).Updates(&petAdoptionPosts).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetAdoptionPosts 根据ID获取petAdoptionPosts表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) GetPetAdoptionPosts(ctx context.Context, ID string) (petAdoptionPosts pet.PetAdoptionPosts, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petAdoptionPosts).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetAdoptionPostsInfoList 分页获取petAdoptionPosts表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) GetPetAdoptionPostsInfoList(ctx context.Context, info petReq.PetAdoptionPostsSearch) (list []pet.PetAdoptionPosts, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetAdoptionPosts{})
|
||||
var petAdoptionPostss []pet.PetAdoptionPosts
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petAdoptionPostss).Error
|
||||
return petAdoptionPostss, total, err
|
||||
}
|
||||
func (petAdoptionPostsService *PetAdoptionPostsService) GetPetAdoptionPostsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetAiAssistantConversationsService struct{}
|
||||
|
||||
// CreatePetAiAssistantConversations 创建petAiAssistantConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) CreatePetAiAssistantConversations(ctx context.Context, petAiAssistantConversations *pet.PetAiAssistantConversations) (err error) {
|
||||
err = global.GVA_DB.Create(petAiAssistantConversations).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAiAssistantConversations 删除petAiAssistantConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) DeletePetAiAssistantConversations(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetAiAssistantConversations{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAiAssistantConversationsByIds 批量删除petAiAssistantConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) DeletePetAiAssistantConversationsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetAiAssistantConversations{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetAiAssistantConversations 更新petAiAssistantConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) UpdatePetAiAssistantConversations(ctx context.Context, petAiAssistantConversations pet.PetAiAssistantConversations) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetAiAssistantConversations{}).Where("id = ?", petAiAssistantConversations.ID).Updates(&petAiAssistantConversations).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetAiAssistantConversations 根据ID获取petAiAssistantConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) GetPetAiAssistantConversations(ctx context.Context, ID string) (petAiAssistantConversations pet.PetAiAssistantConversations, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petAiAssistantConversations).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetAiAssistantConversationsInfoList 分页获取petAiAssistantConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) GetPetAiAssistantConversationsInfoList(ctx context.Context, info petReq.PetAiAssistantConversationsSearch) (list []pet.PetAiAssistantConversations, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetAiAssistantConversations{})
|
||||
var petAiAssistantConversationss []pet.PetAiAssistantConversations
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petAiAssistantConversationss).Error
|
||||
return petAiAssistantConversationss, total, err
|
||||
}
|
||||
func (petAiAssistantConversationsService *PetAiAssistantConversationsService) GetPetAiAssistantConversationsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetAiConversationsService struct{}
|
||||
|
||||
// CreatePetAiConversations 创建petAiConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiConversationsService *PetAiConversationsService) CreatePetAiConversations(ctx context.Context, petAiConversations *pet.PetAiConversations) (err error) {
|
||||
err = global.GVA_DB.Create(petAiConversations).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAiConversations 删除petAiConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiConversationsService *PetAiConversationsService) DeletePetAiConversations(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetAiConversations{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetAiConversationsByIds 批量删除petAiConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiConversationsService *PetAiConversationsService) DeletePetAiConversationsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetAiConversations{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetAiConversations 更新petAiConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiConversationsService *PetAiConversationsService) UpdatePetAiConversations(ctx context.Context, petAiConversations pet.PetAiConversations) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetAiConversations{}).Where("id = ?", petAiConversations.ID).Updates(&petAiConversations).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetAiConversations 根据ID获取petAiConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiConversationsService *PetAiConversationsService) GetPetAiConversations(ctx context.Context, ID string) (petAiConversations pet.PetAiConversations, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petAiConversations).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetAiConversationsInfoList 分页获取petAiConversations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petAiConversationsService *PetAiConversationsService) GetPetAiConversationsInfoList(ctx context.Context, info petReq.PetAiConversationsSearch) (list []pet.PetAiConversations, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetAiConversations{})
|
||||
var petAiConversationss []pet.PetAiConversations
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petAiConversationss).Error
|
||||
return petAiConversationss, total, err
|
||||
}
|
||||
func (petAiConversationsService *PetAiConversationsService) GetPetAiConversationsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetFamiliesService struct{}
|
||||
|
||||
// CreatePetFamilies 创建petFamilies表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamiliesService *PetFamiliesService) CreatePetFamilies(ctx context.Context, petFamilies *pet.PetFamilies) (err error) {
|
||||
err = global.GVA_DB.Create(petFamilies).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilies 删除petFamilies表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamiliesService *PetFamiliesService) DeletePetFamilies(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetFamilies{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamiliesByIds 批量删除petFamilies表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamiliesService *PetFamiliesService) DeletePetFamiliesByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetFamilies{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetFamilies 更新petFamilies表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamiliesService *PetFamiliesService) UpdatePetFamilies(ctx context.Context, petFamilies pet.PetFamilies) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetFamilies{}).Where("id = ?", petFamilies.ID).Updates(&petFamilies).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetFamilies 根据ID获取petFamilies表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamiliesService *PetFamiliesService) GetPetFamilies(ctx context.Context, ID string) (petFamilies pet.PetFamilies, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petFamilies).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetFamiliesInfoList 分页获取petFamilies表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamiliesService *PetFamiliesService) GetPetFamiliesInfoList(ctx context.Context, info petReq.PetFamiliesSearch) (list []pet.PetFamilies, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetFamilies{})
|
||||
var petFamiliess []pet.PetFamilies
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petFamiliess).Error
|
||||
return petFamiliess, total, err
|
||||
}
|
||||
func (petFamiliesService *PetFamiliesService) GetPetFamiliesPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetFamilyInvitationsService struct{}
|
||||
|
||||
// CreatePetFamilyInvitations 创建petFamilyInvitations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) CreatePetFamilyInvitations(ctx context.Context, petFamilyInvitations *pet.PetFamilyInvitations) (err error) {
|
||||
err = global.GVA_DB.Create(petFamilyInvitations).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilyInvitations 删除petFamilyInvitations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) DeletePetFamilyInvitations(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetFamilyInvitations{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilyInvitationsByIds 批量删除petFamilyInvitations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) DeletePetFamilyInvitationsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetFamilyInvitations{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetFamilyInvitations 更新petFamilyInvitations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) UpdatePetFamilyInvitations(ctx context.Context, petFamilyInvitations pet.PetFamilyInvitations) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetFamilyInvitations{}).Where("id = ?", petFamilyInvitations.ID).Updates(&petFamilyInvitations).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetFamilyInvitations 根据ID获取petFamilyInvitations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) GetPetFamilyInvitations(ctx context.Context, ID string) (petFamilyInvitations pet.PetFamilyInvitations, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petFamilyInvitations).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetFamilyInvitationsInfoList 分页获取petFamilyInvitations表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) GetPetFamilyInvitationsInfoList(ctx context.Context, info petReq.PetFamilyInvitationsSearch) (list []pet.PetFamilyInvitations, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetFamilyInvitations{})
|
||||
var petFamilyInvitationss []pet.PetFamilyInvitations
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petFamilyInvitationss).Error
|
||||
return petFamilyInvitationss, total, err
|
||||
}
|
||||
func (petFamilyInvitationsService *PetFamilyInvitationsService) GetPetFamilyInvitationsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetFamilyMembersService struct{}
|
||||
|
||||
// CreatePetFamilyMembers 创建petFamilyMembers表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyMembersService *PetFamilyMembersService) CreatePetFamilyMembers(ctx context.Context, petFamilyMembers *pet.PetFamilyMembers) (err error) {
|
||||
err = global.GVA_DB.Create(petFamilyMembers).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilyMembers 删除petFamilyMembers表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyMembersService *PetFamilyMembersService) DeletePetFamilyMembers(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetFamilyMembers{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilyMembersByIds 批量删除petFamilyMembers表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyMembersService *PetFamilyMembersService) DeletePetFamilyMembersByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetFamilyMembers{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetFamilyMembers 更新petFamilyMembers表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyMembersService *PetFamilyMembersService) UpdatePetFamilyMembers(ctx context.Context, petFamilyMembers pet.PetFamilyMembers) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetFamilyMembers{}).Where("id = ?", petFamilyMembers.ID).Updates(&petFamilyMembers).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetFamilyMembers 根据ID获取petFamilyMembers表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyMembersService *PetFamilyMembersService) GetPetFamilyMembers(ctx context.Context, ID string) (petFamilyMembers pet.PetFamilyMembers, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petFamilyMembers).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetFamilyMembersInfoList 分页获取petFamilyMembers表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyMembersService *PetFamilyMembersService) GetPetFamilyMembersInfoList(ctx context.Context, info petReq.PetFamilyMembersSearch) (list []pet.PetFamilyMembers, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetFamilyMembers{})
|
||||
var petFamilyMemberss []pet.PetFamilyMembers
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petFamilyMemberss).Error
|
||||
return petFamilyMemberss, total, err
|
||||
}
|
||||
func (petFamilyMembersService *PetFamilyMembersService) GetPetFamilyMembersPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetFamilyPetsService struct{}
|
||||
|
||||
// CreatePetFamilyPets 创建petFamilyPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyPetsService *PetFamilyPetsService) CreatePetFamilyPets(ctx context.Context, petFamilyPets *pet.PetFamilyPets) (err error) {
|
||||
err = global.GVA_DB.Create(petFamilyPets).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilyPets 删除petFamilyPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyPetsService *PetFamilyPetsService) DeletePetFamilyPets(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetFamilyPets{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetFamilyPetsByIds 批量删除petFamilyPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyPetsService *PetFamilyPetsService) DeletePetFamilyPetsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetFamilyPets{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetFamilyPets 更新petFamilyPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyPetsService *PetFamilyPetsService) UpdatePetFamilyPets(ctx context.Context, petFamilyPets pet.PetFamilyPets) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetFamilyPets{}).Where("id = ?", petFamilyPets.ID).Updates(&petFamilyPets).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetFamilyPets 根据ID获取petFamilyPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyPetsService *PetFamilyPetsService) GetPetFamilyPets(ctx context.Context, ID string) (petFamilyPets pet.PetFamilyPets, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petFamilyPets).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetFamilyPetsInfoList 分页获取petFamilyPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petFamilyPetsService *PetFamilyPetsService) GetPetFamilyPetsInfoList(ctx context.Context, info petReq.PetFamilyPetsSearch) (list []pet.PetFamilyPets, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetFamilyPets{})
|
||||
var petFamilyPetss []pet.PetFamilyPets
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petFamilyPetss).Error
|
||||
return petFamilyPetss, total, err
|
||||
}
|
||||
func (petFamilyPetsService *PetFamilyPetsService) GetPetFamilyPetsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetPetsService struct{}
|
||||
|
||||
// CreatePetPets 创建petPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petPetsService *PetPetsService) CreatePetPets(ctx context.Context, petPets *pet.PetPets) (err error) {
|
||||
err = global.GVA_DB.Create(petPets).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetPets 删除petPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petPetsService *PetPetsService) DeletePetPets(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetPets{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetPetsByIds 批量删除petPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petPetsService *PetPetsService) DeletePetPetsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetPets{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetPets 更新petPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petPetsService *PetPetsService) UpdatePetPets(ctx context.Context, petPets pet.PetPets) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetPets{}).Where("id = ?", petPets.ID).Updates(&petPets).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetPets 根据ID获取petPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petPetsService *PetPetsService) GetPetPets(ctx context.Context, ID string) (petPets pet.PetPets, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petPets).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetPetsInfoList 分页获取petPets表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petPetsService *PetPetsService) GetPetPetsInfoList(ctx context.Context, info petReq.PetPetsSearch) (list []pet.PetPets, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetPets{})
|
||||
var petPetss []pet.PetPets
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petPetss).Error
|
||||
return petPetss, total, err
|
||||
}
|
||||
func (petPetsService *PetPetsService) GetPetPetsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package pet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
|
||||
petReq "github.com/flipped-aurora/gin-vue-admin/server/model/pet/request"
|
||||
)
|
||||
|
||||
type PetRecordsService struct{}
|
||||
|
||||
// CreatePetRecords 创建petRecords表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petRecordsService *PetRecordsService) CreatePetRecords(ctx context.Context, petRecords *pet.PetRecords) (err error) {
|
||||
err = global.GVA_DB.Create(petRecords).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetRecords 删除petRecords表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petRecordsService *PetRecordsService) DeletePetRecords(ctx context.Context, ID string) (err error) {
|
||||
err = global.GVA_DB.Delete(&pet.PetRecords{}, "id = ?", ID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePetRecordsByIds 批量删除petRecords表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petRecordsService *PetRecordsService) DeletePetRecordsByIds(ctx context.Context, IDs []string) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]pet.PetRecords{}, "id in ?", IDs).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePetRecords 更新petRecords表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petRecordsService *PetRecordsService) UpdatePetRecords(ctx context.Context, petRecords pet.PetRecords) (err error) {
|
||||
err = global.GVA_DB.Model(&pet.PetRecords{}).Where("id = ?", petRecords.ID).Updates(&petRecords).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPetRecords 根据ID获取petRecords表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petRecordsService *PetRecordsService) GetPetRecords(ctx context.Context, ID string) (petRecords pet.PetRecords, err error) {
|
||||
err = global.GVA_DB.Where("id = ?", ID).First(&petRecords).Error
|
||||
return
|
||||
}
|
||||
|
||||
// GetPetRecordsInfoList 分页获取petRecords表记录
|
||||
// Author [yourname](https://github.com/yourname)
|
||||
func (petRecordsService *PetRecordsService) GetPetRecordsInfoList(ctx context.Context, info petReq.PetRecordsSearch) (list []pet.PetRecords, total int64, err error) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
// 创建db
|
||||
db := global.GVA_DB.Model(&pet.PetRecords{})
|
||||
var petRecordss []pet.PetRecords
|
||||
// 如果有条件搜索 下方会自动创建搜索语句
|
||||
if len(info.CreatedAtRange) == 2 {
|
||||
db = db.Where("created_at BETWEEN ? AND ?", info.CreatedAtRange[0], info.CreatedAtRange[1])
|
||||
}
|
||||
|
||||
err = db.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if limit != 0 {
|
||||
db = db.Limit(limit).Offset(offset)
|
||||
}
|
||||
|
||||
err = db.Find(&petRecordss).Error
|
||||
return petRecordss, total, err
|
||||
}
|
||||
func (petRecordsService *PetRecordsService) GetPetRecordsPublic(ctx context.Context) {
|
||||
// 此方法为获取数据源定义的数据
|
||||
// 请自行实现
|
||||
}
|
||||
@@ -282,24 +282,6 @@ func (i *initCasbin) InitializeData(ctx context.Context) (context.Context, error
|
||||
{Ptype: "p", V0: "9528", V1: "/customer/customerList", V2: "GET"},
|
||||
{Ptype: "p", V0: "9528", V1: "/autoCode/createTemp", V2: "POST"},
|
||||
{Ptype: "p", V0: "9528", V1: "/user/getUserInfo", V2: "GET"},
|
||||
|
||||
// 微信公众号权限 - 管理员角色888
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/config", V2: "GET"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/config", V2: "POST"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/config/test", V2: "POST"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/config/validate", V2: "POST"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/qrcode/generate", V2: "POST"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/quota/clear", V2: "POST"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/config/list", V2: "GET"},
|
||||
{Ptype: "p", V0: "888", V1: "/wechat/mp/config/:id", V2: "DELETE"},
|
||||
|
||||
// 微信公众号权限 - 普通管理员角色8881
|
||||
{Ptype: "p", V0: "8881", V1: "/wechat/mp/config", V2: "GET"},
|
||||
{Ptype: "p", V0: "8881", V1: "/wechat/mp/config", V2: "POST"},
|
||||
{Ptype: "p", V0: "8881", V1: "/wechat/mp/config/test", V2: "POST"},
|
||||
{Ptype: "p", V0: "8881", V1: "/wechat/mp/config/validate", V2: "POST"},
|
||||
{Ptype: "p", V0: "8881", V1: "/wechat/mp/qrcode/generate", V2: "POST"},
|
||||
{Ptype: "p", V0: "8881", V1: "/wechat/mp/quota/clear", V2: "POST"},
|
||||
}
|
||||
if err := db.Create(&entities).Error; err != nil {
|
||||
return ctx, errors.Wrap(err, "Casbin 表 ("+i.InitializerName()+") 数据初始化失败!")
|
||||
|
||||
Reference in New Issue
Block a user