/// <summary> /// 查询队伍信息 /// </summary> /// <param name="teamname"></param> /// <param name="company"></param> /// <param name="pageindex"></param> /// <returns></returns> public PagedList <tblteamsVew> GetTeams(string optMatch, string optLine, string optLines, string teamno, string teamname, int pageindex) { using (var db = new BFdbContext()) { StringBuilder sql = new StringBuilder(); sql.Append("SELECT case when isNULL(tc.team_combine_id)=1 then t.company else '【合并组队】' end as 'Company',ls.linename as linesname,u.name as nickname,t.*,u.mobile as Moblie,l.name as Linename,m.match_name as matchname FROM tbl_teams t left join tbl_line l on l.lineid = t.lineid left join tbl_users u on u.userid = t.userid left join tbl_match m on m.match_id = t.match_id left join tbl_lines ls on ls.lines_id = t.linesid left join tbl_teams_combine tc on tc.team_id=t.teamid where t.status = 0 "); if (!string.IsNullOrEmpty(optMatch)) { sql.AppendFormat(" AND t.match_id = '{0}'", optMatch); } if (!string.IsNullOrEmpty(optLine)) { sql.AppendFormat(" AND t.lineid = '{0}'", optLine); } if (!string.IsNullOrEmpty(optLines)) { sql.AppendFormat(" AND t.linesid = '{0}'", optLines); } if (!string.IsNullOrEmpty(teamno)) { sql.AppendFormat(" AND t.teamno = '{0}'", teamno); } if (!string.IsNullOrEmpty(teamname)) { sql.AppendFormat(" AND t.teamname like '%{0}%'", teamname); } return(db.SqlQuery1 <tblteamsVew, string>(sql.ToString(), pageindex, p => p.Teamno)); } }