fmd-user-select.go 872 B

12345678910111213141516171819202122232425262728293031323334
  1. package models_func
  2. import (
  3. "errors"
  4. "github.com/dabory/abango-rest"
  5. e "github.com/dabory/abango-rest/etc"
  6. )
  7. type UserSelect struct {
  8. Id int `xorm:"not null pk autoincr INT(10)"`
  9. Name string `xorm:"not null VARCHAR(49)"`
  10. }
  11. type UserSelectPage struct {
  12. Page []UserSelect
  13. }
  14. func GetUserSelect(y *abango.Controller, sel *UserSelectPage, filter string) error { //여기서는 filter 안쓰고 슴슴
  15. qry := *y.Db.
  16. Table("users").
  17. Select("users.id, nick_name").
  18. Join("INNER", "dbr_user_ext", "dbr_user_ext.id=users.id").
  19. Where("branch_id=" + e.NumToStr(y.Gtb.BranchId)).
  20. Where("is_expired = '0'").
  21. Asc("nick_name")
  22. if err := qry.Find(&sel.Page); err == nil {
  23. e.FuncRun("3f34fga43far", e.CurrFuncName())
  24. return nil
  25. } else {
  26. return errors.New(e.PageQryErr("ltrysgaera", e.CurrFuncName()+err.Error()))
  27. }
  28. }