123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using ZR.Mall.Model;
- using ZR.Mall.Model.Dto;
- using ZR.Mall.Service.IService;
- namespace ZR.Mall.Service
- {
- /// <summary>
- /// 品牌表Service业务层处理
- /// </summary>
- [AppService(ServiceType = typeof(IBrandService))]
- public class BrandService : BaseService<Brand>, IBrandService
- {
- /// <summary>
- /// 查询品牌表列表
- /// </summary>
- /// <param name="parm"></param>
- /// <returns></returns>
- public PagedInfo<BrandDto> GetList(ShopBrandQueryDto parm)
- {
- var predicate = QueryExp(parm);
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToPage<Brand, BrandDto>(parm);
- return response;
- }
- /// <summary>
- /// 获取详情
- /// </summary>
- /// <param name="Id"></param>
- /// <returns></returns>
- public Brand GetInfo(long Id)
- {
- var response = Queryable()
- .Where(x => x.Id == Id)
- .First();
- return response;
- }
- /// <summary>
- /// 添加品牌表
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public Brand AddShopBrand(Brand model)
- {
- return Insertable(model).ExecuteReturnEntity();
- }
- /// <summary>
- /// 修改品牌表
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int UpdateShopBrand(Brand model)
- {
- return Update(model, true, "修改品牌表");
- }
- /// <summary>
- /// 导出品牌表
- /// </summary>
- /// <param name="parm"></param>
- /// <returns></returns>
- public PagedInfo<BrandDto> ExportList(ShopBrandQueryDto parm)
- {
- var predicate = QueryExp(parm);
- var response = Queryable()
- .Where(predicate.ToExpression())
- .Select((it) => new BrandDto()
- {
- }, true)
- .ToPage(parm);
- return response;
- }
- /// <summary>
- /// 查询导出表达式
- /// </summary>
- /// <param name="parm"></param>
- /// <returns></returns>
- private static Expressionable<Brand> QueryExp(ShopBrandQueryDto parm)
- {
- var predicate = Expressionable.Create<Brand>();
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name == parm.Name);
- return predicate;
- }
- }
- }
|