Dept.go 750 B

123456789101112131415161718192021222324252627282930313233343536
  1. package controllers
  2. import (
  3. "ERP_user/models/Account"
  4. beego "github.com/beego/beego/v2/server/web"
  5. "gogs.baozhida.cn/zoie/ERP_libs/lib"
  6. )
  7. type DeptController struct {
  8. beego.Controller
  9. User Account.User
  10. }
  11. func (c *DeptController) Prepare() {
  12. c.User = *Account.User_r
  13. }
  14. // 部门列表 -
  15. func (c *DeptController) List() {
  16. c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: Account.Read_Dept_List()}
  17. c.ServeJSON()
  18. return
  19. }
  20. // 岗位列表 -
  21. func (c *DeptController) Post_List() {
  22. T_dept, _ := c.GetInt("T_dept")
  23. if T_dept == 0 {
  24. c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_dept Err!"}
  25. c.ServeJSON()
  26. return
  27. }
  28. c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: Account.Read_Post_List(T_dept)}
  29. c.ServeJSON()
  30. return
  31. }