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
{
///
/// 反馈记录
///
[Route("liveforum/tfeedbacks")]
public class T_FeedbacksController : BaseController
{
///
/// 反馈记录接口
///
private readonly IT_FeedbacksService _T_FeedbacksService;
public T_FeedbacksController(IT_FeedbacksService T_FeedbacksService)
{
_T_FeedbacksService = T_FeedbacksService;
}
///
/// 查询反馈记录列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "tfeedbacks:list")]
public IActionResult QueryT_Feedbacks([FromQuery] T_FeedbacksQueryDto parm)
{
var response = _T_FeedbacksService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询反馈记录详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "tfeedbacks:query")]
public IActionResult GetT_Feedbacks(long Id)
{
var response = _T_FeedbacksService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加反馈记录
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "tfeedbacks:add")]
[Log(Title = "反馈记录", BusinessType = BusinessType.INSERT)]
public IActionResult AddT_Feedbacks([FromBody] T_FeedbacksDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _T_FeedbacksService.AddT_Feedbacks(modal);
return SUCCESS(response);
}
///
/// 更新反馈记录
///
///
[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);
}
///
/// 删除反馈记录
///
///
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "tfeedbacks:delete")]
[Log(Title = "反馈记录", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteT_Feedbacks([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert(ids);
return ToResponse(_T_FeedbacksService.Delete(idArr));
}
///
/// 导出反馈记录
///
///
[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);
}
}
}