智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
2.6 KiB

  1. package hdl
  2. import (
  3. "applet/app/admin/lib/validate"
  4. "applet/app/admin/md"
  5. "applet/app/db"
  6. "applet/app/e"
  7. "applet/app/utils"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) {
  11. var req md.CentralKitchenForSchoolExportRecordsListReq
  12. err := c.ShouldBindJSON(&req)
  13. if err != nil {
  14. err = validate.HandleValidateErr(err)
  15. err1 := err.(e.E)
  16. e.OutErr(c, err1.Code, err1.Error())
  17. return
  18. }
  19. if req.Limit == 0 {
  20. req.Limit = 10
  21. }
  22. if req.Page == 0 {
  23. req.Page = 10
  24. }
  25. centralKitchenForSchoolExportRecordsDb := db.CentralKitchenForSchoolExportRecordsDb{}
  26. centralKitchenForSchoolExportRecordsDb.Set()
  27. list, total, err := centralKitchenForSchoolExportRecordsDb.CentralKitchenForSchoolExportRecordsList(req)
  28. if err != nil {
  29. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  30. return
  31. }
  32. e.OutSuc(c, map[string]interface{}{
  33. "list": list,
  34. "total": total,
  35. "kind": []map[string]interface{}{
  36. {
  37. "name": "订单列表",
  38. "value": 1,
  39. },
  40. {
  41. "name": "退款申请表",
  42. "value": 2,
  43. },
  44. {
  45. "name": "学校预定统计表",
  46. "value": 3,
  47. },
  48. {
  49. "name": "班级明细表",
  50. "value": 4,
  51. },
  52. {
  53. "name": "退款明细表",
  54. "value": 5,
  55. },
  56. {
  57. "name": "收款统计表",
  58. "value": 6,
  59. },
  60. {
  61. "name": "班级收款明细表",
  62. "value": 7,
  63. },
  64. {
  65. "name": "学校预定数量统计表",
  66. "value": 8,
  67. },
  68. },
  69. }, nil)
  70. return
  71. }
  72. func CentralKitchenForSchoolDataStatisticsDelete(c *gin.Context) {
  73. id := c.Param("id")
  74. centralKitchenForSchoolExportRecordsDb := db.CentralKitchenForSchoolExportRecordsDb{}
  75. centralKitchenForSchoolExportRecordsDb.Set()
  76. centralKitchenForSchoolExportRecords, err := centralKitchenForSchoolExportRecordsDb.GetCentralKitchenForSchoolExportRecords(utils.StrToInt(id))
  77. if err != nil {
  78. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  79. return
  80. }
  81. if centralKitchenForSchoolExportRecords == nil {
  82. e.OutErr(c, e.ERR_NO_DATA, "未查询到相关记录")
  83. return
  84. }
  85. _, err = centralKitchenForSchoolExportRecordsDb.CentralKitchenForSchoolExportRecordsDelete(id)
  86. if err != nil {
  87. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  88. return
  89. }
  90. e.OutSuc(c, "success", nil)
  91. return
  92. }
  93. func CentralKitchenForSchoolDataStatisticsExport(c *gin.Context) {
  94. var req md.CentralKitchenForSchoolDataStatisticsExportReq
  95. err := c.ShouldBindJSON(&req)
  96. if err != nil {
  97. err = validate.HandleValidateErr(err)
  98. err1 := err.(e.E)
  99. e.OutErr(c, err1.Code, err1.Error())
  100. return
  101. }
  102. e.OutSuc(c, map[string]interface{}{
  103. "msg": "导出成功,请稍后刷新数据列表",
  104. }, nil)
  105. return
  106. }