作者 yangfu

部门长修改

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