update
This commit is contained in:
1 parent
ef1f23b2d5
commit
7ae2630d3d
2 files changed
+6
-6
No files matched your search
+5
-5
@@ -61,14 +61,14 @@ func (e *Dept) Create() (Dept, error) {
|
||||
deptPath := "/" + utils.Int64ToString(e.Deptid)
|
||||
if int(e.ParentId) != 0 {
|
||||
var deptP Dept
|
||||
orm.Eloquent.Table("sys_dept").Where("deptId = ?", e.ParentId).First(&deptP)
|
||||
orm.Eloquent.Table("sys_dept").Where("dept_id = ?", e.ParentId).First(&deptP)
|
||||
deptPath = deptP.DeptPath + deptPath
|
||||
} else {
|
||||
deptPath = "/0" + deptPath
|
||||
}
|
||||
var mp = map[string]string{}
|
||||
mp["deptPath"] = deptPath
|
||||
if err := orm.Eloquent.Table("sys_dept").Where("deptId = ?", e.Deptid).Update(mp).Error; err != nil {
|
||||
if err := orm.Eloquent.Table("sys_dept").Where("dept_id = ?", e.Deptid).Update(mp).Error; err != nil {
|
||||
err := result.Error
|
||||
return doc, err
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func (e *Dept) Get() (Dept, error) {
|
||||
|
||||
table := orm.Eloquent.Table("sys_dept")
|
||||
if e.Deptid != 0 {
|
||||
table = table.Where("deptId = ?", e.Deptid)
|
||||
table = table.Where("dept_id = ?", e.Deptid)
|
||||
}
|
||||
if e.Deptname != "" {
|
||||
table = table.Where("dept_name = ?", e.Deptname)
|
||||
@@ -99,7 +99,7 @@ func (e *Dept) GetList() ([]Dept, error) {
|
||||
|
||||
table := orm.Eloquent.Table("sys_dept")
|
||||
if e.Deptid != 0 {
|
||||
table = table.Where("deptId = ?", e.Deptid)
|
||||
table = table.Where("dept_id = ?", e.Deptid)
|
||||
}
|
||||
if e.Deptname != "" {
|
||||
table = table.Where("dept_name = ?", e.Deptname)
|
||||
@@ -119,7 +119,7 @@ func (e *Dept) GetPage(bl bool) ([]Dept, error) {
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("sys_dept")
|
||||
if e.Deptid != 0 {
|
||||
table = table.Where("deptId = ?", e.Deptid)
|
||||
table = table.Where("dept_id = ?", e.Deptid)
|
||||
}
|
||||
if e.Deptname != "" {
|
||||
table = table.Where("dept_name = ?", e.Deptname)
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ func (e *SysUser) GetPage(pageSize int, pageIndex int) ([]SysUserPage, int32, er
|
||||
}
|
||||
|
||||
if e.DeptId != 0 {
|
||||
table = table.Where("dept_id in (select deptId from sys_dept where dept_path like ? )", "%"+utils.Int64ToString(e.DeptId)+"%")
|
||||
table = table.Where("dept_id in (select dept_id from sys_dept where dept_path like ? )", "%"+utils.Int64ToString(e.DeptId)+"%")
|
||||
}
|
||||
|
||||
// 数据权限控制
|
||||
|
||||
Reference in new issue
Block a user