93 lines
3.0 KiB
Go
93 lines
3.0 KiB
Go
package handler
|
|
|
|
import (
|
|
"ego/internal/service"
|
|
"ego/pkg/logger"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// SysDeployFileHandler 部署文件处理器
|
|
type SysDeployFileHandler struct {
|
|
deployFileService *service.SysDeployFileService
|
|
}
|
|
|
|
// NewSysDeployFileHandler 构建部署文件处理器
|
|
func NewSysDeployFileHandler(deployFileService *service.SysDeployFileService) *SysDeployFileHandler {
|
|
return &SysDeployFileHandler{
|
|
deployFileService: deployFileService,
|
|
}
|
|
}
|
|
|
|
// Create 创建部署文件记录
|
|
// @Summary 创建部署文件记录
|
|
// @Description 创建新的部署文件记录
|
|
// @Tags 部署文件管理
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param deployFile body model.SysDeployFile true "部署文件信息"
|
|
// @Success 200 {object} serializer.Response
|
|
// @Router /deploy-files [post]
|
|
func (h *SysDeployFileHandler) Create(c *gin.Context) {
|
|
logger.Info(c, "创建部署文件记录")
|
|
c.JSON(200, h.deployFileService.Create(c))
|
|
}
|
|
|
|
// GetByID 根据ID获取部署文件记录
|
|
// @Summary 获取部署文件记录
|
|
// @Description 根据ID获取部署文件记录详情
|
|
// @Tags 部署文件管理
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path string true "部署ID"
|
|
// @Success 200 {object} serializer.Response
|
|
// @Router /deploy-files/{id} [get]
|
|
func (h *SysDeployFileHandler) GetByID(c *gin.Context) {
|
|
logger.Info(c, "获取部署文件记录", zap.String("id", c.Param("id")))
|
|
c.JSON(200, h.deployFileService.GetByID(c))
|
|
}
|
|
|
|
// UpdateByID 根据ID更新部署文件记录
|
|
// @Summary 更新部署文件记录
|
|
// @Description 根据ID更新部署文件记录
|
|
// @Tags 部署文件管理
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path string true "部署ID"
|
|
// @Param deployFile body model.SysDeployFile true "部署文件信息"
|
|
// @Success 200 {object} serializer.Response
|
|
// @Router /deploy-files/{id} [put]
|
|
func (h *SysDeployFileHandler) UpdateByID(c *gin.Context) {
|
|
logger.Info(c, "更新部署文件记录", zap.String("id", c.Param("id")))
|
|
c.JSON(200, h.deployFileService.UpdateByID(c))
|
|
}
|
|
|
|
// DeleteByID 根据ID删除部署文件记录
|
|
// @Summary 删除部署文件记录
|
|
// @Description 根据ID删除部署文件记录
|
|
// @Tags 部署文件管理
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path string true "部署ID"
|
|
// @Success 200 {object} serializer.Response
|
|
// @Router /deploy-files/{id} [delete]
|
|
func (h *SysDeployFileHandler) DeleteByID(c *gin.Context) {
|
|
logger.Info(c, "删除部署文件记录", zap.String("id", c.Param("id")))
|
|
c.JSON(200, h.deployFileService.DeleteByID(c))
|
|
}
|
|
|
|
// GetByCondition 条件查询部署文件记录
|
|
// @Summary 条件查询部署文件记录
|
|
// @Description 根据条件分页查询部署文件记录
|
|
// @Tags 部署文件管理
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param params query types.Params true "查询参数"
|
|
// @Success 200 {object} serializer.Response
|
|
// @Router /deploy-files [get]
|
|
func (h *SysDeployFileHandler) GetByCondition(c *gin.Context) {
|
|
logger.Info(c, "条件查询部署文件记录")
|
|
c.JSON(200, h.deployFileService.GetByCondition(c))
|
|
}
|