fmd-etc-select-name-page.go 676 B

12345678910111213141516171819202122232425262728
  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 EtcSelectName struct {
  8. EtcType string `xorm:"not null VARCHAR(21)"`
  9. SelectName string `xorm:"VARCHAR(49)"`
  10. }
  11. type EtcSelectNamePageRet struct {
  12. Page []EtcSelectName
  13. }
  14. func (t *EtcSelectNamePageRet) GetPage(YDB *xorm.Engine) error {
  15. qry := *YDB.Select("distinctrow etc_type, select_name").Table("dbr_etc").Asc("sort_no")
  16. if _, err := qry.FindAndCount(&t.Page); err == nil {
  17. e.FuncRun("oytrsderas", e.CurrFuncName())
  18. return nil
  19. } else {
  20. return errors.New(e.PageQryErr("mniosgfde", e.CurrFuncName()+err.Error()))
  21. }
  22. }