sys_department.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package system
  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. CreateTime time.Time `description:"创建时间"`
  13. }
  14. type SysDepartmentEditReq struct {
  15. DepartmentId int `description:"部门Id"`
  16. DepartmentName string `description:"部门名称"`
  17. }
  18. type SysDepartmentDeleteReq struct {
  19. DepartmentId int `description:"部门Id"`
  20. }
  21. type SysDepartmentList struct {
  22. DepartmentId int `orm:"column(department_id);pk" description:"部门Id"`
  23. DepartmentName string `description:"部门名称"`
  24. CreateTime time.Time `description:"创建时间"`
  25. Child []*SysGroupList `description:"分组"`
  26. IsDepartment bool `description:"true:部门,false:分组"`
  27. }
  28. func GetDepartmentList() (items []*SysDepartmentList, err error) {
  29. o := orm.NewOrm()
  30. sql := `SELECT * FROM sys_department ORDER BY create_time ASC `
  31. _, err = o.Raw(sql).QueryRows(&items)
  32. return
  33. }
  34. type SysDepartmentListResp struct {
  35. List []*SysDepartmentList
  36. }
  37. type DepartmentGroupSellers struct {
  38. AdminId string `description:"系统用户id"`
  39. RealName string `description:"用户真实名称"`
  40. ChildrenList []DepartmentGroupSellers `description:"销售列表"`
  41. }
  42. // DepartmentGroupSellersResp 销售列表(根据部门、分组来)
  43. type DepartmentGroupSellersResp struct {
  44. List []DepartmentGroupSellers
  45. }