提交 3b0f09a7 编写于 作者: Jadan-Z's avatar Jadan-Z

1、完成表email_send_model涉及增删改查功能

上级 bea5b4bf
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.controller;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.eve.service.EmailSendModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class EmailSendModelController {
@Autowired
private EmailSendModelService emailSendModelService;
/**
*
* @Title: queryEmailSendModelList
* @Description: 可根据标题模糊+收件人分页获取邮箱发送模板列表
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/EmailSendModel/queryEmailSendModelList")
@ResponseBody
public void queryEmailSendModelList(InputObject inputObject, OutputObject outputObject) throws Exception{
emailSendModelService.queryEmailSendModelList(inputObject, outputObject);
}
/**
*
* @Title: insertEmailSendModel
* @Description: 用户新增邮件发送模板
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/EmailSendModel/insertEmailSendModel")
@ResponseBody
public void insertEmailSendModel(InputObject inputObject, OutputObject outputObject) throws Exception{
emailSendModelService.insertEmailSendModel(inputObject, outputObject);
}
/**
*
* @Title: queryEmailSendModelInfoById
* @Description: 根据邮箱模板id获取邮件模板详情
* @param inputObject
* @param outputObject
* @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/EmailSendModel/queryEmailSendModelInfoById")
@ResponseBody
public void queryEmailSendModelInfoById(InputObject inputObject, OutputObject outputObject) throws Exception{
emailSendModelService.queryEmailSendModelInfoById(inputObject, outputObject);
}
/**
*
* @Title: delEmailSendModelById
* @Description: 根据邮件模板id删除该模板
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/EmailSendModel/delEmailSendModelById")
@ResponseBody
public void delEmailSendModelById(InputObject inputObject, OutputObject outputObject) throws Exception{
emailSendModelService.delEmailSendModelById(inputObject, outputObject);
}
/**
*
* @Title: updateEmailSendModelById
* @Description: 根据邮件模板id更新模板内容
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/EmailSendModel/updateEmailSendModelById")
@ResponseBody
public void updateEmailSendModelById(InputObject inputObject, OutputObject outputObject) throws Exception{
emailSendModelService.updateEmailSendModelById(inputObject, outputObject);
}
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
*
* @ClassName: EmailSendModelDao
* @Description: 邮件发送模板数据层
* @author: skyeye云系列--郑杰
* @date: 2021/10/31 22:51
*
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface EmailSendModelDao {
List<Map<String, Object>> queryEmailSendModelList(Map<String, Object> map) throws Exception;
void insertEmailSendModel(Map<String, Object> map);
Map<String, Object> queryEmailSendModelInfoById(@Param("id") String id);
void delEmailSendModelById(@Param("id") String id);
void updateEmailSendModelById(Map<String, Object> map);
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface EmailSendModelService {
void queryEmailSendModelList(InputObject inputObject, OutputObject outputObject) throws Exception;
void insertEmailSendModel(InputObject inputObject, OutputObject outputObject) throws Exception;
void queryEmailSendModelInfoById(InputObject inputObject, OutputObject outputObject) throws Exception;
void delEmailSendModelById(InputObject inputObject, OutputObject outputObject) throws Exception;
void updateEmailSendModelById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.eve.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.DateUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.EmailSendModelDao;
import com.skyeye.eve.service.EmailSendModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class EmailSendModelServiceImpl implements EmailSendModelService {
@Autowired
private EmailSendModelDao emailSendModelDao;
@Override
public void queryEmailSendModelList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
Page pages = PageHelper.startPage(Integer.parseInt(inputParams.get("page").toString()), Integer.parseInt(inputParams.get("limit").toString()));
List<Map<String, Object>> emailSendModelList = emailSendModelDao.queryEmailSendModelList(inputParams);
outputObject.setBeans(emailSendModelList);
outputObject.settotal(pages.getTotal());
}
@Override
public void insertEmailSendModel(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
inputParams.put("id", ToolUtil.getSurFaceId());
inputParams.put("createTime", DateUtil.getTimeAndToString());
inputParams.put("userId", inputObject.getLogParams().get("id"));
emailSendModelDao.insertEmailSendModel(inputParams);
}
@Override
public void queryEmailSendModelInfoById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
Map<String, Object> emailSendModelInfo = emailSendModelDao.queryEmailSendModelInfoById(inputParams.get("id").toString());
outputObject.setBean(emailSendModelInfo);
outputObject.settotal(1);
}
@Override
public void delEmailSendModelById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
emailSendModelDao.delEmailSendModelById(inputParams.get("id").toString());
}
@Override
public void updateEmailSendModelById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
inputParams.put("lastUpdateTime", DateUtil.getTimeAndToString());
inputParams.put("userId", inputObject.getLogParams().get("id"));
emailSendModelDao.updateEmailSendModelById(inputParams);
}
}
<?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" >
<mapper namespace="com.skyeye.eve.dao.EmailSendModelDao">
<select id="queryEmailSendModelList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
esm.id,
esm.title,
esm.to_people toPeople,
esm.to_cc toCc,
esm.to_bcc toBcc,
b.user_name createName,
CONVERT(esm.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(esm.last_update_time, char) lastUpdateTime
FROM email_send_model esm
LEFT JOIN sys_eve_user_staff b ON esm.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON esm.last_update_id = c.user_id
WHERE 1 = 1
<if test="title != null and title != ''">
AND title = '%${title}%'
</if>
<if test="toPeople != null and toPeople != ''">
AND toPeople = #{toPeople}
</if>
ORDER BY esm.create_time DESC
</select>
<insert id="insertEmailSendModel" parameterType="java.util.Map">
INSERT INTO email_send_model
(id, title, to_people, to_cc, to_bcc, create_id, create_time, last_update_id, last_update_time)
VALUES
(#{id}, #{title}, #{toPeople}, #{toCc}, #{toBcc}, #{userId}, #{createTime}, #{userId}, #{createTime})
</insert>
<select id="queryEmailSendModelInfoById" parameterType="java.lang.String" resultType="java.util.Map">
SELECT
esm.id,
esm.title,
esm.to_people toPeople,
esm.to_cc toCc,
esm.to_bcc toBcc,
b.user_name createName,
CONVERT(esm.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(esm.last_update_time, char) lastUpdateTime
FROM email_send_model esm
LEFT JOIN sys_eve_user_staff b ON esm.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON esm.last_update_id = c.user_id
WHERE esm.id = #{id}
</select>
<update id="updateEmailSendModelById" parameterType="java.util.Map">
UPDATE email_send_model
SET
title = #{title},
to_people = #{toPeople},
<if test="toCc != null and toCc != ''">
to_cc = #{toCc},
</if>
<if test="toBcc != null and toBcc != ''">
to_bcc = #{toBcc},
</if>
last_update_id = #{userId},
last_update_time = #{lastUpdateTime}
WHERE id = #{id}
</update>
<delete id="delEmailSendModelById" parameterType="java.lang.String">
DELETE FROM email_send_model WHERE id = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -114,5 +114,34 @@
<property id="emailEnclosureList" name="emailEnclosureList" ref="" var="服务器附件列表" />
</url>
<!-- 邮件管理结束 -->
<!-- 邮件发送模板开始 -->
<url id="emailsendmodel001" path="/post/EmailSendModel/queryEmailSendModelList" val="分页获取邮箱发送模板列表" method = "POST" allUse="2">
<property id="title" name="title" ref="" var="标题"/>
<property id="toPeople" name="toPeople" ref="" var="收件人"/>
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<url id="emailsendmodel002" path="/post/EmailSendModel/insertEmailSendModel" val="新增邮件发送模板" allUse="2">
<property id="title" name="title" ref="required" var="标题" />
<property id="toPeople" name="toPeople" ref="required,email" var="收件人" />
<property id="toCc" name="toCc" ref="" var="抄送人" />
<property id="toBcc" name="toBcc" ref="" var="暗送" />
</url>
<url id="emailsendmodel003" path="/post/EmailSendModel/queryEmailSendModelInfoById" val="根据邮箱模板id获取邮件模板详情" method = "GET" allUse="2">
<property id="id" name="id" ref="required" var="邮件发送模板id" />
</url>
<url id="emailsendmodel004" path="/post/EmailSendModel/delEmailSendModelById" val="根据id删除邮件模板" method = "DELETE" allUse="2">
<property id="id" name="id" ref="required" var="邮件id" />
</url>
<url id="emailsendmodel005" path="/post/EmailSendModel/updateEmailSendModelById" val="根据邮件模板id更新模板内容" method = "PUT" allUse="2">
<property id="id" name="id" ref="required" var="邮件id" />
<property id="title" name="title" ref="required" var="标题" />
<property id="toPeople" name="toPeople" ref="required,email" var="收件人" />
<property id="toCc" name="toCc" ref="" var="抄送人" />
<property id="toBcc" name="toBcc" ref="" var="暗送" />
</url>
<!-- 邮件发送模板结束 -->
</controller>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册