From c8600c6bd748f947d7dfdf99c0ea0f7fa346cdbf Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Wed, 18 Jun 2025 21:07:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86=E4=B9=8B=E5=90=8E=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E9=98=B2=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controllers/PositionController.cs | 16 ++++++++++++++-- Service/PositionService.cs | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) 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 }; + } + /// /// 获取列表 /// ///