public Newtonsoft.Json.Linq.JArray processer(string jsonStr) { JArray mjsa= JArray.Parse(jsonStr); JObject mjosn=new JObject(); mjosn = JObject.Parse(mjsa[0].ToString()); string userID = mjosn["userID"].ToString(); string fatherCode=mjosn["fatherCode"].ToString(); string keyWord = mjosn["keyWord"].ToString(); int codeLen=fatherCode.Length; String sql=""; if(codeLen==3) { sql = "SELECT left(代码,5) 代码,名称 FROM Dict_国资2010 where right(代码,2)='00' and RIGHT(代码,4)<>'0000' and 代码 like '" + fatherCode + "%' and 名称 like '%"+keyWord+"%'"; }else if(codeLen==5){ sql = "SELECT 代码,名称 FROM Dict_国资2010 where 代码 like '" + fatherCode + "%'"; } List<Model> list=base.queryBySql(sql, new Dict_国资2010RowMapper()); JArray jsa=new JArray(); foreach(Model m in list){ JObject j=new Dict_国资2010RowMapper().mappingRow(m); jsa.Add(j); } return jsa; }
public Newtonsoft.Json.Linq.JArray processer(string jsonStr) { JArray mjsa = JArray.Parse(jsonStr); JObject mjosn = JObject.Parse(mjsa[0].ToString()); string userID = mjosn["userID"].ToString(); string pTypeID = mjosn["pTypeID"].ToString(); Dict_国资2010Dao dd = new Dict_国资2010Dao(); //例如是3 List<Model> list = dd.getAllFatherTypeByID(pTypeID); JArray jsa = new JArray(); foreach (Model m in list) { JObject j; j = new Dict_国资2010RowMapper().mappingRow(m); jsa.Add(j); } return jsa; }