public virtual ReturnInfo <PagingInfo <WorkflowInfo> > QueryCurrUserAuditedFlowPage(int pageIndex, int pageSize, AuditFlowFilterInfo filter, string connectionId = null) { if (filter == null) { filter = new AuditFlowFilterInfo(); } filter.HandlerId = UserTool.CurrUser.Id; filter.EndCreateTime = filter.EndCreateTime.AddThisDayLastTime(); return(ExecReturnFuncAndConnectionId <PagingInfo <WorkflowInfo> >((reInfo, connId) => { return Persistence.SelectAuditedHandlePage(pageIndex, pageSize, filter, connId); }, null, connectionId, AccessMode.SLAVE)); }
/// <summary> /// 查询已审核的工作流列表并分页 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="pageSize">每页记录数</param> /// <param name="filter">筛选</param> /// <param name="connectionId">连接ID</param> /// <returns>分页信息</returns> public PagingInfo <WorkflowInfo> SelectAuditedHandlePage(int pageIndex, int pageSize, AuditFlowFilterInfo filter, string connectionId = null) { PagingInfo <WorkflowInfo> result = null; DynamicParameters parameters; StringBuilder whereSql = MergeWhereSql(filter, out parameters); whereSql.Append(" AND wh.handler_id=@HandlerId AND (wh.handle_status=@HandleStatus1 || wh.handle_status=@HandleStatus2) && handle_type=@HandleType"); parameters.Add("HandlerId", filter.HandlerId); parameters.Add("HandleStatus1", (byte)HandleStatusEnum.SENDED); parameters.Add("HandleStatus2", (byte)HandleStatusEnum.RETURNED); parameters.Add("HandleType", (byte)HandleTypeEnum.AUDIT); if (filter.FlowStatus != null) { whereSql.Append(" AND flow_status=@FlowStatus"); parameters.Add("FlowStatus", filter.FlowStatus); } string sortSql = GetSelectPageSortSql(filter, GetSelectSortNamePfx(filter)); if (string.IsNullOrWhiteSpace(sortSql)) { sortSql = $" ORDER BY wh.handle_time DESC"; } string formatSql = $"SELECT {{0}} FROM {Table}" + $" INNER JOIN workflow_handle wh ON {Table}.`id`=wh.`workflow_id`" + whereSql.ToString(); string countSql = string.Format(formatSql, "COUNT(*)"); string pageSql = string.Format(formatSql, $"{JoinSelectPropMapFields(pfx: Table + ".")},wh.`id`,wh.`is_readed` IsReaded") + " " + sortSql + " " + GetPartPageSql(pageIndex, pageSize); var source = this.GetType().Name; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { result = PagingUtil.ExecPage <WorkflowInfo>(pageIndex, pageSize, () => { Log.TraceAsync(countSql, source: source, tags: "SelectAuditedHandlePage"); return(dbConn.ExecuteScalar <int>(countSql, parameters, GetDbTransaction(connId))); }, () => { Log.TraceAsync(pageSql, source: source, tags: "SelectAuditedHandlePage"); return(dbConn.Query <WorkflowInfo, WorkflowHandleInfo, WorkflowInfo>(pageSql, (wf, wh) => { if (wf.Handles == null) { wf.Handles = new List <WorkflowHandleInfo>() { wh }; } return wf; }, parameters, GetDbTransaction(connId), splitOn: "id").AsList()); }); }, AccessMode.SLAVE); return(result); }