eta_permission.go 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. package eta
  2. import (
  3. "eta/eta_mini_ht_api/models"
  4. )
  5. const (
  6. Columns = "chart_permission_id,permission_name,parent_id"
  7. SyncColumns = "chart_permission_id ,permission_name ,parent_id ,sort"
  8. )
  9. // ChartPermission represents the structure of the chart_permission table.
  10. type ChartPermission struct {
  11. ChartPermissionID int `gorm:"primaryKey;autoIncrement;column:chart_permission_id;comment:主键"`
  12. PermissionName string `gorm:"size:50;default:'';column:permission_name;comment:权限名"`
  13. ParentID int `gorm:"size:11;default:0;column:parent_id;comment:父级权限id"`
  14. ClassifyId int `gorm:"classify_id"`
  15. Sort int `gorm:"default:null"`
  16. }
  17. // TableName sets the insert table name for this struct type
  18. func (c *ChartPermission) TableName() string {
  19. return "chart_permission"
  20. }
  21. func GetSyncPermissionList() (chartPermissionList []ChartPermission, err error) {
  22. db := models.ETA()
  23. err = db.Select(SyncColumns).Find(&chartPermissionList).Error
  24. if err == nil && chartPermissionList == nil {
  25. chartPermissionList = []ChartPermission{}
  26. }
  27. return
  28. }