“wwangchuanjin 5 yıl önce
ebeveyn
işleme
e92807ce78
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 4 4
      public/src/ent/entity/entity.go

+ 4 - 4
public/src/ent/entity/entity.go

@@ -64,10 +64,10 @@ func (c *CurrentUser) EntInfo(userId string, entId int) *CurrentUser {
 		//角色、权限
 		r := Mysql.SelectBySql(`SELECT a.name as user_name,a.power as user_power,b.role_id,d.id as dept_id,d.name as dept_name,d.subdis as dept_subdis,d.nodiff as dept_nodiff,e.id as dept_pid from entniche_user a 
 			LEFT JOIN entniche_user_role b on (a.id=b.user_id) 
-			LEFT JOIN entniche_department_user c on (a.id=c.user_id) 
-			LEFT JOIN entniche_department d on (d.ent_id=? and c.dept_id=d.id) 
-			LEFT JOIN entniche_department e on (e.ent_id=? and e.pid=0) 
-			where a.ent_id=? and a.phone=? order by a.id desc limit 1`, entId, entId, entId, phone)
+			INNER JOIN entniche_department_user c on (a.ent_id=? and a.phone=? and a.id=c.user_id) 
+			INNER JOIN entniche_department d on (d.ent_id=? and c.dept_id=d.id) 
+			INNER JOIN entniche_department e on (e.ent_id=? and e.pid=0) 
+			order by a.id desc limit 1`, entId, phone, entId, entId)
 		if r != nil && len(*r) == 1 {
 			currentUser.User_name, _ = (*r)[0]["user_name"].(string)
 			currentUser.User_power = qutil.IntAll((*r)[0]["user_power"])