作者 yangfu

部门长修改

@@ -78,7 +78,7 @@ func DeleteUserPosition(id int) (err error) { @@ -78,7 +78,7 @@ func DeleteUserPosition(id int) (err error) {
78 func GetUserPositions(id int64, companyId int64, v interface{}) (err error) { 78 func GetUserPositions(id int64, companyId int64, v interface{}) (err error) {
79 o := orm.NewOrm() 79 o := orm.NewOrm()
80 sql := ` 80 sql := `
81 -select a.position_id,b.name,b.relation,b.create_at 81 +select a.position_id,b.name,b.relation,b.create_at create_time
82 from user_position a INNER JOIN position b on a.position_id = b.id 82 from user_position a INNER JOIN position b on a.position_id = b.id
83 where a.user_company_id =? and a.company_id =? and a.enable_status =1 and b.enable_status =1` 83 where a.user_company_id =? and a.company_id =? and a.enable_status =1 and b.enable_status =1`
84 if _, err = o.Raw(sql, id, companyId).QueryRows(v); err == nil { 84 if _, err = o.Raw(sql, id, companyId).QueryRows(v); err == nil {
@@ -1157,10 +1157,18 @@ func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64) @@ -1157,10 +1157,18 @@ func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64)
1157 if len(departments.Managers) > 0 { 1157 if len(departments.Managers) > 0 {
1158 var tmpIds []int64 1158 var tmpIds []int64
1159 if e := json.Unmarshal([]byte(departments.Managers), &tmpIds); e == nil { 1159 if e := json.Unmarshal([]byte(departments.Managers), &tmpIds); e == nil {
1160 - if len(tmpIds) > 0 {  
1161 - ids = append(ids, tmpIds...)  
1162 - break 1160 + for i := range tmpIds {
  1161 + if _, e := models.GetUserByUcidEnable(tmpIds[i]); e == nil && header.UserId != tmpIds[i] { //部门长不是自己,并且账号有效
  1162 + ids = append(ids, tmpIds...)
  1163 + break
  1164 + } else {
  1165 + log.Error("部门长无效:", tmpIds, e)
  1166 + }
1163 } 1167 }
  1168 + //if len(tmpIds) > 0 {
  1169 + // ids = append(ids, tmpIds...)
  1170 + // break
  1171 + //}
1164 } else { 1172 } else {
1165 log.Error(e) 1173 log.Error(e)
1166 } 1174 }