/// <summary> /// 查詢指定使用者的權限清單 /// 如果使用者為人員的話,會包含其所屬部門權限 /// </summary> public EO_PermissionSettingDataTable queryPermissionSettingsForUserId(string userId, string[] extendFieldNames) { //取得人員與其所屬群組代號 List <string> userIds = new List <string>(); var qry = new NsDbQuery(); qry.setSelect(s3 => { var t11 = s3.from <EO_PermissionSetting>(); s3.select(t11.EOPS_PermissionSettingId); s3.Where = qry.inquery(t11.EOPS_PermissionUserId, s2 => { s2.fromEmpty(AppDataName.EO); s2.select(userId.toConst().As("UserId")); s2.Where = userId.toConstReq1() != ""; s2.union(s => { var t1 = s.from <EO_DeptMember>(); s.select(t1.EODM_DeptId); s.Where = t1.EODM_MemberId == userId.toConstReq(userId.StartsWith("EOE_")) ; s.groupBy(t1.EODM_DeptId); }); }); }); var keys = qry.queryKeys <string>(); var dt = NsDmHelper.EO_PermissionSetting .selectAll(extendFieldNames) .where (t0 => t0.EOPS_PermissionSettingId.batchin(keys.toConstReq1())) .query(); return(dt); }