public string BuildWhereSql(DishEnums.CategoryEnums type, int?storeId = null, int?aId = null, bool isGetDel = false) { List <string> whereSql = new List <string> { $"Type = {(int)type}" }; if (storeId.HasValue && storeId > 0) { whereSql.Add($"StoreId = {storeId}"); } if (aId.HasValue && aId > 0) { whereSql.Add($"aId = {aId}"); } if (!isGetDel) { whereSql.Add("State <> -1"); } return(string.Join(" AND ", whereSql)); }
/// <summary> /// 查询 app/store 下所有的有效分类 /// </summary> /// <param name="type"></param> /// <param name="aId"></param> /// <param name="storeId"></param> /// <param name="getEffData">只返回有效数据</param> /// <returns></returns> public List <DishCategory> GetDishCategorys(DishEnums.CategoryEnums type, int aId = 0, int storeId = 0, int pageIndex = -1, int pageSize = 0, bool getEffData = false) { return(GetDishCategorys((int)type, aId, storeId, pageSize, pageIndex, getEffData)); }
public int GetCountByStore(int storeId, DishEnums.CategoryEnums type) { string whereSql = BuildWhereSql(storeId: storeId, type: type); return(GetCount(whereSql)); }
public List <DishCategory> GetListByStore(int storeId, DishEnums.CategoryEnums type, int pageIdex = 1, int pageSize = 10) { string whereSql = BuildWhereSql(storeId: storeId, type: type); return(GetList(whereSql, pageSize, pageIdex)); }