|
@@ -704,7 +704,29 @@ namespace GxPress.Repository.Implement.WorkFlow
|
|
|
{
|
|
|
return await _repository.GetAsync(query);
|
|
|
}
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// 获取未处理的
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="flowId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<FlowTodo> GetUCheckedAsync(int flowId)
|
|
|
+ {
|
|
|
+ string sql = $@" SELECT
|
|
|
+ a.*
|
|
|
+ FROM
|
|
|
+ tede_flow_todo a
|
|
|
+ INNER JOIN
|
|
|
+ tede_user b ON a.UserId = b.Id
|
|
|
+ WHERE
|
|
|
+ a.FlowId ={flowId} AND a.IsDone = 0
|
|
|
+ AND a.Type = 'ApproverCheck'
|
|
|
+ AND IsChecked = 0 order by a.Sort limit 1";
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ var result = await connection.QueryFirstOrDefaultAsync<FlowTodo>(sql);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
public async Task<bool> UpdateAsync(FlowTodo todo)
|
|
|
{
|
|
|
return await _repository.UpdateAsync(todo);
|
|
@@ -777,7 +799,51 @@ namespace GxPress.Repository.Implement.WorkFlow
|
|
|
.Where(nameof(FlowTodo.IsDone), true)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// 获取操作成功数量
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="flowId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<int> CheckedCountAsync(int flowId)
|
|
|
+ {
|
|
|
+ string sql = $@"SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ tede_flow_todo a
|
|
|
+ INNER JOIN
|
|
|
+ tede_user b ON a.UserId = b.Id
|
|
|
+ WHERE
|
|
|
+ a.FlowId ={flowId} AND a.IsDone = 1
|
|
|
+ AND a.Type = 'ApproverCheck'
|
|
|
+ AND IsChecked = 1";
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ var result = await connection.ExecuteScalarAsync<int>(sql);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取所有数量
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="flowId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<int> AllCountAsync(int flowId)
|
|
|
+ {
|
|
|
+ string sql = $@"SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ tede_flow_todo a
|
|
|
+ INNER JOIN
|
|
|
+ tede_user b ON a.UserId = b.Id
|
|
|
+ WHERE
|
|
|
+ a.FlowId ={flowId}
|
|
|
+ AND a.Type = 'ApproverCheck'";
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
+ var connection = database.GetConnection();
|
|
|
+ var result = await connection.ExecuteScalarAsync<int>(sql);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
public async Task<int> CountAsync(SqlKata.Query query)
|
|
|
{
|
|
|
return await _repository.CountAsync(query);
|