fmd-deal-type-select.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package models_func
  2. import (
  3. "errors"
  4. e "github.com/dabory/abango-rest/etc"
  5. "github.com/go-xorm/xorm"
  6. )
  7. type DealTypeSelect struct {
  8. Id int `xorm:"not null pk autoincr INT(10)"`
  9. CreatedOn int64 `xorm:"not null BIGINT(11)"`
  10. UpdatedOn int64 `xorm:"not null BIGINT(11)"`
  11. DealCategory string `xorm:"VARCHAR(21)"`
  12. SortNo int `xorm:"not null TINYINT(4)"`
  13. DealCode string `xorm:"VARCHAR(2)"`
  14. DealName string `xorm:"VARCHAR(21)"`
  15. SalesStatus int `xorm:"not null TINYINT(4)"`
  16. PurchStatus int `xorm:"not null TINYINT(4)"`
  17. CollectStatus int `xorm:"not null default 0 TINYINT(4)"`
  18. StockStatus int `xorm:"not null default 0 TINYINT(4)"`
  19. BadstkStatus int `xorm:"not null TINYINT(4)"`
  20. CoststkStatus int `xorm:"not null TINYINT(4)"`
  21. CreditStatus int `xorm:"not null TINYINT(4)"`
  22. RewardStatus int `xorm:"not null TINYINT(4)"`
  23. ExDateStatus int `xorm:"not null TINYINT(4)"`
  24. IsGenIo int `xorm:"not null TINYINT(4)"`
  25. IsReqRetro int `xorm:"not null TINYINT(4)"`
  26. GenIoPrtField string `xorm:"VARCHAR(49)"`
  27. }
  28. type DealTypeSelectPage struct {
  29. Page []DealTypeSelect
  30. }
  31. func GetDealTypeSelect(YDB *xorm.Engine, sel *DealTypeSelectPage, deal string) error {
  32. qry := *YDB.Table("dbr_deal_type").Asc("sort_no")
  33. if deal != "" {
  34. qry = *qry.Where(deal)
  35. // qry = *qry.Where("deal_category='" + deal + "'")
  36. }
  37. if err := qry.Find(&sel.Page); err == nil {
  38. e.FuncRun("234adsrared", e.CurrFuncName())
  39. return nil
  40. } else {
  41. return errors.New(e.PageQryErr("ltrysgaera", e.CurrFuncName()+err.Error()))
  42. }
  43. }