sys_department.go 610 B

123456789101112131415161718192021222324
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type SysDepartmentAddReq struct {
  7. DepartmentName string `description:"部门名称"`
  8. }
  9. type SysDepartment struct {
  10. DepartmentId int `orm:"column(department_id);pk" description:"部门Id"`
  11. DepartmentName string `description:"部门名称"`
  12. Sort int `description:"排序"`
  13. CreateTime time.Time `description:"创建时间"`
  14. }
  15. func GetSysDepartmentAll() (items []*SysDepartment, err error) {
  16. sql := `SELECT * FROM sys_department `
  17. o := orm.NewOrm()
  18. _, err = o.Raw(sql).QueryRows(&items)
  19. return
  20. }