|
@@ -8,6 +8,7 @@ using Hotline.Share.Dtos.Dic;
|
|
|
using Hotline.Share.Dtos.Menu;
|
|
|
using Hotline.Share.Dtos.Settings;
|
|
|
using Hotline.Share.Dtos.Trunk;
|
|
|
+using Hotline.Share.Enums.Settings;
|
|
|
using Hotline.Share.Requests;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
@@ -15,6 +16,7 @@ using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
+using XF.Utility.EnumExtensions;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
|
{
|
|
@@ -435,9 +437,9 @@ namespace Hotline.Api.Controllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("common-list")]
|
|
|
- public async Task<IReadOnlyList<SystemCommonOpinion>> GetCommon(string typecode)
|
|
|
+ public async Task<IReadOnlyList<SystemCommonOpinion>> GetCommon([FromQuery]ECommonType commonType)
|
|
|
{
|
|
|
- return await _commonOpinionDomainService.GetCommonOpinions(typecode);
|
|
|
+ return await _commonOpinionRepository.Queryable().Where(x => x.CommonType == commonType).ToListAsync();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -446,7 +448,7 @@ namespace Hotline.Api.Controllers
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("add-common")]
|
|
|
- public async Task AddCommon([FromBody] AddCommonDto dto)
|
|
|
+ public async Task AddCommon([FromBody]AddCommonDto dto)
|
|
|
{
|
|
|
var entity = _mapper.Map<SystemCommonOpinion>(dto);
|
|
|
await _commonOpinionDomainService.AddCommonOpinion(entity, HttpContext.RequestAborted);
|
|
@@ -458,11 +460,26 @@ namespace Hotline.Api.Controllers
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("del-common")]
|
|
|
- public async Task DelCommon([FromBody] DelCommonDto dto)
|
|
|
+ public async Task DelCommon([FromBody]DelCommonDto dto)
|
|
|
{
|
|
|
await _commonOpinionDomainService.DelCommonOpinion(dto.Ids, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 常用意见页面基础信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("common-basepage")]
|
|
|
+ public async Task<object> CommonBasePage()
|
|
|
+ {
|
|
|
+ var rsp = new
|
|
|
+ {
|
|
|
+ CommonType = EnumExts.GetDescriptions<ECommonType>()
|
|
|
+ };
|
|
|
+
|
|
|
+ return rsp;
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 公开
|
|
@@ -476,7 +493,7 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
var (total,items) = await _commonOpinionRepository.Queryable()
|
|
|
.Where(x => x.IsOpen)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.code), x => x.TypeCode.Contains(dto.code))
|
|
|
+ .WhereIF(dto.CommonType!=null, x => x.CommonType == dto.CommonType)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<SystemCommonOpinion>(total, items);
|
|
|
}
|