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.
45 lines
1.6 KiB
45 lines
1.6 KiB
using System.Linq.Expressions;
|
|
using Wood.Data.Repository;
|
|
using Wood.Entity;
|
|
using Wood.Entity.SystemManage;
|
|
using Wood.Service.BaseService;
|
|
using Wood.Service.SystemManage.Param;
|
|
using Wood.Util;
|
|
|
|
namespace Wood.Service.SystemManage
|
|
{
|
|
public class DataDictService : ApiCRUDService<DataDictEntity, DataDictEntity, DataDictAddParam, DataDictUpdateParam>
|
|
{
|
|
private readonly SqlSugarRepository<DataDictDetailEntity> _dataDictDetailRepository;
|
|
|
|
public DataDictService(SqlSugarRepository<DataDictEntity> repository, SqlSugarRepository<DataDictDetailEntity> dataDictDetailRepository) : base(repository)
|
|
{
|
|
_dataDictDetailRepository = dataDictDetailRepository;
|
|
}
|
|
|
|
|
|
#region 获取数据
|
|
public async Task<TDataPaged<DataDictEntity>> Paged(DataDictPagedParam param)
|
|
{
|
|
return await _repository.AsQueryable()
|
|
.WhereIF(!string.IsNullOrEmpty(param.Name), it => it.DictName.Contains(param.Name!))
|
|
.ToPagedListAsync(param);
|
|
}
|
|
|
|
public async Task<int> GetMaxSort()
|
|
{
|
|
var result = await this._repository.AsQueryable().MaxAsync(it => it.Sort);
|
|
return result + 10;
|
|
}
|
|
#endregion
|
|
|
|
public override async Task Delete(BaseIdListParam param)
|
|
{
|
|
if (param.Ids.Any())
|
|
{
|
|
await _repository.FakeDeleteAsync(it => param.Ids.Contains(it.Id));
|
|
await _dataDictDetailRepository.FakeDeleteAsync(it => param.Ids.Contains(it.DictTypeId));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|