diff --git a/ZR.Admin.WebApi/Controllers/System/EmailTplController.cs b/ZR.Admin.WebApi/Controllers/System/EmailTplController.cs
new file mode 100644
index 0000000..2b3f2b1
--- /dev/null
+++ b/ZR.Admin.WebApi/Controllers/System/EmailTplController.cs
@@ -0,0 +1,103 @@
+using Microsoft.AspNetCore.Mvc;
+using ZR.Admin.WebApi.Filters;
+using ZR.Model.Dto;
+using ZR.Service.System.ISystemService;
+using ZR.ServiceCore.Model;
+
+//创建时间:2023-11-12
+namespace ZR.Admin.WebApi.Controllers
+{
+ ///
+ /// 邮件模板
+ ///
+ [Verify]
+ [Route("system/EmailTpl")]
+ public class EmailTplController : BaseController
+ {
+ ///
+ /// 邮件模板接口
+ ///
+ private readonly IEmailTplService _EmailTplService;
+
+ public EmailTplController(IEmailTplService EmailTplService)
+ {
+ _EmailTplService = EmailTplService;
+ }
+
+ ///
+ /// 查询邮件模板列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "tool:emailtpl:list")]
+ public IActionResult QueryEmailTpl([FromQuery] EmailTplQueryDto parm)
+ {
+ var response = _EmailTplService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询邮件模板详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ public IActionResult GetEmailTpl(int Id)
+ {
+ var response = _EmailTplService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加邮件模板
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "tool:emailtpl:add")]
+ [Log(Title = "邮件模板", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddEmailTpl([FromBody] EmailTplDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _EmailTplService.AddEmailTpl(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新邮件模板
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "tool:emailtpl:edit")]
+ [Log(Title = "邮件模板", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateEmailTpl([FromBody] EmailTplDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _EmailTplService.UpdateEmailTpl(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除邮件模板
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [ActionPermissionFilter(Permission = "tool:emailtpl:delete")]
+ [Log(Title = "邮件模板", BusinessType = BusinessType.DELETE)]
+ public IActionResult DeleteEmailTpl(string ids)
+ {
+ int[] idsArr = Tools.SpitIntArrary(ids);
+ if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
+
+ var response = _EmailTplService.Delete(idsArr);
+
+ return ToResponse(response);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/wwwroot/data.xlsx b/ZR.Admin.WebApi/wwwroot/data.xlsx
index 002ef39..6c84d58 100644
Binary files a/ZR.Admin.WebApi/wwwroot/data.xlsx and b/ZR.Admin.WebApi/wwwroot/data.xlsx differ
diff --git a/ZR.ServiceCore/Model/Dto/EmailTplDto.cs b/ZR.ServiceCore/Model/Dto/EmailTplDto.cs
new file mode 100644
index 0000000..e574ff3
--- /dev/null
+++ b/ZR.ServiceCore/Model/Dto/EmailTplDto.cs
@@ -0,0 +1,39 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace ZR.Model.Dto
+{
+ ///
+ /// 邮件模板查询对象
+ ///
+ public class EmailTplQueryDto : PagerInfo
+ {
+ public string Name { get; set; }
+ }
+
+ ///
+ /// 邮件模板输入输出对象
+ ///
+ public class EmailTplDto
+ {
+ public int? Id { get; set; }
+
+ [Required(ErrorMessage = "Name不能为空")]
+ public string Name { get; set; }
+
+ [Required(ErrorMessage = "模板内容不能为空")]
+ public string Content { get; set; }
+
+ public string CreateBy { get; set; }
+
+ public DateTime? CreateTime { get; set; }
+
+ public string UpdateBy { get; set; }
+
+ public DateTime? UpdateTime { get; set; }
+
+ public string Remark { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/ZR.ServiceCore/Model/EmailTpl.cs b/ZR.ServiceCore/Model/EmailTpl.cs
new file mode 100644
index 0000000..aa0f3c9
--- /dev/null
+++ b/ZR.ServiceCore/Model/EmailTpl.cs
@@ -0,0 +1,17 @@
+using ZR.Model.System;
+
+namespace ZR.ServiceCore.Model
+{
+ ///
+ /// 邮件发送模板
+ ///
+ [SugarTable("emailTpl")]
+ public class EmailTpl : SysBase
+ {
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+ public string Name { get; set; }
+ [SugarColumn(ColumnDescription = "模板内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
+ public string Content { get; set; }
+ }
+}
diff --git a/ZR.ServiceCore/Model/SysBase.cs b/ZR.ServiceCore/Model/SysBase.cs
index b46ce8e..3c07885 100644
--- a/ZR.ServiceCore/Model/SysBase.cs
+++ b/ZR.ServiceCore/Model/SysBase.cs
@@ -1,7 +1,4 @@
using MiniExcelLibs.Attributes;
-using Newtonsoft.Json;
-using SqlSugar;
-using System;
namespace ZR.Model.System
{
diff --git a/ZR.ServiceCore/Services/EmailTplService.cs b/ZR.ServiceCore/Services/EmailTplService.cs
new file mode 100644
index 0000000..4619921
--- /dev/null
+++ b/ZR.ServiceCore/Services/EmailTplService.cs
@@ -0,0 +1,70 @@
+using Infrastructure.Attribute;
+using ZR.Model;
+using ZR.Model.Dto;
+using ZR.Repository;
+using ZR.Service.System.ISystemService;
+using ZR.ServiceCore.Model;
+
+namespace ZR.Service.System
+{
+ ///
+ /// 邮件模板Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IEmailTplService), ServiceLifetime = LifeTime.Transient)]
+ public class EmailTplService : BaseService, IEmailTplService
+ {
+ ///
+ /// 查询邮件模板列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(EmailTplQueryDto parm)
+ {
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name == parm.Name);
+ var response = Queryable()
+ //.OrderBy("Id desc")
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public EmailTpl GetInfo(int Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加邮件模板
+ ///
+ ///
+ ///
+ public EmailTpl AddEmailTpl(EmailTpl model)
+ {
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改邮件模板
+ ///
+ ///
+ ///
+ public int UpdateEmailTpl(EmailTpl model)
+ {
+ return Update(model, true);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/ZR.ServiceCore/Services/IService/IEmailTplService.cs b/ZR.ServiceCore/Services/IService/IEmailTplService.cs
new file mode 100644
index 0000000..d28e00a
--- /dev/null
+++ b/ZR.ServiceCore/Services/IService/IEmailTplService.cs
@@ -0,0 +1,21 @@
+using ZR.Model;
+using ZR.Model.Dto;
+using ZR.ServiceCore.Model;
+
+namespace ZR.Service.System.ISystemService
+{
+ ///
+ /// 邮件模板service接口
+ ///
+ public interface IEmailTplService : IBaseService
+ {
+ PagedInfo GetList(EmailTplQueryDto parm);
+
+ EmailTpl GetInfo(int Id);
+
+ EmailTpl AddEmailTpl(EmailTpl parm);
+
+ int UpdateEmailTpl(EmailTpl parm);
+
+ }
+}
diff --git a/ZR.ServiceCore/Services/SeedDataService.cs b/ZR.ServiceCore/Services/SeedDataService.cs
index 72ac52e..fe88b98 100644
--- a/ZR.ServiceCore/Services/SeedDataService.cs
+++ b/ZR.ServiceCore/Services/SeedDataService.cs
@@ -197,7 +197,7 @@ namespace ZR.Service.System
.SplitInsert(it => it.NotAny())
.WhereColumns(it => it.Name)
.ToStorage();
- var result = x.AsInsertable.OffIdentity().ExecuteCommand();
+ var result = x.AsInsertable.ExecuteCommand();
string msg = $"[字典数据] 插入{x.InsertList.Count} 错误{x.ErrorList.Count} 总共{x.TotalList.Count}";
return (msg, x.ErrorList, x.IgnoreList);
diff --git a/ZR.ServiceCore/SqlSugar/DataPermi.cs b/ZR.ServiceCore/SqlSugar/DataPermi.cs
index 508eae0..0de5d4b 100644
--- a/ZR.ServiceCore/SqlSugar/DataPermi.cs
+++ b/ZR.ServiceCore/SqlSugar/DataPermi.cs
@@ -1,6 +1,5 @@
using Infrastructure;
using SqlSugar.IOC;
-using ZR.Model.Business;
using ZR.Model.System;
namespace ZR.ServiceCore.SqlSugar
diff --git a/ZR.ServiceCore/SqlSugar/InitTable.cs b/ZR.ServiceCore/SqlSugar/InitTable.cs
index 88a4f90..fc22837 100644
--- a/ZR.ServiceCore/SqlSugar/InitTable.cs
+++ b/ZR.ServiceCore/SqlSugar/InitTable.cs
@@ -2,6 +2,7 @@
using ZR.Model.Models;
using ZR.Model.System;
using ZR.Model.System.Generate;
+using ZR.ServiceCore.Model;
namespace ZR.ServiceCore.SqlSugar
{
@@ -48,7 +49,7 @@ namespace ZR.ServiceCore.SqlSugar
db.CodeFirst.InitTables(typeof(SysDictData));
db.CodeFirst.InitTables(typeof(SysDictType));
db.CodeFirst.InitTables(typeof(SqlDiffLog));
+ db.CodeFirst.InitTables(typeof(EmailTpl));
}
-
}
}