diff --git a/ZR.Admin.WebApi/Controllers/Liveforum/T_UserLevelsController.cs b/ZR.Admin.WebApi/Controllers/Liveforum/T_UserLevelsController.cs new file mode 100644 index 0000000..bc0cf52 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/Liveforum/T_UserLevelsController.cs @@ -0,0 +1,118 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.LiveForum.Model.Liveforum.Dto; +using ZR.LiveForum.Model.Liveforum; +using ZR.Service.Liveforum.ILiveforumService; + +//创建时间:2025-11-15 +namespace ZR.Admin.WebApi.Controllers.Liveforum +{ + /// + /// 等级配置 + /// + [Route("liveforum/tuserlevels")] + public class T_UserLevelsController : BaseController + { + /// + /// 等级配置接口 + /// + private readonly IT_UserLevelsService _T_UserLevelsService; + + public T_UserLevelsController(IT_UserLevelsService T_UserLevelsService) + { + _T_UserLevelsService = T_UserLevelsService; + } + + /// + /// 查询等级配置列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "tuserlevels:list")] + public IActionResult QueryT_UserLevels([FromQuery] T_UserLevelsQueryDto parm) + { + var response = _T_UserLevelsService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询等级配置详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "tuserlevels:query")] + public IActionResult GetT_UserLevels(int Id) + { + var response = _T_UserLevelsService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加等级配置 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "tuserlevels:add")] + [Log(Title = "等级配置", BusinessType = BusinessType.INSERT)] + public IActionResult AddT_UserLevels([FromBody] T_UserLevelsDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _T_UserLevelsService.AddT_UserLevels(modal); + + return SUCCESS(response); + } + + /// + /// 更新等级配置 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "tuserlevels:edit")] + [Log(Title = "等级配置", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateT_UserLevels([FromBody] T_UserLevelsDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _T_UserLevelsService.UpdateT_UserLevels(modal); + + return ToResponse(response); + } + + /// + /// 删除等级配置 + /// + /// + [HttpPost("delete/{ids}")] + [ActionPermissionFilter(Permission = "tuserlevels:delete")] + [Log(Title = "等级配置", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteT_UserLevels([FromRoute]string ids) + { + var idArr = Tools.SplitAndConvert(ids); + + return ToResponse(_T_UserLevelsService.Delete(idArr)); + } + + /// + /// 导出等级配置 + /// + /// + [Log(Title = "等级配置", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)] + [HttpGet("export")] + [ActionPermissionFilter(Permission = "tuserlevels:export")] + public IActionResult Export([FromQuery] T_UserLevelsQueryDto parm) + { + var list = _T_UserLevelsService.ExportList(parm).Result; + if (list == null || list.Count <= 0) + { + return ToResponse(ResultCode.FAIL, "没有要导出的数据"); + } + var result = ExportExcelMini(list, "等级配置", "等级配置"); + return ExportExcel(result.Item2, result.Item1); + } + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index aeb5047..5f30852 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -17,6 +17,7 @@ + diff --git a/ZR.LiveForum.Model/Class1.cs b/ZR.LiveForum.Model/Class1.cs new file mode 100644 index 0000000..1536afb --- /dev/null +++ b/ZR.LiveForum.Model/Class1.cs @@ -0,0 +1,7 @@ +namespace ZR.LiveForum.Model +{ + public class Class1 + { + + } +} diff --git a/ZR.LiveForum.Model/GlobalUsing.cs b/ZR.LiveForum.Model/GlobalUsing.cs new file mode 100644 index 0000000..6980dcc --- /dev/null +++ b/ZR.LiveForum.Model/GlobalUsing.cs @@ -0,0 +1,6 @@ +global using System.Collections.Generic; +global using System; +global using SqlSugar; +global using Newtonsoft.Json; +global using MiniExcelLibs.Attributes; +global using System.ComponentModel.DataAnnotations; \ No newline at end of file diff --git a/ZR.LiveForum.Model/Liveforum/Dto/T_UserLevelsDto.cs b/ZR.LiveForum.Model/Liveforum/Dto/T_UserLevelsDto.cs new file mode 100644 index 0000000..4a08d5d --- /dev/null +++ b/ZR.LiveForum.Model/Liveforum/Dto/T_UserLevelsDto.cs @@ -0,0 +1,67 @@ + +using ZR.Model; + +namespace ZR.LiveForum.Model.Liveforum.Dto +{ + /// + /// 等级配置查询对象 + /// + public class T_UserLevelsQueryDto : PagerInfo + { + public string? LevelName { get; set; } + } + + /// + /// 等级配置输入输出对象 + /// + public class T_UserLevelsDto + { + [Required(ErrorMessage = "id不能为空")] + [ExcelColumn(Name = "id")] + [ExcelColumnName("id")] + public int Id { get; set; } + + [Required(ErrorMessage = "名称不能为空")] + [ExcelColumn(Name = "名称")] + [ExcelColumnName("名称")] + public string LevelName { get; set; } + + [ExcelColumn(Name = "等级图标")] + [ExcelColumnName("等级图标")] + public string LevelIcon { get; set; } + + [ExcelColumn(Name = "显示颜色")] + [ExcelColumnName("显示颜色")] + public string LevelColor { get; set; } + + [ExcelColumn(Name = "最小经验值")] + [ExcelColumnName("最小经验值")] + public int? MinExperience { get; set; } + + [ExcelColumn(Name = "最大经验值")] + [ExcelColumnName("最大经验值")] + public int? MaxExperience { get; set; } + + [ExcelColumn(Name = "特权配置")] + [ExcelColumnName("特权配置")] + public string Privileges { get; set; } + + [Required(ErrorMessage = "状态不能为空")] + [ExcelColumn(Name = "状态")] + [ExcelColumnName("状态")] + public bool IsActive { get; set; } + + [ExcelColumn(Name = "创建时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)] + [ExcelColumnName("创建时间")] + public DateTime? CreatedAt { get; set; } + + [ExcelColumn(Name = "更新时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)] + [ExcelColumnName("更新时间")] + 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_UserLevels.cs b/ZR.LiveForum.Model/Liveforum/T_UserLevels.cs new file mode 100644 index 0000000..e728a16 --- /dev/null +++ b/ZR.LiveForum.Model/Liveforum/T_UserLevels.cs @@ -0,0 +1,63 @@ + +namespace ZR.LiveForum.Model.Liveforum +{ + /// + /// 等级配置 + /// + [SugarTable("T_UserLevels")] + [Tenant("2")] + public class T_UserLevels + { + /// + /// id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 名称 + /// + public string LevelName { get; set; } + + /// + /// 等级图标 + /// + public string LevelIcon { get; set; } + + /// + /// 显示颜色 + /// + public string LevelColor { get; set; } + + /// + /// 最小经验值 + /// + public int? MinExperience { get; set; } + + /// + /// 最大经验值 + /// + public int? MaxExperience { get; set; } + + /// + /// 特权配置 + /// + public string Privileges { get; set; } + + /// + /// 状态 + /// + public bool IsActive { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreatedAt { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdatedAt { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.LiveForum.Model/ZR.LiveForum.Model.csproj b/ZR.LiveForum.Model/ZR.LiveForum.Model.csproj new file mode 100644 index 0000000..42357bf --- /dev/null +++ b/ZR.LiveForum.Model/ZR.LiveForum.Model.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/ZR.LiveForum/ZR.LiveForum.csproj b/ZR.LiveForum/ZR.LiveForum.csproj index ebf7e2a..fc30850 100644 --- a/ZR.LiveForum/ZR.LiveForum.csproj +++ b/ZR.LiveForum/ZR.LiveForum.csproj @@ -9,9 +9,4 @@ - - - - - diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj index 2f5619f..88444ff 100644 --- a/ZR.Repository/ZR.Repository.csproj +++ b/ZR.Repository/ZR.Repository.csproj @@ -6,6 +6,7 @@ + diff --git a/ZR.Service/Liveforum/ILiveforumService/IT_UserLevelsService.cs b/ZR.Service/Liveforum/ILiveforumService/IT_UserLevelsService.cs new file mode 100644 index 0000000..067a294 --- /dev/null +++ b/ZR.Service/Liveforum/ILiveforumService/IT_UserLevelsService.cs @@ -0,0 +1,22 @@ +using ZR.LiveForum.Model.Liveforum.Dto; +using ZR.LiveForum.Model.Liveforum; + +namespace ZR.Service.Liveforum.ILiveforumService +{ + /// + /// 等级配置service接口 + /// + public interface IT_UserLevelsService : IBaseService + { + PagedInfo GetList(T_UserLevelsQueryDto parm); + + T_UserLevels GetInfo(int Id); + + + T_UserLevels AddT_UserLevels(T_UserLevels parm); + int UpdateT_UserLevels(T_UserLevels parm); + + + PagedInfo ExportList(T_UserLevelsQueryDto parm); + } +} diff --git a/ZR.Service/Liveforum/T_UserLevelsService.cs b/ZR.Service/Liveforum/T_UserLevelsService.cs new file mode 100644 index 0000000..49b2071 --- /dev/null +++ b/ZR.Service/Liveforum/T_UserLevelsService.cs @@ -0,0 +1,103 @@ +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_UserLevelsService), ServiceLifetime = LifeTime.Transient)] + public class T_UserLevelsService : BaseService, IT_UserLevelsService + { + /// + /// 查询等级配置列表 + /// + /// + /// + public PagedInfo GetList(T_UserLevelsQueryDto parm) + { + var predicate = QueryExp(parm); + + var response = Queryable() + //.OrderBy("Id asc") + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public T_UserLevels GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加等级配置 + /// + /// + /// + public T_UserLevels AddT_UserLevels(T_UserLevels model) + { + return Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改等级配置 + /// + /// + /// + public int UpdateT_UserLevels(T_UserLevels model) + { + return Update(model, true); + } + + /// + /// 导出等级配置 + /// + /// + /// + public PagedInfo ExportList(T_UserLevelsQueryDto parm) + { + parm.PageNum = 1; + parm.PageSize = 100000; + var predicate = QueryExp(parm); + + var response = Queryable() + .Where(predicate.ToExpression()) + .Select((it) => new T_UserLevelsDto() + { + IsActiveLabel = it.IsActive.GetConfigValue("sys_common_status"), + }, true) + .ToPage(parm); + + return response; + } + + /// + /// 查询导出表达式 + /// + /// + /// + private static Expressionable QueryExp(T_UserLevelsQueryDto parm) + { + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.LevelName), it => it.LevelName.Contains(parm.LevelName)); + return predicate; + } + } +} \ No newline at end of file diff --git a/ZR.ServiceCore/ZR.ServiceCore.csproj b/ZR.ServiceCore/ZR.ServiceCore.csproj index 3e60cad..9273d46 100644 --- a/ZR.ServiceCore/ZR.ServiceCore.csproj +++ b/ZR.ServiceCore/ZR.ServiceCore.csproj @@ -10,6 +10,7 @@ + diff --git a/ZR.Tasks/ZR.Tasks.csproj b/ZR.Tasks/ZR.Tasks.csproj index e72fb20..18c7784 100644 --- a/ZR.Tasks/ZR.Tasks.csproj +++ b/ZR.Tasks/ZR.Tasks.csproj @@ -13,6 +13,7 @@ + diff --git a/ZR.Vue/src/api/liveforum/tuserlevels.js b/ZR.Vue/src/api/liveforum/tuserlevels.js new file mode 100644 index 0000000..988a441 --- /dev/null +++ b/ZR.Vue/src/api/liveforum/tuserlevels.js @@ -0,0 +1,62 @@ +import request from '@/utils/request' +import { downFile } from '@/utils/request' + +/** + * 等级配置分页查询 + * @param {查询条件} data + */ +export function listtuserlevels(query) { + return request({ + url: 'liveforum/tuserlevels/list', + method: 'get', + params: query, + }) +} + +/** + * 新增等级配置 + * @param data + */ +export function addtuserlevels(data) { + return request({ + url: 'liveforum/tuserlevels', + method: 'post', + data: data, + }) +} +/** + * 修改等级配置 + * @param data + */ +export function updatetuserlevels(data) { + return request({ + url: 'liveforum/tuserlevels', + method: 'PUT', + data: data, + }) +} +/** + * 获取等级配置详情 + * @param {Id} + */ +export function gettuserlevels(id) { + return request({ + url: 'liveforum/tuserlevels/' + id, + method: 'get' + }) +} + +/** + * 删除等级配置 + * @param {主键} pid + */ +export function deltuserlevels(pid) { + return request({ + url: 'liveforum/tuserlevels/delete/' + pid, + method: 'POST' + }) +} +// 导出等级配置 +export async function exporttuserlevels(query) { + await downFile('liveforum/tuserlevels/export', { ...query }) +} diff --git a/ZR.Vue/src/views/liveforum/tuserlevels.vue b/ZR.Vue/src/views/liveforum/tuserlevels.vue new file mode 100644 index 0000000..6e65972 --- /dev/null +++ b/ZR.Vue/src/views/liveforum/tuserlevels.vue @@ -0,0 +1,354 @@ + + + + \ No newline at end of file diff --git a/ZRAdmin.sln b/ZRAdmin.sln index 5af2645..81cf3b6 100644 --- a/ZRAdmin.sln +++ b/ZRAdmin.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 18 -VisualStudioVersion = 18.3.11206.111 d18.3 +VisualStudioVersion = 18.3.11206.111 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZR.Admin.WebApi", "ZR.Admin.WebApi\ZR.Admin.WebApi.csproj", "{E5497BB4-B0C1-4794-9FAE-163F626EC399}" EndProject @@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZR.Mall", "ZR.Mall\ZR.Mall. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZR.LiveForum", "ZR.LiveForum\ZR.LiveForum.csproj", "{B466E6BC-BB8E-4149-A7DD-3D11C5038007}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZR.LiveForum.Model", "ZR.LiveForum.Model\ZR.LiveForum.Model.csproj", "{ED637CF7-FCCB-4996-B660-C78A00BAA8F4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -75,6 +77,10 @@ Global {B466E6BC-BB8E-4149-A7DD-3D11C5038007}.Debug|Any CPU.Build.0 = Debug|Any CPU {B466E6BC-BB8E-4149-A7DD-3D11C5038007}.Release|Any CPU.ActiveCfg = Release|Any CPU {B466E6BC-BB8E-4149-A7DD-3D11C5038007}.Release|Any CPU.Build.0 = Release|Any CPU + {ED637CF7-FCCB-4996-B660-C78A00BAA8F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED637CF7-FCCB-4996-B660-C78A00BAA8F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED637CF7-FCCB-4996-B660-C78A00BAA8F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED637CF7-FCCB-4996-B660-C78A00BAA8F4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE