SysAttachmentController_gen.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package gen
  2. import (
  3. "git.qianqiusoft.com/qianqiusoft/light-apiengine/controllers/partial"
  4. "git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
  5. "github.com/gin-gonic/gin"
  6. "github.com/xormplus/xorm"
  7. )
  8. // SysAttachmentController operations for SysAttachment
  9. type SysAttachmentController struct {
  10. Db *xorm.Engine
  11. }
  12. func NewSysAttachmentController(db *xorm.Engine) *SysAttachmentController {
  13. controller := &SysAttachmentController{db}
  14. return controller
  15. }
  16. // Upload
  17. // @Title Upload
  18. // @Description 上传文件
  19. // @Success 200 {object} models.Account
  20. // @Failure 403 :id is empty
  21. // @router /upload [post]
  22. func (c *SysAttachmentController) Upload(ctx *gin.Context) {
  23. //
  24. partial.SysAttachment_Upload(&entitys.CtrlContext{ctx, c.Db})
  25. }
  26. // Download
  27. // @Title Download
  28. // @Description 下载文件
  29. // @Param id string false "文件ID"
  30. // @Success 200 {object} models.Account
  31. // @Failure 403 :id is empty
  32. // @router /download [get]
  33. func (c *SysAttachmentController) Download(ctx *gin.Context) {
  34. //
  35. partial.SysAttachment_Download(&entitys.CtrlContext{ctx, c.Db})
  36. }
  37. // Delete
  38. // @Title Delete
  39. // @Description 删除文件
  40. // @Param id string false "文件ID"
  41. // @Success 200 {object} models.Account
  42. // @Failure 403 :id is empty
  43. // @router /delete [get]
  44. func (c *SysAttachmentController) Delete(ctx *gin.Context) {
  45. //
  46. partial.SysAttachment_Delete(&entitys.CtrlContext{ctx, c.Db})
  47. }