面包店
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

60 wiersze
1.5 KiB

  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["gid"] != "" {
  14. sess.And("goods_id = ?", param["gid"])
  15. }
  16. if param["sku_id"] != "" {
  17. sess.And("sku_id = ?", param["sku_id"])
  18. }
  19. if param["state"] != "" {
  20. sess.And("state =?", param["state"])
  21. }
  22. if param["keyword"] != "" {
  23. sess.And("goods_title like ?", "%"+param["keyword"]+"%")
  24. }
  25. size := utils.StrToInt(param["limit"])
  26. start := (utils.StrToInt(param["page"]) - 1) * size
  27. count, err := sess.Limit(size, start).OrderBy("id asc").FindAndCount(&order)
  28. if err != nil {
  29. return nil, count
  30. }
  31. return &order, count
  32. }
  33. func GetOrderGoodsById(eg *xorm.Engine, id string) *model.OrderGoods {
  34. var order model.OrderGoods
  35. get, err := eg.Where("id=?", id).Get(&order)
  36. if get == false || err != nil {
  37. return nil
  38. }
  39. return &order
  40. }
  41. func GetOrderGoodsByIdSess(sess *xorm.Session, id string) *model.OrderGoods {
  42. var order model.OrderGoods
  43. get, err := sess.Where("id=?", id).Get(&order)
  44. if get == false || err != nil {
  45. return nil
  46. }
  47. return &order
  48. }
  49. func GetOrderGoods(sess *xorm.Session, oid, gid, skuId string) *model.OrderGoods {
  50. var data model.OrderGoods
  51. get, err := sess.Where("oid=? and goods_id=? and sku_id=?", oid, gid, skuId).Get(&data)
  52. if err != nil || get == false {
  53. return nil
  54. }
  55. return &data
  56. }