后端重构
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package example
|
||||
|
||||
// RouterGroup Example路由组
|
||||
type RouterGroup struct {
|
||||
FileUploadRouter
|
||||
CustomerRouter
|
||||
AttachmentCategoryRouter
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
handler "kra/internal/server/handler/example"
|
||||
"kra/internal/server/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type AttachmentCategoryRouter struct{}
|
||||
|
||||
func (r *AttachmentCategoryRouter) InitAttachmentCategoryRouter(Router *gin.RouterGroup) {
|
||||
categoryRouter := Router.Group("attachmentCategory").Use(middleware.OperationRecordMiddleware())
|
||||
categoryRouterWithoutRecord := Router.Group("attachmentCategory")
|
||||
var api handler.AttachmentCategoryApi
|
||||
{
|
||||
categoryRouter.POST("addCategory", api.AddCategory)
|
||||
categoryRouter.POST("deleteCategory", api.DeleteCategory)
|
||||
}
|
||||
{
|
||||
categoryRouterWithoutRecord.GET("getCategoryList", api.GetCategoryList)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
handler "kra/internal/server/handler/example"
|
||||
"kra/internal/server/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type CustomerRouter struct{}
|
||||
|
||||
func (r *CustomerRouter) InitCustomerRouter(Router *gin.RouterGroup) {
|
||||
customerRouter := Router.Group("customer").Use(middleware.OperationRecordMiddleware())
|
||||
customerRouterWithoutRecord := Router.Group("customer")
|
||||
var api handler.CustomerApi
|
||||
{
|
||||
customerRouter.POST("customer", api.CreateExaCustomer)
|
||||
customerRouter.PUT("customer", api.UpdateExaCustomer)
|
||||
customerRouter.DELETE("customer", api.DeleteExaCustomer)
|
||||
}
|
||||
{
|
||||
customerRouterWithoutRecord.GET("customer", api.GetExaCustomer)
|
||||
customerRouterWithoutRecord.GET("customerList", api.GetExaCustomerList)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
handler "kra/internal/server/handler/example"
|
||||
"kra/internal/server/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type FileUploadRouter struct{}
|
||||
|
||||
func (r *FileUploadRouter) InitFileUploadRouter(Router *gin.RouterGroup) {
|
||||
fileUploadRouter := Router.Group("fileUploadAndDownload").Use(middleware.OperationRecordMiddleware())
|
||||
fileUploadRouterWithoutRecord := Router.Group("fileUploadAndDownload")
|
||||
var api handler.FileUploadApi
|
||||
{
|
||||
fileUploadRouter.POST("upload", api.UploadFile)
|
||||
fileUploadRouter.POST("deleteFile", api.DeleteFile)
|
||||
fileUploadRouter.POST("editFileName", api.EditFileName)
|
||||
fileUploadRouter.POST("importURL", api.ImportURL)
|
||||
}
|
||||
{
|
||||
fileUploadRouterWithoutRecord.POST("getFileList", api.GetFileList)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user