92 lines
2.7 KiB
C#
92 lines
2.7 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.Custom.HistorySearchs;
|
|
using ARW.Service.Business.IBusinessService.Custom.HistorySearchs;
|
|
using ARW.Model.Dto.Business.Custom.HistorySearchs;
|
|
using ARW.Model.Models.Business.Custom.HistorySearchs;
|
|
using ARW.Model.Vo.Business.Custom.HistorySearchs;
|
|
|
|
namespace ARW.Service.Business.BusinessService.Custom.HistorySearchs
|
|
{
|
|
/// <summary>
|
|
/// 历史搜索接口实现类
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-10-09
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IHistorySearchService), ServiceLifetime = LifeTime.Transient)]
|
|
public class HistorySearchServiceImpl : BaseService<HistorySearch>, IHistorySearchService
|
|
{
|
|
private readonly HistorySearchRepository _HistorySearchRepository;
|
|
|
|
public HistorySearchServiceImpl(HistorySearchRepository HistorySearchRepository)
|
|
{
|
|
this._HistorySearchRepository = HistorySearchRepository;
|
|
}
|
|
|
|
#region 业务逻辑代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询历史搜索分页列表
|
|
/// </summary>
|
|
public async Task<PagedInfo<HistorySearchVo>> GetHistorySearchList(HistorySearchQueryDto parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<HistorySearch>();
|
|
|
|
var query = _HistorySearchRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
|
.Select(s => new HistorySearchVo
|
|
{
|
|
HistorySearchId = s.HistorySearchId,
|
|
HistorySearchGuid = s.HistorySearchGuid,
|
|
CustomerGuid = s.CustomerGuid,
|
|
HistorySearchContent = s.HistorySearchContent,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加或修改历史搜索
|
|
/// </summary>
|
|
public async Task<string> AddOrUpdateHistorySearch(HistorySearch model)
|
|
{
|
|
if (model.HistorySearchId != 0)
|
|
{
|
|
var response = await _HistorySearchRepository.UpdateAsync(model);
|
|
return "修改成功!";
|
|
}
|
|
else
|
|
{
|
|
|
|
var response = await _HistorySearchRepository.InsertReturnSnowflakeIdAsync(model);
|
|
return "添加成功!";
|
|
}
|
|
}
|
|
|
|
#region Excel处理
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|