Beispiel #1
0
        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));
        }
Beispiel #2
0
 /// <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));
 }
Beispiel #3
0
        public int GetCountByStore(int storeId, DishEnums.CategoryEnums type)
        {
            string whereSql = BuildWhereSql(storeId: storeId, type: type);

            return(GetCount(whereSql));
        }
Beispiel #4
0
        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));
        }