diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs index 8530f43a..b023416a 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs @@ -28,12 +28,32 @@ public class Ghre_OpenClassController : BaseController - /// 根据条件查询数据 + /// 学员查询 /// /// 开班ID /// [HttpPost, Route("QueryStaff/{Id}")] public async Task>> QueryStaff(long Id) => await _service.QueryStaff(Id); + + + /// + /// 学员新增 + /// + /// 开班ID + /// 员工ID列表 + /// + [HttpPost, Route("InsertStaff/{Id}")] + public async Task InsertStaff(long Id, [FromBody] List staffIds) => await _service.InsertStaff(Id, staffIds); + + + /// + /// 学员删除 + /// + /// 开班ID + /// 员工ID列表 + /// + [HttpPost, Route("DeleteStaff/{Id}")] + public async Task DeleteStaff(long Id, [FromBody] List staffIds) => await _service.DeleteStaff(Id, staffIds); #endregion #region 费用 diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 55dfdb3c..e4dabdce 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -1155,9 +1155,25 @@ - 根据条件查询数据 + 学员查询 + + 开班ID + + + + + 学员新增 + + 开班ID + 员工ID列表 + + + + + 学员删除 开班ID + 员工ID列表 diff --git a/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs index e814af7c..4a09bd4a 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs @@ -8,6 +8,9 @@ namespace Tiobon.Core.IServices; public interface IGhre_OpenClassServices : IBaseServices { Task>> QueryStaff(long Id); + Task InsertStaff(long Id, List staffIds); + + Task DeleteStaff(long Id, List staffIds); Task>> QueryGroupFee(long Id); diff --git a/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs b/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs index feec5dc3..6230c15d 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs @@ -1,4 +1,7 @@ -namespace Tiobon.Core.Services; +using MathNet.Numerics.Distributions; +using Microsoft.AspNetCore.Mvc; + +namespace Tiobon.Core.Services; /// /// 开班管理 (服务) @@ -126,6 +129,26 @@ public class Ghre_OpenClassServices : BaseServices>.OprateSuccess("查询成功!", result.result.DT_TableDataT1); } + + public async Task InsertStaff(long Id, List staffIds) + { + var inserts = staffIds.Select(x => new InsertGhre_OpenClassStaffInput() + { + StaffId = x, + OpenClassId = Id + }).ToList(); + await _ghre_OpenClassStaffServices.Add(inserts); + return ServiceResult.OprateSuccess(); + } + + public async Task DeleteStaff(long Id, List staffIds) + { + await Db.Updateable() + .SetColumns(it => new Ghre_OpenClassStaff() { IsEnable = 0 }) + .Where(it => it.StaffId != null && it.OpenClassId == Id && staffIds.Contains(it.StaffId.Value)) + .ExecuteCommandAsync(); + return ServiceResult.OprateSuccess(); + } #endregion #region 费用 diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 55dfdb3c..e4dabdce 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -1155,9 +1155,25 @@ - 根据条件查询数据 + 学员查询 + + 开班ID + + + + + 学员新增 + + 开班ID + 员工ID列表 + + + + + 学员删除 开班ID + 员工ID列表