/// <summary> /// 门店下对应经纪人列表 /// </summary> /// <param name="deptid">门店id</param> /// <param name="pagesize">条数</param> /// <param name="pageindex">页数</param> /// <returns></returns> public string Listjjr(int?deptid = null, int pagesize = 20, int pageindex = 1) { timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; int userid = User.userid; List <string> where1 = new List <string>(); List <SqlParameter> where2 = new List <SqlParameter>(); string _where = ""; where1.Add($" a.state=0 and a.city=3 and a.roleid=4 and a.deptpath+ ',' like '%,{deptid},%'"); _where = " where " + string.Join(" and ", where1.ToArray()); string sql = $@"select * from (select a.userid,a.username,a.viliditystart,a.vilidityend ,b.realname,b.mobile,b.bindnum,erpgh,b.photoname,b.gradeid,b.origin,b.know_area,b.know_village,ROW_NUMBER() over(order by a.userid desc) as rows from user_member a left join user_details b on a.userid = b.userid left join user_roles c on a.roleid = c.roleid left join user_search_all_wuxi m on a.userid = m.userid left join (select userid, agentnum, storenum from statist_total) f on f.userid = a.userid left join user_dept g on a.deptid=g.deptid { _where }) t where t.rows>={ (pageindex - 1) * pagesize + 1 } and t.rows<={ pageindex * pagesize }"; string sql_c = $@"select count(1) from user_member a { _where }"; using (shhouseEntities ent = new shhouseEntities()) { try { //var datas = ent.Database.DynamicSqlQuery(sql, where2.Select(x => ((ICloneable)x).Clone()).ToArray()); DataTable datas = DBHelperSQL.Query(sql); for (int i = 0; i < datas.Rows.Count; i++) { datas.Rows[i]["know_area"] = Utils.chuli(datas.Rows[i]["know_area"]); } var datas_c = ent.Database.SqlQuery <int>(sql_c, where2.Select(x => ((ICloneable)x).Clone()).ToArray()).First(); return(JsonConvert.SerializeObject(new repmsg { state = 1, msg = "", data = new { sales = datas, count = datas_c, } }, timeFormat)); } catch (Exception e) { return(JsonConvert.SerializeObject(new repmsg { state = 0, msg = "没有找到经纪人信息" })); } } }
public TEntity GetEntity <TEntity>(string sqlString, params SqlParameter[] parameters) where TEntity : class, new() { DataSet ds = dbHelperSQL.Query(sqlString, parameters); return(GetEntity <TEntity>(ds)); }