sys_department.go 819 B

12345678910111213141516171819202122232425
  1. package models
  2. import "github.com/beego/beego/v2/client/orm"
  3. type SysDepartment struct {
  4. SysDepartmentId int `json:"sysDepartmentId"`
  5. SysDepartmentName string `json:"sysDepartmentName"`
  6. ParentId int `json:"sysDepartmentParentId"`
  7. Sort int `json:"sysDepartmentSort"`
  8. Level int `json:"level"`
  9. }
  10. func GetSysDepartmentByName(sysDepartmentName string) (item *SysDepartment, err error) {
  11. o := orm.NewOrm()
  12. sql := `SELECT * FROM sys_department WHERE sys_department_name = ?`
  13. err = o.Raw(sql, sysDepartmentName).QueryRow(&item)
  14. return
  15. }
  16. func GetSysDepartmentById(sysDepartmentId int) (item *SysDepartment, err error) {
  17. o := orm.NewOrm()
  18. sql := `SELECT * FROM sys_department WHERE sys_department_Id = ?`
  19. err = o.Raw(sql, sysDepartmentId).QueryRow(&item)
  20. return
  21. }