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 { /// /// 关注记录 /// [Route("liveforum/tfollows")] public class T_FollowsController : BaseController { /// /// 关注记录接口 /// private readonly IT_FollowsService _T_FollowsService; public T_FollowsController(IT_FollowsService T_FollowsService) { _T_FollowsService = T_FollowsService; } /// /// 查询关注记录列表 /// /// /// [HttpGet("list")] [ActionPermissionFilter(Permission = "tfollows:list")] public IActionResult QueryT_Follows([FromQuery] T_FollowsQueryDto parm) { var response = _T_FollowsService.GetList(parm); return SUCCESS(response); } /// /// 查询关注记录详情 /// /// /// [HttpGet("{Id}")] [ActionPermissionFilter(Permission = "tfollows:query")] public IActionResult GetT_Follows(long Id) { var response = _T_FollowsService.GetInfo(Id); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加关注记录 /// /// [HttpPost] [ActionPermissionFilter(Permission = "tfollows:add")] [Log(Title = "关注记录", BusinessType = BusinessType.INSERT)] public IActionResult AddT_Follows([FromBody] T_FollowsDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _T_FollowsService.AddT_Follows(modal); return SUCCESS(response); } /// /// 更新关注记录 /// /// [HttpPut] [ActionPermissionFilter(Permission = "tfollows:edit")] [Log(Title = "关注记录", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateT_Follows([FromBody] T_FollowsDto parm) { if (parm.Id == 0) { throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空"); } var oldal = _T_FollowsService.GetById(parm.Id); if (oldal == null) { throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在"); } var modal = parm.Adapt(oldal); var response = _T_FollowsService.UpdateT_Follows(modal); return ToResponse(response); } /// /// 删除关注记录 /// /// [HttpPost("delete/{ids}")] [ActionPermissionFilter(Permission = "tfollows:delete")] [Log(Title = "关注记录", BusinessType = BusinessType.DELETE)] public IActionResult DeleteT_Follows([FromRoute]string ids) { var idArr = Tools.SplitAndConvert(ids); return ToResponse(_T_FollowsService.Delete(idArr)); } /// /// 导出关注记录 /// /// [Log(Title = "关注记录", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)] [HttpGet("export")] [ActionPermissionFilter(Permission = "tfollows:export")] public IActionResult Export([FromQuery] T_FollowsQueryDto parm) { var list = _T_FollowsService.ExportList(parm).Result; if (list == null || list.Count <= 0) { return ToResponse(ResultCode.FAIL, "没有要导出的数据"); } var result = ExportExcelMini(list, "关注记录", "关注记录"); return ExportExcel(result.Item2, result.Item1); } } }