128 lines
4.2 KiB
C#
128 lines
4.2 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.LiveForum.Model.Liveforum.Dto;
|
||
using ZR.LiveForum.Model.Liveforum;
|
||
using ZR.Service.Liveforum.ILiveforumService;
|
||
|
||
//创建时间:2025-11-17
|
||
namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||
{
|
||
/// <summary>
|
||
/// 反馈记录
|
||
/// </summary>
|
||
[Route("liveforum/tfeedbacks")]
|
||
public class T_FeedbacksController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 反馈记录接口
|
||
/// </summary>
|
||
private readonly IT_FeedbacksService _T_FeedbacksService;
|
||
|
||
public T_FeedbacksController(IT_FeedbacksService T_FeedbacksService)
|
||
{
|
||
_T_FeedbacksService = T_FeedbacksService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询反馈记录列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "tfeedbacks:list")]
|
||
public IActionResult QueryT_Feedbacks([FromQuery] T_FeedbacksQueryDto parm)
|
||
{
|
||
var response = _T_FeedbacksService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询反馈记录详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "tfeedbacks:query")]
|
||
public IActionResult GetT_Feedbacks(long Id)
|
||
{
|
||
var response = _T_FeedbacksService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<T_FeedbacksDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加反馈记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "tfeedbacks:add")]
|
||
[Log(Title = "反馈记录", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddT_Feedbacks([FromBody] T_FeedbacksDto parm)
|
||
{
|
||
var modal = parm.Adapt<T_Feedbacks>().ToCreate(HttpContext);
|
||
|
||
var response = _T_FeedbacksService.AddT_Feedbacks(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新反馈记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "tfeedbacks:edit")]
|
||
[Log(Title = "反馈记录", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateT_Feedbacks([FromBody] T_FeedbacksDto parm)
|
||
{
|
||
|
||
if (parm.Id == 0)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||
}
|
||
var oldal = _T_FeedbacksService.GetById(parm.Id);
|
||
if (oldal == null)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在");
|
||
}
|
||
var modal = parm.Adapt(oldal);
|
||
var response = _T_FeedbacksService.UpdateT_Feedbacks(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除反馈记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "tfeedbacks:delete")]
|
||
[Log(Title = "反馈记录", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteT_Feedbacks([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<long>(ids);
|
||
|
||
return ToResponse(_T_FeedbacksService.Delete(idArr));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 导出反馈记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Log(Title = "反馈记录", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||
[HttpGet("export")]
|
||
[ActionPermissionFilter(Permission = "tfeedbacks:export")]
|
||
public IActionResult Export([FromQuery] T_FeedbacksQueryDto parm)
|
||
{
|
||
var list = _T_FeedbacksService.ExportList(parm).Result;
|
||
if (list == null || list.Count <= 0)
|
||
{
|
||
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
||
}
|
||
var result = ExportExcelMini(list, "反馈记录", "反馈记录");
|
||
return ExportExcel(result.Item2, result.Item1);
|
||
}
|
||
|
||
}
|
||
} |