123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using Attribute;
- using Dto;
- using Vo;
- using Model;
- using Model.Base;
- using Repository;
- using Service;
- using Microsoft.AspNetCore.Mvc;
- namespace Services
- {
- /// <summary>
- /// 字典项Service业务层处理
- /// </summary>
- [AppService(ServiceType = typeof(ISysDictItemService), ServiceLifetime = LifeTime.Transient)]
- public class SysDictItemService : BaseService<SysDictItem>, ISysDictItemService
- {
- /// <summary>
- /// 字典项-列表
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>字典项列表</returns>
- public PagedInfo<SysDictItemListVo> List([FromQuery] SysDictItemListDto parm)
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create<SysDictItem>();
- predicate = predicate.AndIF(parm.dictId != null, m => m.dictId == parm.dictId);
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.label), m => m.label.Contains(parm.label));
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.description), m => m.description.Contains(parm.description));
- var response = Queryable()
- .Where(predicate.ToExpression())
- .OrderByDescending(m => m.id)
- .ToPage<SysDictItem, SysDictItemListVo>(new PagerInfo());
- return response;
- }
- }
- }
|