feat 添加搜索推荐管理
This commit is contained in:
parent
3ea32705ae
commit
b965bdfc97
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
|
||||
namespace ARW.Model.Dto.Api.Advertisement.SearchRecommends
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 搜索推荐查询对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public class SearchRecommendQueryDtoApi : PagerInfo
|
||||
{
|
||||
public string SearchRecommendTitle { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 搜索推荐详情输入对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public class SearchRecommendDtoApi
|
||||
{
|
||||
[Required(ErrorMessage = "SearchRecommendGuid不能为空")]
|
||||
public long SearchRecommendGuid { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
|
||||
namespace ARW.Model.Dto.Business.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐输入对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public class SearchRecommendDto
|
||||
{
|
||||
|
||||
public int SearchRecommendId { get; set; }
|
||||
|
||||
public long SearchRecommendGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "搜索推荐标题不能为空")]
|
||||
public string SearchRecommendTitle { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "排序不能为空")]
|
||||
public int SearchRecommendSort { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 搜索推荐查询对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public class SearchRecommendQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string SearchRecommendTitle { get; set; }
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐,数据实体对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
[SugarTable("tb_search_recommend")]
|
||||
public class SearchRecommend : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "search_recommend_id")]
|
||||
public int SearchRecommendId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "search_recommend_guid")]
|
||||
public long SearchRecommendGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :搜索推荐标题
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "search_recommend_title")]
|
||||
public string SearchRecommendTitle { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :排序
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "search_recommend_sort")]
|
||||
public int SearchRecommendSort { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Api.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐展示对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public class SearchRecommendVoApi
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :搜索推荐标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 搜索推荐详情展示对象Api
|
||||
/// </summary>
|
||||
public class SearchRecommendApiDetailsVo
|
||||
{
|
||||
public int SearchRecommendId { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long SearchRecommendGuid { get; set; }
|
||||
public string SearchRecommendTitle { get; set; }
|
||||
public int SearchRecommendSort { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐展示对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public class SearchRecommendVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int SearchRecommendId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long SearchRecommendGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :搜索推荐标题
|
||||
/// </summary>
|
||||
public string SearchRecommendTitle { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :排序
|
||||
/// </summary>
|
||||
public int SearchRecommendSort { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
|
||||
namespace ARW.Repository.Business.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐仓储
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class SearchRecommendRepository : BaseRepository<SearchRecommend>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
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 ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.Advertisement.SearchRecommends;
|
||||
using ARW.Service.Api.IBusinessService.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Dto.Api.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Vo.Api.Advertisement.SearchRecommends;
|
||||
|
||||
namespace ARW.Service.Api.BusinessService.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐接口实现类Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISearchRecommendServiceApi), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SearchRecommendServiceImplApi : BaseService<SearchRecommend>, ISearchRecommendServiceApi
|
||||
{
|
||||
private readonly SearchRecommendRepository _SearchRecommendRepository;
|
||||
|
||||
public SearchRecommendServiceImplApi(SearchRecommendRepository SearchRecommendRepository)
|
||||
{
|
||||
this._SearchRecommendRepository = SearchRecommendRepository;
|
||||
}
|
||||
|
||||
#region Api接口代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询搜索推荐列表(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SearchRecommendVoApi>> GetSearchRecommendListApi(SearchRecommendQueryDtoApi 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 SearchRecommendVoApi
|
||||
{
|
||||
Title = s.SearchRecommendTitle,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询搜索推荐详情(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetSearchRecommendDetails(SearchRecommendDtoApi parm)
|
||||
{
|
||||
|
||||
var query = _SearchRecommendRepository
|
||||
.Queryable()
|
||||
.Where(s => s.SearchRecommendGuid == parm.SearchRecommendGuid)
|
||||
.Select(s => new SearchRecommendApiDetailsVo
|
||||
{
|
||||
SearchRecommendId = s.SearchRecommendId,
|
||||
SearchRecommendGuid = s.SearchRecommendGuid,
|
||||
SearchRecommendTitle = s.SearchRecommendTitle,
|
||||
SearchRecommendSort = s.SearchRecommendSort,
|
||||
}).Take(1);
|
||||
|
||||
|
||||
return await query.ToJsonAsync();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Api.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Vo.Api.Advertisement.SearchRecommends;
|
||||
|
||||
namespace ARW.Service.Api.IBusinessService.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐接口类Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public interface ISearchRecommendServiceApi : IBaseService<SearchRecommend>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取搜索推荐列表(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SearchRecommendVoApi>> GetSearchRecommendListApi(SearchRecommendQueryDtoApi parm);
|
||||
|
||||
/// <summary>
|
||||
/// 获取搜索推荐详情(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetSearchRecommendDetails(SearchRecommendDtoApi parm);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
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
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
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.IBusinessService.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐接口类
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
public interface ISearchRecommendService : IBaseService<SearchRecommend>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取搜索推荐分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<SearchRecommendVo>> GetSearchRecommendList(SearchRecommendQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改搜索推荐
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateSearchRecommend(SearchRecommend parm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Dto.Api.Advertisement.SearchRecommends;
|
||||
using ARW.Service.Api.IBusinessService.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Vo.Api.Advertisement.SearchRecommends;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Geocoding;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐控制器Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
//[Verify]
|
||||
[Route("api/[controller]")]
|
||||
public class SearchRecommendApiController : BaseController
|
||||
{
|
||||
private readonly ISearchRecommendServiceApi _SearchRecommendServiceApi;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="SearchRecommendServiceApi">搜索推荐搜索推荐Api服务</param>
|
||||
public SearchRecommendApiController(ISearchRecommendServiceApi SearchRecommendServiceApi)
|
||||
{
|
||||
_SearchRecommendServiceApi = SearchRecommendServiceApi;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取搜索推荐列表(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getSearchRecommendList")]
|
||||
public async Task<IActionResult> GetSearchRecommendListApi([FromQuery] SearchRecommendQueryDtoApi parm)
|
||||
{
|
||||
var res = await _SearchRecommendServiceApi.GetSearchRecommendListApi(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取SearchRecommend详情(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getSearchRecommendDetails")]
|
||||
public async Task<IActionResult> GetSearchRecommendDetails([FromQuery] SearchRecommendDtoApi parm)
|
||||
{
|
||||
//if (parm == null) throw new CustomException("参数错误!");
|
||||
|
||||
var res = await _SearchRecommendServiceApi.GetSearchRecommendDetails(parm);
|
||||
|
||||
if (res != "[]")
|
||||
{
|
||||
res = res.Remove(0, 1);
|
||||
res = res.Substring(0, res.Length - 1);
|
||||
var data = res.FromJSON<SearchRecommendApiDetailsVo>();
|
||||
return SUCCESS(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SUCCESS(res);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.Advertisement.SearchRecommends;
|
||||
using ARW.Service.Business.IBusinessService.Advertisement.SearchRecommends;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.Advertisement.SearchRecommends;
|
||||
using ARW.Model.Vo.Business.Advertisement.SearchRecommends;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.Advertisement.SearchRecommends
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索推荐控制器
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-25
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/[controller]")]
|
||||
public class SearchRecommendController : BaseController
|
||||
{
|
||||
private readonly ISearchRecommendService _SearchRecommendService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="SearchRecommendService">搜索推荐服务</param>
|
||||
public SearchRecommendController(ISearchRecommendService SearchRecommendService)
|
||||
{
|
||||
_SearchRecommendService = SearchRecommendService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取搜索推荐列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getSearchRecommendList")]
|
||||
[ActionPermissionFilter(Permission = "business:searchrecommend:list")]
|
||||
public async Task<IActionResult> GetSearchRecommendList([FromQuery] SearchRecommendQueryDto parm)
|
||||
{
|
||||
var res = await _SearchRecommendService.GetSearchRecommendList(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改搜索推荐
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateSearchRecommend")]
|
||||
[ActionPermissionFilter(Permission = "business:searchrecommend:addOrUpdate")]
|
||||
[Log(Title = "添加或修改搜索推荐", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddOrUpdateSearchRecommend([FromBody] SearchRecommendDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = new SearchRecommend();
|
||||
if (parm.SearchRecommendId != 0) modal = parm.Adapt<SearchRecommend>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<SearchRecommend>().ToCreate(HttpContext);
|
||||
|
||||
var res = await _SearchRecommendService.AddOrUpdateSearchRecommend(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除搜索推荐
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:searchrecommend:delete")]
|
||||
[Log(Title = "搜索推荐删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _SearchRecommendService.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user