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/tsystemnotifications")]
public class T_SystemNotificationsController : BaseController
{
///
/// 系统公告接口
///
private readonly IT_SystemNotificationsService _T_SystemNotificationsService;
public T_SystemNotificationsController(IT_SystemNotificationsService T_SystemNotificationsService)
{
_T_SystemNotificationsService = T_SystemNotificationsService;
}
///
/// 查询系统公告列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "tsystemnotifications:list")]
public IActionResult QueryT_SystemNotifications([FromQuery] T_SystemNotificationsQueryDto parm)
{
var response = _T_SystemNotificationsService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询系统公告详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "tsystemnotifications:query")]
public IActionResult GetT_SystemNotifications(long Id)
{
var response = _T_SystemNotificationsService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加系统公告
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "tsystemnotifications:add")]
[Log(Title = "系统公告", BusinessType = BusinessType.INSERT)]
public IActionResult AddT_SystemNotifications([FromBody] T_SystemNotificationsDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _T_SystemNotificationsService.AddT_SystemNotifications(modal);
return SUCCESS(response);
}
///
/// 更新系统公告
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "tsystemnotifications:edit")]
[Log(Title = "系统公告", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateT_SystemNotifications([FromBody] T_SystemNotificationsDto parm)
{
if (parm.Id == 0)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
}
var oldal = _T_SystemNotificationsService.GetById(parm.Id);
if (oldal == null)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在");
}
var modal = parm.Adapt(oldal);
var response = _T_SystemNotificationsService.UpdateT_SystemNotifications(modal);
return ToResponse(response);
}
///
/// 删除系统公告
///
///
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "tsystemnotifications:delete")]
[Log(Title = "系统公告", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteT_SystemNotifications([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert(ids);
return ToResponse(_T_SystemNotificationsService.Delete(idArr));
}
}
}