Jelajahi Sumber

邮件日志接口--暂未启用

liyuan 7 bulan lalu
induk
melakukan
17de8729fa

+ 33 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/dto/SendMailLogDTO.java

@@ -0,0 +1,33 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.mail.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.los.mail.entity.SendMailLog;
+
+/**
+ * 邮件发送日志表数据传输对象实体类
+ *
+ * @author Rain
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SendMailLogDTO extends SendMailLog {
+	private static final long serialVersionUID = 1L;
+
+}

+ 50 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/entity/SendMailLog.java

@@ -0,0 +1,50 @@
+
+package org.springblade.los.mail.entity;
+
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 邮件发送日志表实体类
+ *
+ * @author Rain
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SendMailLog对象", description = "邮件发送日志表")
+public class SendMailLog extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	 * 发送人邮箱
+	 */
+	@ApiModelProperty(value = "发送人邮箱")
+	private String mailForm;
+	/**
+	 * 接收人邮箱
+	 */
+	@ApiModelProperty(value = "接收人邮箱")
+	private String mailTo;
+	/**
+	 * 标题
+	 */
+	@ApiModelProperty(value = "标题")
+	private String mailTitile;
+	/**
+	 * 内容
+	 */
+	@ApiModelProperty(value = "内容")
+	private String mailContent;
+	/**
+	 * 附件
+	 */
+	@ApiModelProperty(value = "附件")
+	private String mailFiles;
+
+
+}

+ 19 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/mail/vo/SendMailLogVO.java

@@ -0,0 +1,19 @@
+package org.springblade.los.mail.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import org.springblade.los.mail.entity.SendMailLog;
+
+/**
+ * 邮件发送日志表视图实体类
+ *
+ * @author Rain
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SendMailLogVO对象", description = "邮件发送日志表")
+public class SendMailLogVO extends SendMailLog {
+	private static final long serialVersionUID = 1L;
+
+}

+ 14 - 3
blade-service/blade-los/src/main/java/org/springblade/los/email/controller/EmailController.java

@@ -1,13 +1,14 @@
 package org.springblade.los.email.controller;
 
 
+import com.echepei.dto.mail.MailDto;
+import com.echepei.utils.mail.SendMailUtil;
 import io.swagger.annotations.Api;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
+import org.springblade.core.tool.api.R;
 import org.springblade.los.email.service.EMailService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.thymeleaf.context.Context;
 
 import java.io.File;
@@ -77,4 +78,14 @@ public class EmailController {
 		emailService.send(to, "激活码模板邮件", context, file);
 		return "发送成功!!";
 	}
+
+
+
+	@PostMapping("/sendMailByFile")
+	public R<String> sendMailByFile(@RequestBody MailDto mailDto){
+		SendMailUtil.sendFileMail(mailDto);
+		return R.status(true);
+	}
+
+
 }

+ 28 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/SendMailLogMapper.java

@@ -0,0 +1,28 @@
+
+package org.springblade.los.email.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.mail.entity.SendMailLog;
+import org.springblade.los.mail.vo.SendMailLogVO;
+
+import java.util.List;
+
+/**
+ * 邮件发送日志表 Mapper 接口
+ *
+ * @author Rain
+ */
+public interface SendMailLogMapper extends BaseMapper<SendMailLog> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page        分页
+	 * @param sendMailLog 参数
+	 * @return 结果
+	 */
+	List<SendMailLogVO> selectSendMailLogPage(IPage page, SendMailLogVO sendMailLog);
+
+}

+ 29 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/SendMailLogMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--suppress ALL -->
+<mapper namespace="org.springblade.los.email.mapper.SendMailLogMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="sendMailLogResultMap" type="org.springblade.los.mail.entity.SendMailLog">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="mail_form" property="mailForm"/>
+        <result column="mail_to" property="mailTo"/>
+        <result column="mail_titile" property="mailTitile"/>
+        <result column="mail_content" property="mailContent"/>
+        <result column="mail_files" property="mailFiles"/>
+    </resultMap>
+
+
+    <select id="selectSendMailLogPage" resultMap="sendMailLogResultMap">
+        select *
+        from send_mail_log
+        where is_deleted = 0
+    </select>
+
+</mapper>

+ 25 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/service/impl/SendMailLogServiceImpl.java

@@ -0,0 +1,25 @@
+package org.springblade.los.email.service.impl;
+
+
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.los.email.mapper.SendMailLogMapper;
+import org.springblade.los.email.service.ISendMailLogService;
+import org.springblade.los.mail.entity.SendMailLog;
+import org.springblade.los.mail.vo.SendMailLogVO;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 邮件发送日志表 服务实现类
+ *
+ * @author Rain
+ */
+@Service
+public class SendMailLogServiceImpl extends BaseServiceImpl<SendMailLogMapper, SendMailLog> implements ISendMailLogService {
+
+	@Override
+	public IPage<SendMailLogVO> selectSendMailLogPage(IPage<SendMailLogVO> page, SendMailLogVO sendMailLog) {
+		return page.setRecords(baseMapper.selectSendMailLogPage(page, sendMailLog));
+	}
+
+}