using LFlow.Base.Interfaces; using LFlow.Base.Utils; using LFlow.VersionManagement.Model; using Mapster; using Microsoft.AspNetCore.Mvc; namespace LFlow.VersionManagement.Service; /// /// 版本管理服务 /// public class VersionManagementService : BaseController, IVersionManagementService { private readonly IRepo _repo; public VersionManagementService(IRepo repo) { _repo = repo; } [HttpDelete] public int DeleteById(string id) { return _repo.DeleteById(id); } [HttpGet] public PagedApiResult> GetAll(int pageIndex, int pageSize) { var total = 0; var result = _repo.GetAll(pageIndex, pageSize, ref total); return new PagedApiResult> { Data = Mapper.Map>(result), PageIndex = pageIndex, PageSize = pageSize, Message = "获取成功", Success = true, TotalCount = total }; } [HttpGet] public VersionDto GetById(string id) { return _repo.Get(id).Adapt(); } [HttpPost] public VersionDto Save(VersionDto entity, bool isUpdate) { return _repo.SaveOrUpdate(entity.Adapt(), isUpdate).Adapt(); } [HttpPost] public List Search(VersionDto whereObj) { return _repo.Search(whereObj.Adapt()).Adapt>(); } [HttpPost] public List SearchAllId(VersionDto whereObj) { return _repo.WhereSearchId(whereObj.Adapt()); } }