/// <summary> /// 获取设备类型列表 /// </summary> /// <param name="req"></param> /// <param name="size"></param> /// <returns></returns> public List <MeterType> GetList(MeterTypeReq req, int size) { var search = req.search ?? ""; var order = req.orderField; var desc = Convert.ToBoolean(req.isDesc); var index = Convert.ToInt32(req.pageIndex); //var size = 5; var orderStr = $"order by {order} "; if (desc) { orderStr += " desc "; } else { orderStr += " asc "; } var dict = new Dictionary <string, string> { { "@search", $"%{search}%" } }; var condition = " 1=1 "; if (!search.IsNullOrEmpty()) { condition += " and (meterTypeName like @search or meterTypeNo like @search or MarkCode like @search)"; } return(SqlHelper.Instance.GvpForCommon <MeterType>("metertypeno", "MeterType", "select * from MeterType ", condition, index, size, orderStr, dict)); }
/// <summary> /// 获取设备类型的总数 /// </summary> /// <param name="req"></param> /// <returns></returns> public int GetCount(MeterTypeReq req) { var search = req.search ?? ""; var dict = new Dictionary <string, string> { { "@search", $"%{search}%" } }; var condition = " 1=1 "; if (!search.IsNullOrEmpty()) { condition += " and (meterTypeName like @search or meterTypeNo like @search or MarkCode like @search)"; } var list = SqlHelper.Instance.GdcForCommon <MeterType>("metertypeno", "MeterType", condition, dict); return(list.Count); }
public string GetMeterTypeList(MeterTypeReq req) { var r = AllFunc.Instance.GetMeterTypeList(req); return(JsonConvert.SerializeObject(r)); }