public string GetCondition(GetFactoryListReq req, string search) { var condition = $" factoryNo not in ('02','03','04','05','06','07') "; if (!search.IsNullOrEmpty()) { //condition += " and (companyName like @search or phoneNumber like @search )"; condition += " and factoryName like @search "; } return(condition); }
public int GetListCount(GetFactoryListReq req) { var search = req.search ?? ""; var dict = new Dictionary <string, string> { { "@search", $"%{search}%" }, { "@search2", search }, }; var condition = GetCondition(req, search); var list = SqlHelper.Instance.GetMutiViewCount <FactoryType>("factoryno", condition, dict); //var list = SqlHelper.Instance.GetDistinctCount<FactoryType>("FactoryType", condition, dict); return(list.Count); }
public List <FactoryType> GetFactoryList(GetFactoryListReq req, int size) { var search = req.search ?? ""; var order = req.orderField; var desc = Convert.ToBoolean(req.isDesc); var index = Convert.ToInt32(req.pageIndex); var orderStr = $"order by {order} "; if (desc) { orderStr += " desc "; } else { orderStr += " asc "; } var dict = new Dictionary <string, string> { { "@search", $"%{search}%" }, { "@search2", search }, }; var fields = "factoryno"; if (order != fields) { fields += "," + order; } var condition = GetCondition(req, search); return(SqlHelper.Instance.GetMutiView <FactoryType>("factoryno", fields, condition, index, size, orderStr, dict)); //return SqlHelper.Instance.GetViewPaging<FactoryType>("FactoryType", @"select * from FactoryType ", condition, index, size, orderStr, dict); }
public string GetFactoryList(GetFactoryListReq req) { var r = AllFunc.Instance.GetFactoryList(req); return(JsonConvert.SerializeObject(r)); }