mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-06-20 18:58:16 +08:00
chore: 🔨 css 基础单位 (#98)
This commit is contained in:
@ -49,6 +49,11 @@ public interface IDicModule
|
||||
/// </summary>
|
||||
Task<QueryDicContentRsp> GetContentAsync(QueryDicContentReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典值
|
||||
/// </summary>
|
||||
public Task<string> GetDicValueAsync(GetDicValueReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询字典目录
|
||||
/// </summary>
|
||||
|
@ -66,6 +66,28 @@ public sealed class DicService(IDicCatalogService catalogService, IDicContentSer
|
||||
return contentService.GetAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> GetDicValueAsync(GetDicValueReq req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var df = new DynamicFilterInfo {
|
||||
Filters = [
|
||||
new DynamicFilterInfo {
|
||||
Field = nameof(QueryDicContentReq.CatalogId)
|
||||
, Operator = DynamicFilterOperators.Eq
|
||||
, Value = req.CatalogId
|
||||
}
|
||||
, new DynamicFilterInfo {
|
||||
Field = nameof(QueryDicContentReq.Key)
|
||||
, Operator = DynamicFilterOperators.Eq
|
||||
, Value = req.Key
|
||||
}
|
||||
]
|
||||
};
|
||||
var queryParam = new QueryReq<QueryDicContentReq> { Count = 1, DynamicFilter = df };
|
||||
return (await QueryContentAsync(queryParam).ConfigureAwait(false)).FirstOrDefault()?.Value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<PagedQueryRsp<QueryDicCatalogRsp>> PagedQueryCatalogAsync(PagedQueryReq<QueryDicCatalogReq> req)
|
||||
{
|
||||
|
@ -79,6 +79,7 @@ public sealed class JobService(DefaultRepository<Sys_Job> rpo, IJobRecordService
|
||||
/// <inheritdoc />
|
||||
public async Task FinishJobAsync(UpdateJobReq req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var nextExecTime = GetNextExecTime(req.ExecutionCron);
|
||||
_ = await UpdateAsync(req with {
|
||||
Status = JobStatues.Idle
|
||||
@ -100,22 +101,24 @@ public sealed class JobService(DefaultRepository<Sys_Job> rpo, IJobRecordService
|
||||
public async Task<QueryJobRsp> GetNextJobAsync()
|
||||
{
|
||||
var df = new DynamicFilterInfo {
|
||||
Filters = [ new DynamicFilterInfo { Field = nameof(QueryJobReq.NextExecTime)
|
||||
, Value = DateTime.UtcNow
|
||||
, Operator = DynamicFilterOperators.LessThan
|
||||
}
|
||||
, new DynamicFilterInfo {
|
||||
Field = nameof(QueryJobReq.Status)
|
||||
, Value = JobStatues.Idle
|
||||
, Operator = DynamicFilterOperators.Eq
|
||||
}
|
||||
, new DynamicFilterInfo {
|
||||
Field = nameof(QueryJobReq.Enabled)
|
||||
, Value = true
|
||||
, Operator = DynamicFilterOperators.Eq
|
||||
}
|
||||
]
|
||||
};
|
||||
Filters = [
|
||||
new DynamicFilterInfo {
|
||||
Field = nameof(QueryJobReq.NextExecTime)
|
||||
, Value = DateTime.UtcNow
|
||||
, Operator = DynamicFilterOperators.LessThan
|
||||
}
|
||||
, new DynamicFilterInfo {
|
||||
Field = nameof(QueryJobReq.Status)
|
||||
, Value = JobStatues.Idle
|
||||
, Operator = DynamicFilterOperators.Eq
|
||||
}
|
||||
, new DynamicFilterInfo {
|
||||
Field = nameof(QueryJobReq.Enabled)
|
||||
, Value = true
|
||||
, Operator = DynamicFilterOperators.Eq
|
||||
}
|
||||
]
|
||||
};
|
||||
var job = await QueryInternal(new QueryReq<QueryJobReq> { DynamicFilter = df, Count = 1 }, true)
|
||||
.Where(a => !Rpo.Orm.Select<Sys_JobRecord>()
|
||||
.As("b")
|
||||
@ -163,6 +166,7 @@ public sealed class JobService(DefaultRepository<Sys_Job> rpo, IJobRecordService
|
||||
/// <inheritdoc />
|
||||
public Task<PagedQueryRsp<QueryJobRecordRsp>> RecordPagedQueryAsync(PagedQueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
return jobRecordService.PagedQueryAsync(req);
|
||||
}
|
||||
|
||||
@ -217,7 +221,7 @@ public sealed class JobService(DefaultRepository<Sys_Job> rpo, IJobRecordService
|
||||
, a => a.Id == req.Keywords.Int64Try(0) || a.JobName.Contains(req.Keywords))
|
||||
.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
return !orderByRandom && (!req.Prop?.Equals(nameof(req.Filter.Id), StringComparison.OrdinalIgnoreCase) ?? true)
|
||||
? ret.OrderByDescending(a => a.Id)
|
||||
? ret.OrderByDescending(a => a.LastExecTime)
|
||||
: ret.OrderByRandom();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user