完善基础数据
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
using FreeSql;
|
||||
using F9WebAiTest.Application.Dtos.SYS.Registries;
|
||||
using F9WebAiTest.Application.Interfaces.Repositories.SYS.Registries;
|
||||
using F9WebAiTest.Domain.Entities.SYS.Registries;
|
||||
|
||||
namespace F9WebAiTest.Infrastructure.FreeSqls.Repositories.SYS.Registries;
|
||||
|
||||
internal class RegistryReadRepository : F9RepositoryBase, IRegistryReadRepository
|
||||
{
|
||||
public RegistryReadRepository(IFreeSql fsql) : base(fsql) { }
|
||||
|
||||
public async Task<List<RegistryReadDto_View>> GetAllAsync()
|
||||
=> await Orm.Select<Registry>()
|
||||
.Where(x => x.DeletedAt == null)
|
||||
.OrderBy(x => x.Category)
|
||||
.OrderBy(x => x.KeyName)
|
||||
.ToListAsync(x => new RegistryReadDto_View(x.Id, x.Category, x.KeyName, x.Value, x.DataType, x.Description, x.IsActive));
|
||||
|
||||
public async Task<RegistryReadDto_Edit> GetByIdForEditAsync(long id)
|
||||
=> await Orm.Select<Registry>()
|
||||
.Where(x => x.Id == id && x.DeletedAt == null)
|
||||
.FirstAsync(x => new RegistryReadDto_Edit(x.Id, x.Category, x.KeyName, x.Value, x.DataType, x.Description, x.IsActive));
|
||||
|
||||
public async Task<RegistryReadDto_Edit> GetByCategoryAndKeyAsync(string category, string keyName)
|
||||
=> await Orm.Select<Registry>()
|
||||
.Where(x => x.DeletedAt == null && x.Category == category && x.KeyName == keyName)
|
||||
.FirstAsync(x => new RegistryReadDto_Edit(x.Id, x.Category, x.KeyName, x.Value, x.DataType, x.Description, x.IsActive));
|
||||
}
|
||||
Reference in New Issue
Block a user