sys_department.go 807 B

12345678910111213141516171819202122232425
  1. package crm
  2. import (
  3. "hongze/fms_api/global"
  4. "time"
  5. )
  6. // SysDepartment 系统部门表
  7. type SysDepartment struct {
  8. DepartmentId int `gorm:"primaryKey;column:department_id;type:int(11);not null" json:"department_id"`
  9. DepartmentName string `gorm:"unique;column:department_name;type:varchar(255);default:''" json:"department_name"` // 部门名称
  10. CreateTime time.Time `gorm:"column:create_time;type:datetime" json:"create_time"` // 创建时间
  11. }
  12. func (m *SysDepartment) TableName() string {
  13. return "sys_department"
  14. }
  15. func (m *SysDepartment) List(condition string, pars []interface{}) (list []*SysDepartment, err error) {
  16. list = make([]*SysDepartment, 0)
  17. err = global.MYSQL["report"].Model(m).
  18. Where(condition, pars...).
  19. Find(&list).Error
  20. return
  21. }