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.
48 lines
1.4 KiB
48 lines
1.4 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 DataDictDetailService : ApiCRUDService<DataDictDetailEntity,DataDictDetailEntity, DataDictDetailAddParam, DataDictDetailUpdateParam>
|
|
{
|
|
public DataDictDetailService(SqlSugarRepository<DataDictDetailEntity> repository) : base(repository)
|
|
{
|
|
}
|
|
|
|
public async Task<TDataPaged<DataDictDetailEntity>> Paged(DataDictDetailPagedParam param)
|
|
{
|
|
return await _repository.AsQueryable()
|
|
.WhereIF(param.DictId>0,it=>it.DictTypeId==param.DictId)
|
|
.WhereIF(!string.IsNullOrEmpty(param.Name), it => it.DictValue.Contains(param.Name!)||it.DictKey.Contains(param.Name!))
|
|
.ToPagedListAsync(param);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取字典信息列表用于选择
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<ElSelectDto>> GetSelectList(string code)
|
|
{
|
|
return await _repository.AddStatusFilter(1)
|
|
.Where(it=>it.DataDict!.FormCode==code)
|
|
.Select(it => new ElSelectDto()
|
|
{
|
|
Label = it.DictValue,
|
|
Disabled = false,
|
|
Value = it.DictKey
|
|
}).ToListAsync();
|
|
}
|
|
|
|
public async Task<int> GetMaxSort()
|
|
{
|
|
var result = await this._repository.AsQueryable().MaxAsync(it => it.Sort);
|
|
return result + 10;
|
|
}
|
|
|
|
}
|
|
}
|
|
|