sys_group.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. package crm
  2. import (
  3. "hongze/fms_api/global"
  4. "time"
  5. )
  6. // SysGroup 系统分组表
  7. type SysGroup struct {
  8. GroupId int `gorm:"primaryKey;column:group_id;type:int(11);not null" json:"group_id"`
  9. DepartmentId int `gorm:"index:idx_department_id;column:department_id;type:int(11)" json:"department_id"` // 部门id
  10. GroupName string `gorm:"column:group_name;type:varchar(255);default:''" json:"group_name"` // 分组名称
  11. CreateTime time.Time `gorm:"column:create_time;type:datetime" json:"create_time"`
  12. ParentId int `gorm:"column:parent_id;type:int(11);default:0" json:"parent_id"`
  13. }
  14. func (m *SysGroup) TableName() string {
  15. return "sys_group"
  16. }
  17. func (m *SysGroup) List(condition string, pars []interface{}) (list []*SysGroup, err error) {
  18. list = make([]*SysGroup, 0)
  19. err = global.MYSQL["report"].Model(m).
  20. Where(condition, pars...).
  21. Find(&list).Error
  22. return
  23. }
  24. func (m *SysGroup) Count(condition string, pars []interface{}) (total int64, err error) {
  25. err = global.MYSQL["report"].Model(m).
  26. Where(condition, pars...).
  27. Count(&total).Error
  28. return
  29. }