✨ 新增邮件模板

This commit is contained in:
不做码农
2023-11-13 19:56:29 +08:00
parent 2e0db37d42
commit e234189af3
10 changed files with 253 additions and 6 deletions
+39
View File
@@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
namespace ZR.Model.Dto
{
/// <summary>
/// 邮件模板查询对象
/// </summary>
public class EmailTplQueryDto : PagerInfo
{
public string Name { get; set; }
}
/// <summary>
/// 邮件模板输入输出对象
/// </summary>
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; }
}
}
+17
View File
@@ -0,0 +1,17 @@
using ZR.Model.System;
namespace ZR.ServiceCore.Model
{
/// <summary>
/// 邮件发送模板
/// </summary>
[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; }
}
}
-3
View File
@@ -1,7 +1,4 @@
using MiniExcelLibs.Attributes;
using Newtonsoft.Json;
using SqlSugar;
using System;
namespace ZR.Model.System
{
@@ -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
{
/// <summary>
/// 邮件模板Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IEmailTplService), ServiceLifetime = LifeTime.Transient)]
public class EmailTplService : BaseService<EmailTpl>, IEmailTplService
{
/// <summary>
/// 查询邮件模板列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<EmailTplDto> GetList(EmailTplQueryDto parm)
{
var predicate = Expressionable.Create<EmailTpl>();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name == parm.Name);
var response = Queryable()
//.OrderBy("Id desc")
.Where(predicate.ToExpression())
.ToPage<EmailTpl, EmailTplDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public EmailTpl GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加邮件模板
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public EmailTpl AddEmailTpl(EmailTpl model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改邮件模板
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateEmailTpl(EmailTpl model)
{
return Update(model, true);
}
}
}
@@ -0,0 +1,21 @@
using ZR.Model;
using ZR.Model.Dto;
using ZR.ServiceCore.Model;
namespace ZR.Service.System.ISystemService
{
/// <summary>
/// 邮件模板service接口
/// </summary>
public interface IEmailTplService : IBaseService<EmailTpl>
{
PagedInfo<EmailTplDto> GetList(EmailTplQueryDto parm);
EmailTpl GetInfo(int Id);
EmailTpl AddEmailTpl(EmailTpl parm);
int UpdateEmailTpl(EmailTpl parm);
}
}
+1 -1
View File
@@ -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);
-1
View File
@@ -1,6 +1,5 @@
using Infrastructure;
using SqlSugar.IOC;
using ZR.Model.Business;
using ZR.Model.System;
namespace ZR.ServiceCore.SqlSugar
+2 -1
View File
@@ -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));
}
}
}