94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.LiveForum.Model.Liveforum.Dto;
|
||
using ZR.LiveForum.Model.Liveforum;
|
||
using ZR.Service.Liveforum.ILiveforumService;
|
||
|
||
//创建时间:2025-11-16
|
||
namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||
{
|
||
/// <summary>
|
||
/// 帖子评论记录
|
||
/// </summary>
|
||
[Route("liveforum/tcomments")]
|
||
public class T_CommentsController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 帖子评论记录接口
|
||
/// </summary>
|
||
private readonly IT_CommentsService _T_CommentsService;
|
||
|
||
public T_CommentsController(IT_CommentsService T_CommentsService)
|
||
{
|
||
_T_CommentsService = T_CommentsService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询帖子评论记录列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "tcomments:list")]
|
||
public IActionResult QueryT_Comments([FromQuery] T_CommentsQueryDto parm)
|
||
{
|
||
var response = _T_CommentsService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询帖子评论记录详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "tcomments:query")]
|
||
public IActionResult GetT_Comments(long Id)
|
||
{
|
||
var response = _T_CommentsService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<T_CommentsDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新帖子评论记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "tcomments:edit")]
|
||
[Log(Title = "帖子评论记录", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateT_Comments([FromBody] T_CommentsDto parm)
|
||
{
|
||
|
||
if (parm.Id == 0)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||
}
|
||
var oldal = _T_CommentsService.GetById(parm.Id);
|
||
if (oldal == null)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在");
|
||
}
|
||
var modal = parm.Adapt(oldal);
|
||
var response = _T_CommentsService.UpdateT_Comments(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除帖子评论记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "tcomments:delete")]
|
||
[Log(Title = "帖子评论记录", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteT_Comments([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<long>(ids);
|
||
|
||
return ToResponse(_T_CommentsService.Delete(idArr));
|
||
}
|
||
|
||
}
|
||
} |