feat 点位图
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Dlhis.Basic.Map.Request;
|
||||
using Dlhis.Basic.Map.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Map.Services.Implements;
|
||||
|
||||
public class PointMapDetailService : IPointMapDetailService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public PointMapDetailService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(SavePointMapDetailRequest request)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<PointMapDetailEntity>();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<PointMapDetailEntity>().Where(x => x.Id == request.Id).SingleAsync();
|
||||
request.Adapt(entity);
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(long id)
|
||||
{
|
||||
await _dbContext.Deleteable<PointMapDetailEntity>().Where(x => x.Id == id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
public async Task<List<PointMapDetailResponse>> GetListByPointMapCodeAsync(Guid pointMapCode)
|
||||
{
|
||||
return await _dbContext.Queryable<PointMapDetailEntity>()
|
||||
.Where(x => x.PointMapCode == pointMapCode)
|
||||
.Select<PointMapDetailResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user