From b98ae8fbe3fa44b922a11863d91f6444df73b3fd Mon Sep 17 00:00:00 2001 From: zpc Date: Mon, 17 Nov 2025 22:33:12 +0800 Subject: [PATCH] =?UTF-8?q?v0.0.8=E7=B3=BB=E7=BB=9F=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Liveforum/T_FeedbacksController.cs | 2 +- .../T_SystemNotificationsController.cs | 110 ++++++ .../Liveforum/Dto/T_FeedbacksDto.cs | 1 + .../Liveforum/Dto/T_SystemNotificationsDto.cs | 42 +++ .../Liveforum/T_SystemNotifications.cs | 53 +++ .../IT_SystemNotificationsService.cs | 21 ++ ZR.Service/Liveforum/T_FeedbacksService.cs | 1 + .../Liveforum/T_SystemNotificationsService.cs | 81 +++++ .../src/api/liveforum/tsystemnotifications.js | 57 +++ ZR.Vue/src/views/liveforum/tfeedbacks.vue | 6 +- .../views/liveforum/tsystemnotifications.vue | 327 ++++++++++++++++++ sql/tsystemnotifications.sql | 24 ++ 12 files changed, 723 insertions(+), 2 deletions(-) create mode 100644 ZR.Admin.WebApi/Controllers/Liveforum/T_SystemNotificationsController.cs create mode 100644 ZR.LiveForum.Model/Liveforum/Dto/T_SystemNotificationsDto.cs create mode 100644 ZR.LiveForum.Model/Liveforum/T_SystemNotifications.cs create mode 100644 ZR.Service/Liveforum/ILiveforumService/IT_SystemNotificationsService.cs create mode 100644 ZR.Service/Liveforum/T_SystemNotificationsService.cs create mode 100644 ZR.Vue/src/api/liveforum/tsystemnotifications.js create mode 100644 ZR.Vue/src/views/liveforum/tsystemnotifications.vue create mode 100644 sql/tsystemnotifications.sql diff --git a/ZR.Admin.WebApi/Controllers/Liveforum/T_FeedbacksController.cs b/ZR.Admin.WebApi/Controllers/Liveforum/T_FeedbacksController.cs index d212ffb..945f3c4 100644 --- a/ZR.Admin.WebApi/Controllers/Liveforum/T_FeedbacksController.cs +++ b/ZR.Admin.WebApi/Controllers/Liveforum/T_FeedbacksController.cs @@ -3,7 +3,7 @@ using ZR.LiveForum.Model.Liveforum.Dto; using ZR.LiveForum.Model.Liveforum; using ZR.Service.Liveforum.ILiveforumService; -//创建时间:2025-11-16 +//创建时间:2025-11-17 namespace ZR.Admin.WebApi.Controllers.Liveforum { /// diff --git a/ZR.Admin.WebApi/Controllers/Liveforum/T_SystemNotificationsController.cs b/ZR.Admin.WebApi/Controllers/Liveforum/T_SystemNotificationsController.cs new file mode 100644 index 0000000..a6e2dae --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/Liveforum/T_SystemNotificationsController.cs @@ -0,0 +1,110 @@ +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)); + } + + } +} \ No newline at end of file diff --git a/ZR.LiveForum.Model/Liveforum/Dto/T_FeedbacksDto.cs b/ZR.LiveForum.Model/Liveforum/Dto/T_FeedbacksDto.cs index 4849326..4208f90 100644 --- a/ZR.LiveForum.Model/Liveforum/Dto/T_FeedbacksDto.cs +++ b/ZR.LiveForum.Model/Liveforum/Dto/T_FeedbacksDto.cs @@ -6,6 +6,7 @@ namespace ZR.LiveForum.Model.Liveforum.Dto /// public class T_FeedbacksQueryDto : PagerInfo { + public long ? UserId { get; set; } } /// diff --git a/ZR.LiveForum.Model/Liveforum/Dto/T_SystemNotificationsDto.cs b/ZR.LiveForum.Model/Liveforum/Dto/T_SystemNotificationsDto.cs new file mode 100644 index 0000000..ea6476f --- /dev/null +++ b/ZR.LiveForum.Model/Liveforum/Dto/T_SystemNotificationsDto.cs @@ -0,0 +1,42 @@ + +namespace ZR.LiveForum.Model.Liveforum.Dto +{ + /// + /// 系统公告查询对象 + /// + public class T_SystemNotificationsQueryDto : PagerInfo + { + public string ? Title { get; set; } + } + + /// + /// 系统公告输入输出对象 + /// + public class T_SystemNotificationsDto + { + [Required(ErrorMessage = "通知ID不能为空")] + public long Id { get; set; } + + [Required(ErrorMessage = "标题不能为空")] + public string Title { get; set; } + + [Required(ErrorMessage = "正文内容不能为空")] + public string Content { get; set; } + + [Required(ErrorMessage = "是否启用该通知不能为空")] + public bool IsActive { get; set; } + + public DateTime ? PublishTime { get; set; } + + public DateTime ? ExpireTime { get; set; } + + public DateTime ? CreatedAt { get; set; } + + public DateTime ? UpdatedAt { get; set; } + + + + [ExcelColumn(Name = "是否启用该通知")] + public string? IsActiveLabel { get; set; } + } +} \ No newline at end of file diff --git a/ZR.LiveForum.Model/Liveforum/T_SystemNotifications.cs b/ZR.LiveForum.Model/Liveforum/T_SystemNotifications.cs new file mode 100644 index 0000000..ac8cf52 --- /dev/null +++ b/ZR.LiveForum.Model/Liveforum/T_SystemNotifications.cs @@ -0,0 +1,53 @@ + +namespace ZR.LiveForum.Model.Liveforum +{ + /// + /// 系统公告 + /// + [SugarTable("T_SystemNotifications")] + [Tenant("liveforum")] + public class T_SystemNotifications + { + /// + /// 通知ID + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public long Id { get; set; } + + /// + /// 标题 + /// + public string Title { get; set; } + + /// + /// 正文内容 + /// + public string Content { get; set; } + + /// + /// 是否启用该通知 + /// + public bool IsActive { get; set; } + + /// + /// 发布时间 + /// + public DateTime? PublishTime { get; set; } + + /// + /// 过期时间 + /// + public DateTime? ExpireTime { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreatedAt { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdatedAt { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Service/Liveforum/ILiveforumService/IT_SystemNotificationsService.cs b/ZR.Service/Liveforum/ILiveforumService/IT_SystemNotificationsService.cs new file mode 100644 index 0000000..91e94eb --- /dev/null +++ b/ZR.Service/Liveforum/ILiveforumService/IT_SystemNotificationsService.cs @@ -0,0 +1,21 @@ +using ZR.LiveForum.Model.Liveforum.Dto; +using ZR.LiveForum.Model.Liveforum; + +namespace ZR.Service.Liveforum.ILiveforumService +{ + /// + /// 系统公告service接口 + /// + public interface IT_SystemNotificationsService : IBaseService + { + PagedInfo GetList(T_SystemNotificationsQueryDto parm); + + T_SystemNotifications GetInfo(long Id); + + + T_SystemNotifications AddT_SystemNotifications(T_SystemNotifications parm); + int UpdateT_SystemNotifications(T_SystemNotifications parm); + + + } +} diff --git a/ZR.Service/Liveforum/T_FeedbacksService.cs b/ZR.Service/Liveforum/T_FeedbacksService.cs index ca00f7c..9413fa4 100644 --- a/ZR.Service/Liveforum/T_FeedbacksService.cs +++ b/ZR.Service/Liveforum/T_FeedbacksService.cs @@ -97,6 +97,7 @@ namespace ZR.Service.Liveforum { var predicate = Expressionable.Create(); + predicate = predicate.AndIF(parm.UserId != null, it => it.UserId == parm.UserId); return predicate; } } diff --git a/ZR.Service/Liveforum/T_SystemNotificationsService.cs b/ZR.Service/Liveforum/T_SystemNotificationsService.cs new file mode 100644 index 0000000..a194e0a --- /dev/null +++ b/ZR.Service/Liveforum/T_SystemNotificationsService.cs @@ -0,0 +1,81 @@ +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.LiveForum.Model.Liveforum.Dto; +using ZR.LiveForum.Model.Liveforum; +using ZR.Repository; +using ZR.Service.Liveforum.ILiveforumService; + +namespace ZR.Service.Liveforum +{ + /// + /// 系统公告Service业务层处理 + /// + [AppService(ServiceType = typeof(IT_SystemNotificationsService), ServiceLifetime = LifeTime.Transient)] + public class T_SystemNotificationsService : BaseService, IT_SystemNotificationsService + { + /// + /// 查询系统公告列表 + /// + /// + /// + public PagedInfo GetList(T_SystemNotificationsQueryDto parm) + { + var predicate = QueryExp(parm); + + var response = Queryable() + //.OrderBy("Id desc") + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public T_SystemNotifications GetInfo(long Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加系统公告 + /// + /// + /// + public T_SystemNotifications AddT_SystemNotifications(T_SystemNotifications model) + { + return Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改系统公告 + /// + /// + /// + public int UpdateT_SystemNotifications(T_SystemNotifications model) + { + return Update(model, true); + } + + /// + /// 查询导出表达式 + /// + /// + /// + private static Expressionable QueryExp(T_SystemNotificationsQueryDto parm) + { + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), it => it.Title.Contains(parm.Title)); + return predicate; + } + } +} \ No newline at end of file diff --git a/ZR.Vue/src/api/liveforum/tsystemnotifications.js b/ZR.Vue/src/api/liveforum/tsystemnotifications.js new file mode 100644 index 0000000..f423721 --- /dev/null +++ b/ZR.Vue/src/api/liveforum/tsystemnotifications.js @@ -0,0 +1,57 @@ +import request from '@/utils/request' + +/** + * 系统公告分页查询 + * @param {查询条件} data + */ +export function listtsystemnotifications(query) { + return request({ + url: 'liveforum/tsystemnotifications/list', + method: 'get', + params: query, + }) +} + +/** + * 新增系统公告 + * @param data + */ +export function addtsystemnotifications(data) { + return request({ + url: 'liveforum/tsystemnotifications', + method: 'post', + data: data, + }) +} +/** + * 修改系统公告 + * @param data + */ +export function updatetsystemnotifications(data) { + return request({ + url: 'liveforum/tsystemnotifications', + method: 'PUT', + data: data, + }) +} +/** + * 获取系统公告详情 + * @param {Id} + */ +export function gettsystemnotifications(id) { + return request({ + url: 'liveforum/tsystemnotifications/' + id, + method: 'get' + }) +} + +/** + * 删除系统公告 + * @param {主键} pid + */ +export function deltsystemnotifications(pid) { + return request({ + url: 'liveforum/tsystemnotifications/delete/' + pid, + method: 'POST' + }) +} diff --git a/ZR.Vue/src/views/liveforum/tfeedbacks.vue b/ZR.Vue/src/views/liveforum/tfeedbacks.vue index 03e078d..9b872b4 100644 --- a/ZR.Vue/src/views/liveforum/tfeedbacks.vue +++ b/ZR.Vue/src/views/liveforum/tfeedbacks.vue @@ -1,11 +1,14 @@