using Shentun.Peis.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp; using Volo.Abp.Domain.Services; using Shentun.Peis.HelperDto; namespace Shentun.Peis.ColumnReferences { public class ColumnReferenceManager: DomainService { private readonly IRepository _repository; public ColumnReferenceManager( IRepository repository ) { _repository = repository; } /// /// 创建 /// /// /// public async Task CreateAsync( ColumnReference entity ) { DataHelper.CheckEntityIsNull(entity); //Verify(entity); await EntityHelper.CheckSameName(_repository, entity.DisplayName); return new ColumnReference( GuidGenerator.Create() ) { DisplayName = entity.DisplayName, ParmValue = entity.ParmValue, DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_repository), }; } public async Task UpdateAsync( ColumnReference sourceEntity, ColumnReference targetEntity ) { DataHelper.CheckEntityIsNull(sourceEntity); DataHelper.CheckEntityIsNull(targetEntity); if (sourceEntity.DisplayName != targetEntity.DisplayName) { await EntityHelper.CheckSameName(_repository, sourceEntity.DisplayName, targetEntity); targetEntity.DisplayName = sourceEntity.DisplayName; } targetEntity.ParmValue = sourceEntity.ParmValue; } public async Task CheckAndDeleteAsync(ColumnReference entity) { await _repository.DeleteAsync(entity); } /// /// 修改排序 置顶,置底 /// /// 需要修改的ID /// 修改方式:1 置顶 2 置底 /// public async Task UpdateManySortAsync(Guid id, int SortType) { await EntityHelper.UpdateManySortAsync(_repository, id, SortType); } /// /// 修改排序 拖拽 /// /// /// /// /// public async Task UpdateSortManyAsync(UpdateSortManyDto input) { await EntityHelper.UpdateSortManyAsync(_repository, input); } } }