fmd-etc-select.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 EtcSelect struct {
  8. // SelectName string `xorm:"VARCHAR(49)"`
  9. Value string `xorm:"VARCHAR(191)"`
  10. Caption string `xorm:"VARCHAR(191)"`
  11. }
  12. type EtcSelectPage struct {
  13. Page []EtcSelect
  14. }
  15. // type EtcPage struct {
  16. // Page []models_table.DbrEtc
  17. // }
  18. func EtcSelectGet(YDB *xorm.Engine, sel *EtcSelectPage, etcType string, selName string) error {
  19. // qry := *YDB.Table("dbr_etc").Where("etc_type='" + etcType + "' and select_name='" + selName + "'").Asc("sort_no")
  20. qry := *YDB.Table("dbr_etc").Where("etc_type='" + etcType + "' and select_name='" + selName + "'").Asc("sort_no")
  21. if err := qry.Find(&sel.Page); err == nil {
  22. e.FuncRun("234adsrared", e.CurrFuncName())
  23. return nil
  24. } else {
  25. return errors.New(e.PageQryErr("ltrysgaera", e.CurrFuncName()+err.Error()))
  26. }
  27. // var t EtcPage
  28. // qry := *YDB.Table("dbr_etc").Where("etc_type='" + etcType + "' and select_name='" + selName + "'").Asc("sort_no")
  29. // if cnt, err := qry.FindAndCount(&t.Page); err == nil {
  30. // sel.Page = make([]EtcSelect, cnt)
  31. // for key, r := range t.Page {
  32. // sel.Page[key].Value = r.Value
  33. // sel.Page[key].Caption = r.Caption
  34. // }
  35. // e.FuncRun("cseldfsregas", e.CurrFuncName()+selName)
  36. // return nil
  37. // } else {
  38. // return errors.New(e.PageQryErr("rtyertyuery", e.CurrFuncName()+selName+err.Error()))
  39. // }
  40. }