public void List(ActionRequest req, ActionResponse res) { string msg = ""; ListAttrInfo la; try { if (!Session.IsAdmin) //权限判断,是管理员 { res.Error(VERIFY_ERROR); return; } ObModelQuery qry = req.GetModelByNameOrFirst <ObModelQuery>(QUERY); List <ObModelInfo> list = GetList(qry, out la, out msg); if (list == null) { res.Error(msg); return; } ActionResult ar = res.AddResult(ENTITY_RES, ENTITY_FIELDS); ar.AddModels <ObModelInfo>(list); ActionResult arAttr = res.AddResult(LISTATTR, LISTATTR_FIELDS); arAttr.AddModel(la); //获取关联结果集 if (qry.GetRelation.IsTrue()) { ActionResult arRe = res.AddResult(RELATION_RES, RELATION_FIELDS); if (list.Count > 0) { //获取ObModel的obId串 List <long> obIds = new List <long>(); for (int i = 0, j = list.Count; i < j; i++) { obIds.Add(list[i].ObId.Value); } //调用ObRelation实体对应的BL类中的获取列表方法 // ObRelationInfo 中属性 ObId 对应 ObModelInfo 的 ObId // RelationQuery 中属性 ObIds 对应 ObModelInfo 的 ObId (多个) /* * RelationBL rbl = new RelationBL(); * RelationQuery rqry = new RelationQuery(); * ListAttrInfo rla = new ListAttrInfo(); * rqry.PageNo = 1; * rqry.PageSize = list.Count; // * rqry.ObIds.Set(obIds); * List<ObRelationInfo> rList = rbl.GetList(rqry, out rla, out msg); * arRe.AddModels<ObRelationInfo>(rList); */ } else { arRe.AddModels <ObRelationInfo>(new List <ObRelationInfo>()); } } } catch (Exception ex) { msg = "ys.obModel.list 接口调用异常"; Logger.Error(ex, msg); res.Error(msg); } }