package supply_analysis

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

// VarietyAdminPermission variety_admin_permission 品种权限表
type VarietyAdminPermission struct {
	Id         int       `orm:"column(id);pk"`
	VarietyId  int       `description:"品种id"`
	SysUserId  int       `description:"用户id"`
	CreateTime time.Time `description:"添加时间"`
}

// GetVarietyPermissionByVarietyIdAndUserId 根据品种id和用户id获取权限记录表
func GetVarietyPermissionByVarietyIdAndUserId(varietyId, sysUserId int) (item *VarietyAdminPermission, err error) {
	o := orm.NewOrm()
	sql := `SELECT * FROM variety_admin_permission a  WHERE variety_id = ? AND sys_user_id = ? ORDER BY id desc `
	err = o.Raw(sql, varietyId, sysUserId).QueryRow(&item)
	return
}
