variety_admin_permission.go 797 B

12345678910111213141516171819202122
  1. package supply_analysis
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // VarietyAdminPermission variety_admin_permission 品种权限表
  7. type VarietyAdminPermission struct {
  8. Id int `orm:"column(id);pk"`
  9. VarietyId int `description:"品种id"`
  10. SysUserId int `description:"用户id"`
  11. CreateTime time.Time `description:"添加时间"`
  12. }
  13. // GetVarietyPermissionByVarietyIdAndUserId 根据品种id和用户id获取权限记录表
  14. func GetVarietyPermissionByVarietyIdAndUserId(varietyId, sysUserId int) (item *VarietyAdminPermission, err error) {
  15. o := orm.NewOrmUsingDB("data")
  16. sql := `SELECT * FROM variety_admin_permission a WHERE variety_id = ? AND sys_user_id = ? ORDER BY id desc `
  17. err = o.Raw(sql, varietyId, sysUserId).QueryRow(&item)
  18. return
  19. }