Pārlūkot izejas kodu

查待审核客户资料支持包含子级

zou.yingbin 4 gadi atpakaļ
vecāks
revīzija
71210f6ac2
1 mainītis faili ar 14 papildinājumiem un 6 dzēšanām
  1. 14 6
      models/qhjPCWeb.go

+ 14 - 6
models/qhjPCWeb.go

@@ -209,18 +209,26 @@ select u.accountname brokername, a.*
                to_number(t.brokerid) brokerid,
                t.birthday birthday2
           from wskh_userinfo t
-         start with t.areaid = %v
-        connect by prior t.userid = t.areaid
-               and t.usertype in (2, 6)
-               and level = %v) a
+         where 1=1 %v) a
   left join useraccount u
     on a.brokerid = u.userid
  where 1 = 1
-   and a.usertype != 2
    and a.status in (%v)
 `
+	var strParm string
+	if r.IncludeSub == 0 {
+		strParm = fmt.Sprintf(" and t.areaid = %v", r.USERID)
+	} else {
+		str := `
+		and t.areaid in (select t.userid
+		from useraccount t
+		where t.subarealevelpath like ',%%%v%%,'
+		and t.usertype=2)
+	`
+		strParm = fmt.Sprintf(str, r.USERID)
+	}
 	status := DecodeStr(r.QUERYTYPE == 1, "1", "2,4,5")
-	sqlId.FormatParam(r.USERID, r.level(), status)
+	sqlId.FormatParam(strParm, status)
 	sqlId.AndEx("a.USERINFOTYPE", r.USERINFOTYPE, r.USERINFOTYPE > 0)
 	sqlId.JoinEx(len(r.CUSTOMERNAME) > 0, fmt.Sprintf(` and a.customername like '%%%v%%'`, r.CUSTOMERNAME))
 	sqlId.JoinEx(len(r.NICKNAME) > 0, fmt.Sprintf(` and a.nickname like '%%%v%%'`, r.NICKNAME))