You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.9 KiB
93 lines
2.9 KiB
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<ColumnReference, Guid> _repository;
|
|
public ColumnReferenceManager(
|
|
IRepository<ColumnReference, Guid> repository
|
|
)
|
|
{
|
|
_repository = repository;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public async Task<ColumnReference> 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<ColumnReference, Guid>(_repository, sourceEntity.DisplayName, targetEntity);
|
|
targetEntity.DisplayName = sourceEntity.DisplayName;
|
|
}
|
|
targetEntity.ParmValue = sourceEntity.ParmValue;
|
|
}
|
|
|
|
public async Task CheckAndDeleteAsync(ColumnReference entity)
|
|
{
|
|
await _repository.DeleteAsync(entity);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改排序 置顶,置底
|
|
/// </summary>
|
|
/// <param name="id">需要修改的ID</param>
|
|
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
|
/// <returns></returns>
|
|
public async Task UpdateManySortAsync(Guid id, int SortType)
|
|
{
|
|
await EntityHelper.UpdateManySortAsync(_repository, id, SortType);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 修改排序 拖拽
|
|
/// </summary>
|
|
/// <typeparam name="TEntity"></typeparam>
|
|
/// <param name="repository"></param>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
public async Task UpdateSortManyAsync(UpdateSortManyDto input)
|
|
{
|
|
await EntityHelper.UpdateSortManyAsync(_repository, input);
|
|
|
|
}
|
|
}
|
|
}
|