Пример #1
0
        public List <StatisticsViewModel> GetList(Pagination pagination, string queryJson, string companyId = "")
        {
            var expression = ExtLinq.True <StatisticsViewModel>();
            var queryParam = queryJson.ToJObject();

            if (!queryParam["begintime"].IsEmpty())
            {
                var begintime = queryParam["begintime"].ToDate();
                //开始时间
                expression = expression.And(t => t.F_DateTime >= begintime);
            }
            if (!queryParam["endtime"].IsEmpty())
            {
                var endtime = queryParam["endtime"].ToDate().AddDays(1);
                //结束时间
                expression = expression.And(t => t.F_DateTime < endtime);
            }
            if (!queryParam["keyValue"].IsEmpty())
            {
                var meterCode = queryParam["keyValue"].ToString();
                //表计编码
                expression = expression.And(t => t.F_MeterCode == meterCode);
            }
            if (!string.IsNullOrEmpty(companyId))
            {
                expression = expression.And(t => t.F_OwnerId == companyId);
            }
            return(_viewService.FindList(expression, pagination));
        }