面包店
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.

db_order_goods_doing.go 1.4 KiB

8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetOrderGoodsDoingList(eg *xorm.Engine, param map[string]string) (*[]model.OrderGoodsDoingFlow, int64) {
  8. var order []model.OrderGoodsDoingFlow
  9. sess := eg.Where("1=1")
  10. if param["admin_name"] != "" {
  11. var data []model.Admin
  12. eg.Where("memo like ?", "%"+param["admin_name"]+"%").Find(&data)
  13. ids := []int{-1}
  14. for _, v := range data {
  15. ids = append(ids, v.AdmId)
  16. }
  17. sess.In("admin_id", ids)
  18. }
  19. if param["enterprise_name"] != "" {
  20. var data []model.Enterprise
  21. eg.Where("name like ?", "%"+param["enterprise_name"]+"%").Find(&data)
  22. ids := []int{-1}
  23. for _, v := range data {
  24. ids = append(ids, v.Id)
  25. }
  26. sess.In("enterprise_id", ids)
  27. }
  28. if param["state"] != "" {
  29. sess.And("state =?", param["state"])
  30. }
  31. if param["enterprise_id"] != "" {
  32. sess.And("enterprise_id =?", param["enterprise_id"])
  33. }
  34. if param["goods_title"] != "" {
  35. sess.And("goods_title like ?", "%"+param["goods_title"]+"%")
  36. }
  37. if param["start_time"] != "" {
  38. sess.And("time>=?", param["start_time"])
  39. }
  40. if param["end_time"] != "" {
  41. sess.And("time<=?", param["end_time"])
  42. }
  43. size := utils.StrToInt(param["limit"])
  44. start := (utils.StrToInt(param["page"]) - 1) * size
  45. count, err := sess.Limit(size, start).OrderBy("time desc,id desc").FindAndCount(&order)
  46. if err != nil {
  47. return nil, count
  48. }
  49. return &order, count
  50. }