面包店
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_list.go 1.1 KiB

8 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetOrderGoodsListByIpad(eg *xorm.Engine, param map[string]string) (*[]model.OrderGoods, int64) {
  8. var order []model.OrderGoods
  9. sess := eg.Where("state!=5")
  10. if param["oid"] != "" {
  11. sess.And("oid = ?", param["oid"])
  12. }
  13. if param["state"] != "" {
  14. sess.And("state =?", param["state"])
  15. }
  16. if param["keyword"] != "" {
  17. sess.And("goods_title like ?", "%"+param["keyword"]+"%")
  18. }
  19. size := utils.StrToInt(param["limit"])
  20. start := (utils.StrToInt(param["page"]) - 1) * size
  21. count, err := sess.Limit(size, start).OrderBy("id asc").FindAndCount(&order)
  22. if err != nil {
  23. return nil, count
  24. }
  25. return &order, count
  26. }
  27. func GetOrderGoodsById(eg *xorm.Engine, id string) *model.OrderGoods {
  28. var order model.OrderGoods
  29. get, err := eg.Where("id=?", id).Get(&order)
  30. if get == false || err != nil {
  31. return nil
  32. }
  33. return &order
  34. }
  35. func GetOrderGoodsByIdSess(sess *xorm.Session, id string) *model.OrderGoods {
  36. var order model.OrderGoods
  37. get, err := sess.Where("id=?", id).Get(&order)
  38. if get == false || err != nil {
  39. return nil
  40. }
  41. return &order
  42. }