paymentselect.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package oilsupplier
  2. import (
  3. "dashoo.cn/backend/api/business/oilsupplier/paymentselect"
  4. . "dashoo.cn/backend/api/controllers"
  5. "dashoo.cn/utils"
  6. "strings"
  7. )
  8. type PaymentSelectController struct {
  9. BaseController
  10. }
  11. // @Title 获取明细列表
  12. // @Description get user by token
  13. // @Success 200 {object} []paymentselect.PaymentselectList
  14. // @router /list [get]
  15. func (this *PaymentSelectController) GetEntityList() {
  16. //获取分页信息
  17. page := this.GetPageInfoForm()
  18. orderby := "p.PayDate"
  19. where := " 1=1 "
  20. asc := " DESC"
  21. SupplierTypeName := this.GetString("SupplierTypeName")
  22. SupplierName := this.GetString("SupplierName")
  23. CreateOn := this.GetString("CreateOn")
  24. if SupplierTypeName != "" {
  25. where = where + " and c.SupplierTypeName like '%" + SupplierTypeName + "%'"
  26. }
  27. if SupplierName != "" {
  28. where = where + " and s.SupplierName like '%" + SupplierName + "%'"
  29. }
  30. if CreateOn != "" {
  31. dates := strings.Split(CreateOn, ",")
  32. if len(dates) == 2 {
  33. minDate := dates[0]
  34. maxDate := dates[1]
  35. where = where + " and p.PayDate>='" + minDate + "' and p.PayDate<='" + maxDate + "'"
  36. }
  37. }
  38. //svc := suppliercert.GetOilSupplierCertService(utils.DBE)
  39. //var list []suppliercert.OilSupplierCert
  40. svc := paymentselect.GetPaymentSelectService(utils.DBE)
  41. var list []paymentselect.PaymentselectList
  42. total := svc.GetPaymentselectList( page.CurrentPage, page.Size, orderby, asc, &list, where)
  43. //total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
  44. var datainfo DataInfo
  45. datainfo.Items = list
  46. datainfo.CurrentItemCount = total
  47. datainfo.PageIndex = page.CurrentPage
  48. datainfo.ItemsPerPage = page.Size
  49. this.Data["json"] = &datainfo
  50. this.ServeJSON()
  51. }
  52. // @Title 获取汇总列表
  53. // @Description 获取汇总列表
  54. // @Success 200 {object} paymentselect.PaymentselectList
  55. // @router /sumlist [get]
  56. func (this *PaymentSelectController) GetEntitySumList() {
  57. orderby := "c.SupplierTypeName"
  58. where := " 1=1 "
  59. asc := " DESC"
  60. svc := paymentselect.GetPaymentSelectService(utils.DBE)
  61. var list []paymentselect.PaymentselectList
  62. svc.GetPaymentselectSumList(orderby, asc, &list, where)
  63. var datainfo DataInfo
  64. datainfo.Items = list
  65. this.Data["json"] = &datainfo
  66. this.ServeJSON()
  67. }