Пример #1
0
        public ActionResult GetPlistStateCodes(GetPlistStateCodes requestModel)
        {
            if (!ModelState.IsValid)
            {
                return ModelState.ToJsonResult();
            }
            var dataDics = GetRequiredService<IStateCodeQuery>().GetPlist(base.EntityType, () =>
            {
                RdbDescriptor rdb;
                if (!AcDomain.Rdbs.TryDb(base.EntityType.DatabaseId, out rdb))
                {
                    throw new AnycmdException("意外配置的StateCode实体类型对象数据库标识" + base.EntityType.DatabaseId);
                }
                List<DbParameter> ps;
                var filterString = new SqlFilterStringBuilder().FilterString(rdb, requestModel.Filters, "a", out ps);
                if (!string.IsNullOrEmpty(filterString))
                {
                    filterString = " where " + filterString;
                }
                return new SqlFilter(filterString, ps.ToArray());
            }, requestModel);
            Debug.Assert(requestModel.Total != null, "requestModel.Total != null");
            var data = new MiniGrid<Dictionary<string, object>> { total = requestModel.Total.Value, data = dataDics };

            return this.JsonResult(data);
        }