From 0a12f4f4a9798504124088e547e9350cacef5944 Mon Sep 17 00:00:00 2001 From: mahao Date: Fri, 14 Jul 2023 10:36:22 +0800 Subject: [PATCH] tj --- .../Controls/CentralizedControlAppService.cs | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs index de890cec..5bcff4f4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using EFCore.BulkExtensions; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Shouldly; using System; @@ -76,10 +77,10 @@ namespace Win.Sfs.SettleAccount.Entities.Controls } /// - /// 新增实体 + /// 添加 /// [HttpPost] - virtual public async Task CreateAsync(CentralizedControlCreateDto input) + public async Task CreateAsync(CentralizedControlCreateDto input) { var _first = _repository.Where(p => p.Version == input.Version).FirstOrDefault(); @@ -103,6 +104,30 @@ namespace Win.Sfs.SettleAccount.Entities.Controls return dto; } + + /// + /// 删除实体 + /// + /// ID + /// + [HttpDelete] + public async Task DeleteAsync(Guid id) + { + var entity = await _repository.GetAsync(id); + await _repository.DeleteAsync(id); + } + + /// + /// 按IDs删除实体列表 + /// + [HttpPost] + public async Task DeleteListAsync(List ids) + { + var _query = _repository.Where(p => ids.Contains(p.Id)); + int i = await _query.BatchDeleteAsync(); + + return i == 0; + } #endregion #region 开启、关闭