Beispiel #1
0
        public async Task <QueryAppConfigListOutput> QueryAppConfigList(QueryAppConfigListInput input)
        {
            var totalNumber = 0;

            // 环境库
            Enum.TryParse <Env>(input.Environment, out var env);
            var tableName = string.Empty;

            switch (env)
            {
            case Env.dev:
                tableName = $"tb_appconfig_{Env.dev.ToString()}";
                break;

            case Env.pro:
                tableName = $"tb_appconfig_{Env.pro.ToString()}";
                break;

            default:
                throw new BucketException("plm_001", "环境不存在");
            }
            // 执行
            var result = await _dbContext.Queryable <AppConfigInfo>().AS(tableName)
                         .WhereIF(!string.IsNullOrWhiteSpace(input.AppId), it => it.ConfigAppId == input.AppId)
                         .WhereIF(!string.IsNullOrWhiteSpace(input.NameSpace), it => it.ConfigNamespaceName == input.NameSpace)
                         .ToPageListAsync(input.PageIndex, input.PageSize, totalNumber);

            return(new QueryAppConfigListOutput {
                Data = result.Key, CurrentPage = input.PageIndex, Total = result.Value
            });
        }
        public async Task <QueryAppConfigListOutput> QueryAppConfigList(QueryAppConfigListInput input)
        {
            var totalNumber = 0;
            var result      = await _dbContext.Queryable <AppConfigInfo>()
                              .WhereIF(!string.IsNullOrWhiteSpace(input.AppId), it => it.ConfigAppId == input.AppId)
                              .WhereIF(!string.IsNullOrWhiteSpace(input.NameSpace), it => it.ConfigNamespaceName == input.NameSpace)
                              .ToPageListAsync(input.PageIndex, input.PageSize, totalNumber);

            return(new QueryAppConfigListOutput {
                Data = result.Key, CurrentPage = input.PageIndex, Total = totalNumber
            });
        }
Beispiel #3
0
        public BasePageOutput <object> QueryAppConfigList([FromQuery] QueryAppConfigListInput input)
        {
            var totalNumber = 0;
            // 环境库
            var tableName = _configService.GetConfigTableName(input.Environment);
            // 执行
            var lst = _adminDbContext.Queryable <AppConfigModel>().AS(tableName)
                      .WhereIF(!string.IsNullOrWhiteSpace(input.AppId), it => it.ConfigAppId == input.AppId)
                      .WhereIF(!string.IsNullOrWhiteSpace(input.NameSpace), it => it.ConfigNamespaceName == input.NameSpace)
                      .ToPageList(input.PageIndex, input.PageSize, ref totalNumber);

            return(new BasePageOutput <object> {
                Data = lst, CurrentPage = input.PageIndex, Total = totalNumber
            });
        }
 public async Task <QueryAppConfigListOutput> QueryAppConfigList([FromQuery] QueryAppConfigListInput input)
 {
     return(await _configBusniess.QueryAppConfigList(input));
 }