110 lines
3.8 KiB
C#
110 lines
3.8 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/tsystemnotifications")]
|
||
public class T_SystemNotificationsController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 系统公告接口
|
||
/// </summary>
|
||
private readonly IT_SystemNotificationsService _T_SystemNotificationsService;
|
||
|
||
public T_SystemNotificationsController(IT_SystemNotificationsService T_SystemNotificationsService)
|
||
{
|
||
_T_SystemNotificationsService = T_SystemNotificationsService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询系统公告列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "tsystemnotifications:list")]
|
||
public IActionResult QueryT_SystemNotifications([FromQuery] T_SystemNotificationsQueryDto parm)
|
||
{
|
||
var response = _T_SystemNotificationsService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询系统公告详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "tsystemnotifications:query")]
|
||
public IActionResult GetT_SystemNotifications(long Id)
|
||
{
|
||
var response = _T_SystemNotificationsService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<T_SystemNotificationsDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加系统公告
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "tsystemnotifications:add")]
|
||
[Log(Title = "系统公告", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddT_SystemNotifications([FromBody] T_SystemNotificationsDto parm)
|
||
{
|
||
var modal = parm.Adapt<T_SystemNotifications>().ToCreate(HttpContext);
|
||
|
||
var response = _T_SystemNotificationsService.AddT_SystemNotifications(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新系统公告
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[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);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除系统公告
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "tsystemnotifications:delete")]
|
||
[Log(Title = "系统公告", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteT_SystemNotifications([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<long>(ids);
|
||
|
||
return ToResponse(_T_SystemNotificationsService.Delete(idArr));
|
||
}
|
||
|
||
}
|
||
} |