feat: 代码生成
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
package codegen
|
||||
|
||||
import (
|
||||
"sundynix-go/model/codegen"
|
||||
"sundynix-go/model/commom/response"
|
||||
"sundynix-go/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type CodegenApi struct{}
|
||||
|
||||
var codegenService = service.ServiceGroupApp.CodegenServiceGroup.CodegenService
|
||||
|
||||
// TestConnection
|
||||
// @Tags 代码生成
|
||||
// @Summary 测试数据库连接
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body codegen.TestConnectionReq true "数据库连接配置"
|
||||
// @Success 200 {object} response.Response "连接成功"
|
||||
// @Router /api/codegen/testConnection [post]
|
||||
func (a *CodegenApi) TestConnection(c *gin.Context) {
|
||||
var req codegen.TestConnectionReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := codegenService.TestConnection(req.DbConfig); err != nil {
|
||||
response.FailWithMsg("连接失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("连接成功", c)
|
||||
}
|
||||
|
||||
// Preview
|
||||
// @Tags 代码生成
|
||||
// @Summary 预览生成代码(不写文件)
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body codegen.PreviewReq true "代码生成配置"
|
||||
// @Success 200 {object} response.Response{data=[]codegen.PreviewFile} "预览成功"
|
||||
// @Router /api/codegen/preview [post]
|
||||
func (a *CodegenApi) Preview(c *gin.Context) {
|
||||
var req codegen.PreviewReq
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
files, err := codegenService.Preview(req.GenConfig)
|
||||
if err != nil {
|
||||
response.FailWithMsg("预览失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(files, c)
|
||||
}
|
||||
|
||||
// Generate
|
||||
// @Tags 代码生成
|
||||
// @Summary 生成并写入代码文件
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body codegen.GenConfig true "代码生成配置(含 outputDir)"
|
||||
// @Success 200 {object} response.Response{data=codegen.GenResult} "生成成功"
|
||||
// @Router /api/codegen/generate [post]
|
||||
func (a *CodegenApi) Generate(c *gin.Context) {
|
||||
var req codegen.GenConfig
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
result, err := codegenService.Generate(req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("生成失败:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(result, c)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package codegen
|
||||
|
||||
type ApiGroup struct {
|
||||
CodegenApi
|
||||
}
|
||||
+8
-2
@@ -1,10 +1,16 @@
|
||||
package v1
|
||||
|
||||
import "sundynix-go/api/v1/system"
|
||||
import (
|
||||
"sundynix-go/api/v1/codegen"
|
||||
"sundynix-go/api/v1/order"
|
||||
"sundynix-go/api/v1/system"
|
||||
)
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
||||
|
||||
// ApiGroup 路由组
|
||||
type ApiGroup struct {
|
||||
SystemApiGroup system.ApiGroup
|
||||
SystemApiGroup system.ApiGroup
|
||||
CodegenApiGroup codegen.ApiGroup
|
||||
OrderApiGroup order.ApiGroup
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package order
|
||||
|
||||
type ApiGroup struct {
|
||||
OrderApi
|
||||
RefundApi
|
||||
StockApi
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package order
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/commom/response"
|
||||
req "sundynix-go/model/order/request"
|
||||
"sundynix-go/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type OrderApi struct{}
|
||||
|
||||
var orderService = service.ServiceGroupApp.OrderServiceGroup.OrderService
|
||||
|
||||
// Save
|
||||
// @Tags 管理
|
||||
// @Summary 新增
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.SaveOrderReq true "新增参数"
|
||||
// @Success 200 {object} response.Response "新增成功"
|
||||
// @Router /order/order/save [post]
|
||||
func (a *OrderApi) Save(c *gin.Context) {
|
||||
var r req.SaveOrderReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := orderService.Save(r); err != nil {
|
||||
global.Logger.Error("新增失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("新增成功", c)
|
||||
}
|
||||
|
||||
// Update
|
||||
// @Tags 管理
|
||||
// @Summary 更新
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.UpdateOrderReq true "更新参数"
|
||||
// @Success 200 {object} response.Response "更新成功"
|
||||
// @Router /order/order/update [post]
|
||||
func (a *OrderApi) Update(c *gin.Context) {
|
||||
var r req.UpdateOrderReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := orderService.Update(r); err != nil {
|
||||
global.Logger.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("更新成功", c)
|
||||
}
|
||||
|
||||
// Delete
|
||||
// @Tags 管理
|
||||
// @Summary 删除(支持批量)
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body object{ids=[]string} true "id列表"
|
||||
// @Success 200 {object} response.Response "删除成功"
|
||||
// @Router /order/order/delete [post]
|
||||
func (a *OrderApi) Delete(c *gin.Context) {
|
||||
var req struct {
|
||||
Ids []string `json:"ids" binding:"required,min=1"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := orderService.Delete(req.Ids); err != nil {
|
||||
global.Logger.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("删除成功", c)
|
||||
}
|
||||
|
||||
// Detail
|
||||
// @Tags 管理
|
||||
// @Summary 获取详情
|
||||
// @Security BasicAuth
|
||||
// @Produce json
|
||||
// @Param id query string true "ID"
|
||||
// @Success 200 {object} response.Response "获取详情成功"
|
||||
// @Router /order/order/detail [get]
|
||||
func (a *OrderApi) Detail(c *gin.Context) {
|
||||
id := c.Query("id")
|
||||
data, err := orderService.Detail(id)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取详情失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(data, c)
|
||||
}
|
||||
|
||||
// List
|
||||
// @Tags 管理
|
||||
// @Summary 分页获取列表
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.ListOrderReq true "分页参数"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult} "获取列表成功"
|
||||
// @Router /order/order/list [post]
|
||||
func (a *OrderApi) List(c *gin.Context) {
|
||||
var r req.ListOrderReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := orderService.List(r)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取列表失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: r.Current,
|
||||
PageSize: r.PageSize,
|
||||
}, c)
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package order
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/commom/response"
|
||||
req "sundynix-go/model/order/request"
|
||||
"sundynix-go/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type RefundApi struct{}
|
||||
|
||||
var refundService = service.ServiceGroupApp.OrderServiceGroup.RefundService
|
||||
|
||||
// Save
|
||||
// @Tags 管理
|
||||
// @Summary 新增
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.SaveRefundReq true "新增参数"
|
||||
// @Success 200 {object} response.Response "新增成功"
|
||||
// @Router /order/refund/save [post]
|
||||
func (a *RefundApi) Save(c *gin.Context) {
|
||||
var r req.SaveRefundReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := refundService.Save(r); err != nil {
|
||||
global.Logger.Error("新增失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("新增成功", c)
|
||||
}
|
||||
|
||||
// Update
|
||||
// @Tags 管理
|
||||
// @Summary 更新
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.UpdateRefundReq true "更新参数"
|
||||
// @Success 200 {object} response.Response "更新成功"
|
||||
// @Router /order/refund/update [post]
|
||||
func (a *RefundApi) Update(c *gin.Context) {
|
||||
var r req.UpdateRefundReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := refundService.Update(r); err != nil {
|
||||
global.Logger.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("更新成功", c)
|
||||
}
|
||||
|
||||
// Delete
|
||||
// @Tags 管理
|
||||
// @Summary 删除(支持批量)
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body object{ids=[]string} true "id列表"
|
||||
// @Success 200 {object} response.Response "删除成功"
|
||||
// @Router /order/refund/delete [post]
|
||||
func (a *RefundApi) Delete(c *gin.Context) {
|
||||
var req struct {
|
||||
Ids []string `json:"ids" binding:"required,min=1"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := refundService.Delete(req.Ids); err != nil {
|
||||
global.Logger.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("删除成功", c)
|
||||
}
|
||||
|
||||
// Detail
|
||||
// @Tags 管理
|
||||
// @Summary 获取详情
|
||||
// @Security BasicAuth
|
||||
// @Produce json
|
||||
// @Param id query string true "ID"
|
||||
// @Success 200 {object} response.Response "获取详情成功"
|
||||
// @Router /order/refund/detail [get]
|
||||
func (a *RefundApi) Detail(c *gin.Context) {
|
||||
id := c.Query("id")
|
||||
data, err := refundService.Detail(id)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取详情失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(data, c)
|
||||
}
|
||||
|
||||
// List
|
||||
// @Tags 管理
|
||||
// @Summary 分页获取列表
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.ListRefundReq true "分页参数"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult} "获取列表成功"
|
||||
// @Router /order/refund/list [post]
|
||||
func (a *RefundApi) List(c *gin.Context) {
|
||||
var r req.ListRefundReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := refundService.List(r)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取列表失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: r.Current,
|
||||
PageSize: r.PageSize,
|
||||
}, c)
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package order
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/commom/response"
|
||||
req "sundynix-go/model/order/request"
|
||||
"sundynix-go/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type StockApi struct{}
|
||||
|
||||
var stockService = service.ServiceGroupApp.OrderServiceGroup.StockService
|
||||
|
||||
// Save
|
||||
// @Tags 管理
|
||||
// @Summary 新增
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.SaveStockReq true "新增参数"
|
||||
// @Success 200 {object} response.Response "新增成功"
|
||||
// @Router /order/stock/save [post]
|
||||
func (a *StockApi) Save(c *gin.Context) {
|
||||
var r req.SaveStockReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := stockService.Save(r); err != nil {
|
||||
global.Logger.Error("新增失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("新增成功", c)
|
||||
}
|
||||
|
||||
// Update
|
||||
// @Tags 管理
|
||||
// @Summary 更新
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.UpdateStockReq true "更新参数"
|
||||
// @Success 200 {object} response.Response "更新成功"
|
||||
// @Router /order/stock/update [post]
|
||||
func (a *StockApi) Update(c *gin.Context) {
|
||||
var r req.UpdateStockReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := stockService.Update(r); err != nil {
|
||||
global.Logger.Error("更新失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("更新成功", c)
|
||||
}
|
||||
|
||||
// Delete
|
||||
// @Tags 管理
|
||||
// @Summary 删除(支持批量)
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body object{ids=[]string} true "id列表"
|
||||
// @Success 200 {object} response.Response "删除成功"
|
||||
// @Router /order/stock/delete [post]
|
||||
func (a *StockApi) Delete(c *gin.Context) {
|
||||
var req struct {
|
||||
Ids []string `json:"ids" binding:"required,min=1"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := stockService.Delete(req.Ids); err != nil {
|
||||
global.Logger.Error("删除失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("删除成功", c)
|
||||
}
|
||||
|
||||
// Detail
|
||||
// @Tags 管理
|
||||
// @Summary 获取详情
|
||||
// @Security BasicAuth
|
||||
// @Produce json
|
||||
// @Param id query string true "ID"
|
||||
// @Success 200 {object} response.Response "获取详情成功"
|
||||
// @Router /order/stock/detail [get]
|
||||
func (a *StockApi) Detail(c *gin.Context) {
|
||||
id := c.Query("id")
|
||||
data, err := stockService.Detail(id)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取详情失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(data, c)
|
||||
}
|
||||
|
||||
// List
|
||||
// @Tags 管理
|
||||
// @Summary 分页获取列表
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body req.ListStockReq true "分页参数"
|
||||
// @Success 200 {object} response.Response{data=response.PageResult} "获取列表成功"
|
||||
// @Router /order/stock/list [post]
|
||||
func (a *StockApi) List(c *gin.Context) {
|
||||
var r req.ListStockReq
|
||||
if err := c.ShouldBindJSON(&r); err != nil {
|
||||
response.FailWithMsg("参数错误:"+err.Error(), c)
|
||||
return
|
||||
}
|
||||
list, total, err := stockService.List(r)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取列表失败!", zap.Error(err))
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: r.Current,
|
||||
PageSize: r.PageSize,
|
||||
}, c)
|
||||
}
|
||||
+17
-11
@@ -32,24 +32,30 @@ func (a *AuthApi) Login(c *gin.Context) {
|
||||
response.FailWithMsg(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if l.CaptchaId != "" && l.Captcha != "" && store.Verify(l.CaptchaId, l.Captcha, true) {
|
||||
u := &system.User{Account: l.Account, Password: l.Password}
|
||||
user, err := userService.Login(u)
|
||||
if err != nil {
|
||||
global.Logger.Error("登录失败! 用户名不存在或者密码错误!", zap.Error(err))
|
||||
response.FailWithMsg("用户名不存在或者密码错误", c)
|
||||
return
|
||||
}
|
||||
a.GetToken(c, *user)
|
||||
|
||||
// 验证码校验:enable-captcha=0 时跳过
|
||||
captchaOk := global.Config.System.EnableCaptcha == 0 ||
|
||||
(l.CaptchaId != "" && l.Captcha != "" && store.Verify(l.CaptchaId, l.Captcha, true))
|
||||
|
||||
if !captchaOk {
|
||||
response.FailWithMsg("验证码错误", c)
|
||||
return
|
||||
}
|
||||
response.FailWithMsg("验证码错误", c)
|
||||
|
||||
u := &system.User{Account: l.Account, Password: l.Password}
|
||||
user, err := userService.Login(u)
|
||||
if err != nil {
|
||||
global.Logger.Error("登录失败! 用户名不存在或者密码错误!", zap.Error(err))
|
||||
response.FailWithMsg("用户名不存在或者密码错误", c)
|
||||
return
|
||||
}
|
||||
a.GetToken(c, *user)
|
||||
}
|
||||
|
||||
// Logout
|
||||
// @Tags 登录相关
|
||||
// @Summary pc登出
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Success 200 {object} response.Response{msg=string} "登出成功"
|
||||
// @Router /api/auth/logout [get]
|
||||
|
||||
@@ -18,7 +18,7 @@ type OssApi struct {
|
||||
// UploadFile
|
||||
// @tags 文件相关
|
||||
// @Summary 文件上传
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "上传文件"
|
||||
@@ -44,7 +44,7 @@ func (o *OssApi) UploadFile(c *gin.Context) {
|
||||
// DeleteFile
|
||||
// @tags 文件相关
|
||||
// @Summary 删除文件
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除文件"
|
||||
@@ -69,7 +69,7 @@ func (o *OssApi) DeleteFile(c *gin.Context) {
|
||||
// GetFileList
|
||||
// @tags 文件相关
|
||||
// @Summary 文件列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysReq.GetOssFileList true "文件列表"
|
||||
@@ -99,7 +99,7 @@ func (o *OssApi) GetFileList(c *gin.Context) {
|
||||
// Detail
|
||||
// @tags 文件相关
|
||||
// @Summary 文件详情
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "文件id"
|
||||
// @Success 200 {object} response.Response{data=string} "文件详情"
|
||||
|
||||
@@ -17,7 +17,7 @@ type ClientApi struct {
|
||||
// SaveClient
|
||||
// @Tags 客户端管理
|
||||
// @Summary 创建client
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Client true "client"
|
||||
@@ -42,7 +42,7 @@ func (s *ClientApi) SaveClient(c *gin.Context) {
|
||||
// UpdateClient
|
||||
// @Tags 客户端管理
|
||||
// @Summary 更新client
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Client true "client"
|
||||
@@ -67,7 +67,7 @@ func (s *ClientApi) UpdateClient(c *gin.Context) {
|
||||
// GetClientList
|
||||
// @Tags 客户端管理
|
||||
// @Summary 获取client列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body systemReq.GetClientList true "client"
|
||||
@@ -97,7 +97,7 @@ func (s *ClientApi) GetClientList(c *gin.Context) {
|
||||
// Delete
|
||||
// @Tags 客户端管理
|
||||
// @Summary 删除client
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "ids"
|
||||
@@ -123,7 +123,7 @@ func (s *ClientApi) Delete(c *gin.Context) {
|
||||
// @Tags 客户端管理
|
||||
// @Summary 获取client详情
|
||||
// @Description id获取详情
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{data=system.Client,msg=string} "获取client详情"
|
||||
|
||||
@@ -17,7 +17,7 @@ type MenuApi struct {
|
||||
// SaveMenu
|
||||
// @Tags 菜单管理
|
||||
// @Summary 新增菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Menu false "menu"
|
||||
@@ -42,7 +42,7 @@ func (m *MenuApi) SaveMenu(c *gin.Context) {
|
||||
// UpdateMenu
|
||||
// @Tags 菜单管理
|
||||
// @Summary 更新菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Menu false "menu"
|
||||
@@ -68,7 +68,7 @@ func (m *MenuApi) UpdateMenu(c *gin.Context) {
|
||||
// @Tags 菜单管理
|
||||
// @Summary 删除menu
|
||||
// @Description 删除menu
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{msg=string} "详情"
|
||||
@@ -88,7 +88,7 @@ func (m *MenuApi) DeleteMenu(c *gin.Context) {
|
||||
// @Tags 菜单管理
|
||||
// @Summary 获取menu详情
|
||||
// @Description id获取详情
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{data=system.Menu,msg=string} "详情"
|
||||
@@ -107,7 +107,7 @@ func (m *MenuApi) Detail(c *gin.Context) {
|
||||
// GetAllMenuTree
|
||||
// @Tags 菜单管理
|
||||
// @Summary 获取所有菜单树
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body systemReq.GetMenuTree true "菜单信息"
|
||||
@@ -132,7 +132,7 @@ func (m *MenuApi) GetAllMenuTree(c *gin.Context) {
|
||||
// GetUserMenuTree
|
||||
// @Tags 菜单管理
|
||||
// @Summary 用户菜单数据
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户菜单数据"
|
||||
// @Router /api/menu/getUserMenuTree [get]
|
||||
@@ -143,7 +143,7 @@ func (m *MenuApi) GetUserMenuTree(c *gin.Context) {
|
||||
// Route
|
||||
// @Tags 菜单管理
|
||||
// @Summary 用户路由
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户route"
|
||||
// @Router /api/menu/route [get]
|
||||
|
||||
@@ -17,7 +17,7 @@ type RoleApi struct {
|
||||
// SaveRole
|
||||
// @tags 角色管理
|
||||
// @Summary 创建角色
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body system.Role true "角色信息"
|
||||
@@ -42,7 +42,7 @@ func (a *RoleApi) SaveRole(context *gin.Context) {
|
||||
// UpdateRole
|
||||
// @tags 角色管理
|
||||
// @Summary 修改角色
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.Role true "角色ID"
|
||||
@@ -121,7 +121,7 @@ func (a *RoleApi) Delete(context *gin.Context) {
|
||||
// Detail
|
||||
// @Tags 角色管理
|
||||
// @Summary 角色详情
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{data=system.Role} "角色详情"
|
||||
@@ -140,7 +140,7 @@ func (a *RoleApi) Detail(context *gin.Context) {
|
||||
// GrantMenu
|
||||
// @tags 角色管理
|
||||
// @Summary 授权菜单给角色
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body systemreq.GrantMenu true "授权菜单给角色"
|
||||
|
||||
@@ -17,7 +17,7 @@ type UserApi struct {
|
||||
// SaveUser
|
||||
// @tags 用户管理
|
||||
// @Summary 新增用户
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept json
|
||||
// @Produce json
|
||||
// @Param data body system.User true "用户信息"
|
||||
@@ -41,7 +41,7 @@ func (u *UserApi) SaveUser(c *gin.Context) {
|
||||
// UpdateUser
|
||||
// @tags 用户管理
|
||||
// @Summary 更新用户
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body system.User true "用户ID,用户信息"
|
||||
@@ -65,7 +65,7 @@ func (u *UserApi) UpdateUser(c *gin.Context) {
|
||||
// GetUserList
|
||||
// @tags 用户管理
|
||||
// @Summary 获取用户列表
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body systemReq.GetUserList true "页码, 每页大小, 搜索条件"
|
||||
@@ -95,7 +95,7 @@ func (u *UserApi) GetUserList(c *gin.Context) {
|
||||
// Delete
|
||||
// @Tags 用户管理
|
||||
// @Summary 删除用户
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除用户"
|
||||
@@ -120,7 +120,7 @@ func (u *UserApi) Delete(c *gin.Context) {
|
||||
// Detail
|
||||
// @Tags 用户管理
|
||||
// @Summary 获取用户详情
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Produce application/json
|
||||
// @Param id query string true "id"
|
||||
// @Success 200 {object} response.Response{data=system.User} "获取用户详情成功"
|
||||
@@ -139,7 +139,7 @@ func (u *UserApi) Detail(c *gin.Context) {
|
||||
// ChangePassword
|
||||
// @Tags 用户管理
|
||||
// @Summary 修改密码
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @Description 修改密码
|
||||
// @accept json
|
||||
// @Produce application/json
|
||||
@@ -165,7 +165,7 @@ func (u *UserApi) ChangePassword(c *gin.Context) {
|
||||
// GrantRole
|
||||
// @Tags 用户管理
|
||||
// @Summary 给用户分配角色
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BasicAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body systemReq.GrantRole true "用户ID, 角色ID"
|
||||
|
||||
Reference in New Issue
Block a user