user_chart_permission_mapping.go 735 B

1234567891011121314151617181920212223
  1. package models
  2. import "github.com/beego/beego/v2/client/orm"
  3. type UserChartPermissionMapping struct {
  4. UserChartPermissionMappingId int `orm:"pk" description:"id"`
  5. UserId int `description:"用户id"`
  6. ChartPermissionId int `description:"品种id"`
  7. }
  8. func GetChartPermissionIdByUserId(UserId int) (items []int, err error) {
  9. o := orm.NewOrm()
  10. sql := `SELECT chart_permission_id FROM user_chart_permission_mapping WHERE user_id=?`
  11. _, err = o.Raw(sql, UserId).QueryRows(&items)
  12. return
  13. }
  14. func GetUserChartPermissionMapping() (items []*UserChartPermissionMapping, err error) {
  15. o := orm.NewOrm()
  16. sql := `SELECT * FROM user_chart_permission_mapping`
  17. _, err = o.Raw(sql).QueryRows(&items)
  18. return
  19. }