完善基础数据

This commit is contained in:
yanpeng200212
2026-10-08 15:44:07 +08:00
parent 8430ba0452
commit 2ffb83830c
95 changed files with 37759 additions and 5 deletions
@@ -0,0 +1,39 @@
using FreeSql;
using F9WebAiTest.Domain.Entities.SYS.Zq;
using F9WebAiTest.Domain.Interfaces.SYS.Zq;
namespace F9WebAiTest.Infrastructure.FreeSqls.Repositories.SYS.Zq;
internal class ZhangqiWriteRepository : F9RepositoryBase, IZhangqiWriteRepository
{
public ZhangqiWriteRepository(IFreeSql fsql) : base(fsql) { }
public async Task<Zhangqi> GetByIdAsync(long id, CancellationToken cancellationToken)
=> await Orm.Select<Zhangqi>().Where(x => x.Id == id && x.DeletedAt == null).FirstAsync(cancellationToken);
public async Task<bool> AddAsync(Zhangqi zhangqi)
{
zhangqi.CreatedAt = DateTime.Now;
return await Orm.Insert(zhangqi).ExecuteAffrowsAsync() > 0;
}
public async Task<bool> UpdateAsync(Zhangqi zhangqi)
{
zhangqi.UpdatedAt = DateTime.Now;
return await Orm.Update<Zhangqi>().SetSource(zhangqi).ExecuteAffrowsAsync() > 0;
}
public async Task<bool> SoftDeleteAsync(long id)
=> await Orm.Update<Zhangqi>()
.Set(x => x.IsDeleted, true)
.Set(x => x.DeletedAt, DateTime.Now)
.Where(x => x.Id == id)
.ExecuteAffrowsAsync() > 0;
public async Task<bool> SetZhaZhangAsync(long id, bool isZhaZhang)
=> await Orm.Update<Zhangqi>()
.Set(x => x.IsZhaZhang, isZhaZhang)
.Set(x => x.UpdatedAt, DateTime.Now)
.Where(x => x.Id == id)
.ExecuteAffrowsAsync() > 0;
}