93 lines
3.0 KiB
C#
93 lines
3.0 KiB
C#
using Infrastructure.Attribute;
|
|
using Microsoft.AspNetCore.Http;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Infrastructure;
|
|
using ARW.Model;
|
|
using ARW.Repository;
|
|
using ARW.Repository.Business.Advertisement.SearchRecommends;
|
|
using ARW.Service.Business.IBusinessService.Advertisement.SearchRecommends;
|
|
using ARW.Model.Dto.Business.Advertisement.SearchRecommends;
|
|
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
|
using ARW.Model.Vo.Business.Advertisement.SearchRecommends;
|
|
|
|
namespace ARW.Service.Business.BusinessService.Advertisement.SearchRecommends
|
|
{
|
|
/// <summary>
|
|
/// 搜索推荐接口实现类
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-25
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(ISearchRecommendService), ServiceLifetime = LifeTime.Transient)]
|
|
public class SearchRecommendServiceImpl : BaseService<SearchRecommend>, ISearchRecommendService
|
|
{
|
|
private readonly SearchRecommendRepository _SearchRecommendRepository;
|
|
|
|
public SearchRecommendServiceImpl(SearchRecommendRepository SearchRecommendRepository)
|
|
{
|
|
this._SearchRecommendRepository = SearchRecommendRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询搜索推荐分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<SearchRecommendVo>> GetSearchRecommendList(SearchRecommendQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<SearchRecommend>();
|
|
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.SearchRecommendTitle), s => s.SearchRecommendTitle.Contains(parm.SearchRecommendTitle));
|
|
var query = _SearchRecommendRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.SearchRecommendSort,OrderByType.Asc)
|
|
.Select(s => new SearchRecommendVo
|
|
{
|
|
SearchRecommendId = s.SearchRecommendId,
|
|
SearchRecommendGuid = s.SearchRecommendGuid,
|
|
SearchRecommendTitle = s.SearchRecommendTitle,
|
|
SearchRecommendSort = s.SearchRecommendSort,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改搜索推荐
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateSearchRecommend(SearchRecommend model)
|
|
{
|
|
if (model.SearchRecommendId != 0)
|
|
{
|
|
var response = await _SearchRecommendRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _SearchRecommendRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|