新增分割
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由liquid模板自动生成 byzhouhang 20240909
|
||||
// 生成时间 2026-03-10 06:17:28Z
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using System.Threading.Tasks;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
namespace IRaCIS.Core.Application.Service;
|
||||
|
||||
/// <summary>
|
||||
/// 分割
|
||||
/// </summary>
|
||||
/// <param name="_segmentationRepository"></param>
|
||||
/// <param name="_mapper"></param>
|
||||
/// <param name="_userInfo"></param>
|
||||
/// <param name="_localizer"></param>
|
||||
[ ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class SegmentationService(IRepository<Segmentation> _segmentationRepository,
|
||||
IRepository<Segment> _segmentRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取分割组
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<SegmentationView>> GetSegmentationList(SegmentationQuery inQuery)
|
||||
{
|
||||
|
||||
var segmentationQueryable =_segmentationRepository
|
||||
.ProjectTo<SegmentationView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList= await segmentationQueryable.ToPagedListAsync(inQuery);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增修改分割组
|
||||
/// </summary>
|
||||
/// <param name="addOrEditSegmentation"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除分割组
|
||||
/// </summary>
|
||||
/// <param name="segmentationId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{segmentationId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteSegmentation(Guid segmentationId)
|
||||
{
|
||||
var success = await _segmentationRepository.DeleteFromQueryAsync(t => t.Id == segmentationId,true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取分割
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<SegmentView>> GetSegmentList(SegmentQuery inQuery)
|
||||
{
|
||||
|
||||
var segmentQueryable = _segmentRepository
|
||||
.ProjectTo<SegmentView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await segmentQueryable.ToPagedListAsync(inQuery);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增修改分割
|
||||
/// </summary>
|
||||
/// <param name="addOrEditSegment"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdateSegment(SegmentAddOrEdit addOrEditSegment)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var entity = await _segmentRepository.InsertOrUpdateAsync(addOrEditSegment, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除分割
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{segmentId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteSegment(Guid segmentId)
|
||||
{
|
||||
var success = await _segmentRepository.DeleteFromQueryAsync(t => t.Id == segmentId, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user