diff --git a/Controllers/PositionController.cs b/Controllers/PositionController.cs index 9f9a345..fbe0ec0 100644 --- a/Controllers/PositionController.cs +++ b/Controllers/PositionController.cs @@ -1,4 +1,5 @@ -using LY.App.Model; +using GraphQL; +using LY.App.Model; using LY.App.Service; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -23,7 +24,18 @@ namespace LY.App.Controllers [HttpGet("list")] public async Task Get([FromQuery] PositionQueryInput input) { - var positions =await _positionService.GetList(input); + var positions = await _positionService.GetList(input); + return Ok(positions); + } + /// + /// 登陆 后获取当前防区 + /// + /// + /// + [HttpPost("Details")] + public async Task detail(IEnumerable ids) + { + var positions = await _positionService.Detail(ids); return Ok(positions); } /// diff --git a/Service/PositionService.cs b/Service/PositionService.cs index 78b72df..5d991cc 100644 --- a/Service/PositionService.cs +++ b/Service/PositionService.cs @@ -109,11 +109,27 @@ namespace LY.App.Service var entity = await _db.Queryable().FirstAsync(a => a.Id == id && a.IsDeleted != true); if (entity != null) { + entity.SetRegionJson(); return new ApiResult() { data = entity }; } return new ApiResult(false, "未找到要获取的对象"); } /// + /// Details + /// + /// + /// + public async Task Detail(IEnumerable ids) + { + var entity = await _db.Queryable() + .Where(a => ids.Contains(a.Id) && a.IsDeleted != true).ToListAsync(); + entity.ForEach(a => + { + a.SetRegionJson(); + }); + return new ApiResult() { data = entity }; + } + /// /// 获取列表 /// ///