package system

import (
	"spaceofcheng/services/models"
	"spaceofcheng/services/models/model"
	"spaceofcheng/services/utils"

	"github.com/go-xorm/xorm"
)

// DictDAO 当前数据库操作对象
type DictDAO struct {
	ctx *utils.Context
	db  *xorm.Session
}

// NewDictDAO New Inst
func NewDictDAO(ctx *utils.Context) *DictDAO {
	return &DictDAO{
		ctx: ctx,
		db:  ctx.DB,
	}
}

// GetUserType 获取用户类型
func (m *DictDAO) GetUserType() ([]model.TdUserType, error) {
	var usertype []model.TdUserType
	err := m.db.Where("status>?", models.STATUS_DEL).Find(&usertype)
	return usertype, err
}
