/// <summary> /// 从数据库读取流程信息 /// </summary> /// <param name="workflowids"></param> /// <returns></returns> public static List <WorkflowModel> Load(WorkflowQueryForm form) { List <WorkflowModel> models = new List <WorkflowModel>(); if (form == null) { return(models); } #region query data ISqlMapper mapper = MapperHelper.GetMapper(); WorkflowDao wfdao = new WorkflowDao(mapper); ActivityDao activitydao = new ActivityDao(mapper); LinkDao linkDao = new LinkDao(mapper); ActivityAuthDao authdao = new ActivityAuthDao(mapper); ApprovalDao approvalDao = new ApprovalDao(mapper); TaskDao taskdao = new TaskDao(mapper); List <Activity> activityList = new List <Activity>(); List <Link> linkList = new List <Link>(); List <ActivityAuth> authList = new List <ActivityAuth>(); List <Approval> approvalList = new List <Approval>(); List <Task> taskList = new List <Task>(); List <Workflow> workflows = new List <Workflow>(); //先从缓存取值 //var item = cache.GetItem(id); //if (item != null) //{ // model = item.Value as WorkflowModel; // return model; //} workflows = wfdao.Query(form); var workflowids = (from wf in workflows select wf.ID).ToList(); activityList = activitydao.Query(new ActivityQueryForm { WorkflowIDs = workflowids }); linkList = linkDao.Query(new LinkQueryForm { WorkflowIDs = workflowids }); approvalList = approvalDao.Query(new ApprovalQueryForm { WorkflowIDs = workflowids }); authList = authdao.Query(new ActivityAuthQueryForm { WorkflowIDs = workflowids }); taskList = taskdao.Query(new TaskQueryForm { WorkflowIDs = workflowids }); #endregion foreach (var workflow in workflows) { var model = BuildWorkflow(workflow, activityList, linkList, authList, approvalList, taskList); models.Add(model); } return(models); }
/// <summary> /// 从数据库读取流程信息 /// </summary> /// <param name="workflowids"></param> /// <returns></returns> public static List<WorkflowModel> Load(WorkflowQueryForm form) { List<WorkflowModel> models = new List<WorkflowModel>(); if (form == null) return models; #region query data ISqlMapper mapper = MapperHelper.GetMapper(); WorkflowDao wfdao = new WorkflowDao(mapper); ActivityDao activitydao = new ActivityDao(mapper); LinkDao linkDao = new LinkDao(mapper); ActivityAuthDao authdao = new ActivityAuthDao(mapper); ApprovalDao approvalDao = new ApprovalDao(mapper); TaskDao taskdao = new TaskDao(mapper); List<Activity> activityList = new List<Activity>(); List<Link> linkList = new List<Link>(); List<ActivityAuth> authList = new List<ActivityAuth>(); List<Approval> approvalList = new List<Approval>(); List<Task> taskList = new List<Task>(); List<Workflow> workflows = new List<Workflow>(); //先从缓存取值 //var item = cache.GetItem(id); //if (item != null) //{ // model = item.Value as WorkflowModel; // return model; //} workflows = wfdao.Query(form); var workflowids = (from wf in workflows select wf.ID).ToList(); activityList = activitydao.Query(new ActivityQueryForm { WorkflowIDs = workflowids }); linkList = linkDao.Query(new LinkQueryForm { WorkflowIDs = workflowids }); approvalList = approvalDao.Query(new ApprovalQueryForm { WorkflowIDs = workflowids }); authList = authdao.Query(new ActivityAuthQueryForm { WorkflowIDs = workflowids }); taskList = taskdao.Query(new TaskQueryForm { WorkflowIDs = workflowids }); #endregion foreach (var workflow in workflows) { var model = BuildWorkflow(workflow, activityList, linkList, authList, approvalList, taskList); models.Add(model); } return models; }