user_yanxuan_permission.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxUserYanxuanPermission struct {
  7. UserYanxuanPermissionId int64 `orm:"column(user_yanxuan_permission_id);pk"`
  8. UserId int `description:"用户ID"`
  9. CompanyId int `description:"权限开始日期"`
  10. StartDate string `description:"权限开始日期"`
  11. EndDate string `description:"权限结束日期"`
  12. Status string `description:"'试用','未开通'"`
  13. Mobile string `description:"手机号"`
  14. Email string `description:"邮箱"`
  15. RealName string `description:"用户实际名称"`
  16. CompanyName string `description:"公司名称"`
  17. AdminId int `description:"后台添加人员ID"`
  18. AdminRealName string `description:"后台添加人员姓名"`
  19. CreatedTime time.Time `description:"创建时间"`
  20. LastUpdatedTime time.Time `description:"修改时间根据时间戳自动更新"`
  21. ModifyTime time.Time `description:"修改时间"`
  22. }
  23. type CygxUserYanxuanPermissionLog struct {
  24. UserYanxuanPermissionId int64 `orm:"column(user_yanxuan_permission_log_id);pk"`
  25. UserId int `description:"用户ID"`
  26. CompanyId int `description:"权限开始日期"`
  27. StartDate string `description:"权限开始日期"`
  28. EndDate string `description:"权限结束日期"`
  29. Status string `description:"'试用','未开通'"`
  30. Mobile string `description:"手机号"`
  31. Email string `description:"邮箱"`
  32. RealName string `description:"用户实际名称"`
  33. CompanyName string `description:"公司名称"`
  34. AdminId int `description:"后台添加人员ID"`
  35. AdminRealName string `description:"后台添加人员姓名"`
  36. CreatedTime time.Time `description:"创建时间"`
  37. LastUpdatedTime time.Time `description:"修改时间根据时间戳自动更新"`
  38. ModifyTime time.Time `description:"修改时间"`
  39. }
  40. // 根据用户ID获取是否开通过研选权限
  41. func GetCygxUserYanxuanPermissionCountByUserId(userId int) (count int, err error) {
  42. o := orm.NewOrm()
  43. sql := ` SELECT COUNT(1) FROM cygx_user_yanxuan_permission WHERE status = '试用' AND user_id = ? `
  44. err = o.Raw(sql, userId).QueryRow(&count)
  45. return
  46. }
  47. // 根据用户ID获取研选开通详情
  48. func GetCygxUserYanxuanPermissionDetailByUserId(userId int) (item *CygxUserYanxuanPermission, err error) {
  49. o := orm.NewOrm()
  50. sql := `SELECT * FROM cygx_user_yanxuan_permission WHERE status = '试用' AND user_id = ? `
  51. err = o.Raw(sql, userId).QueryRow(&item)
  52. return
  53. }