新闻采集修改,完成发送邮件
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
<result column="bean_name" property="beanName" />
|
||||
<result column="method_name" property="methodName" />
|
||||
<result column="method_params" property="methodParams" />
|
||||
<result column="meta_id" property="metaId" />
|
||||
<result column="default_recipient" property="defaultRecipient" />
|
||||
<result column="cron_expression" property="cronExpression" />
|
||||
<result column="status" property="status" />
|
||||
<result column="description" property="description" />
|
||||
@@ -26,7 +28,7 @@
|
||||
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, task_id, task_name, task_group, bean_name, method_name, method_params,
|
||||
id, task_id, task_name, task_group, bean_name, method_name, method_params, meta_id, default_recipient,
|
||||
cron_expression, status, description, concurrent, misfire_policy,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
</sql>
|
||||
@@ -132,6 +134,8 @@
|
||||
<if test="task.beanName != null">bean_name,</if>
|
||||
<if test="task.methodName != null">method_name,</if>
|
||||
<if test="task.methodParams != null">method_params,</if>
|
||||
<if test="task.metaId != null">meta_id,</if>
|
||||
<if test="task.defaultRecipient != null">default_recipient,</if>
|
||||
<if test="task.cronExpression != null">cron_expression,</if>
|
||||
<if test="task.status != null">status,</if>
|
||||
<if test="task.description != null">description,</if>
|
||||
@@ -150,6 +154,8 @@
|
||||
<if test="task.beanName != null">#{task.beanName},</if>
|
||||
<if test="task.methodName != null">#{task.methodName},</if>
|
||||
<if test="task.methodParams != null">#{task.methodParams},</if>
|
||||
<if test="task.metaId != null">#{task.metaId},</if>
|
||||
<if test="task.defaultRecipient != null">#{task.defaultRecipient},</if>
|
||||
<if test="task.cronExpression != null">#{task.cronExpression},</if>
|
||||
<if test="task.status != null">#{task.status},</if>
|
||||
<if test="task.description != null">#{task.description},</if>
|
||||
@@ -170,6 +176,8 @@
|
||||
<if test="task.beanName != null">bean_name = #{task.beanName},</if>
|
||||
<if test="task.methodName != null">method_name = #{task.methodName},</if>
|
||||
<if test="task.methodParams != null">method_params = #{task.methodParams},</if>
|
||||
<if test="task.metaId != null">meta_id = #{task.metaId},</if>
|
||||
<if test="task.defaultRecipient != null">default_recipient = #{task.defaultRecipient},</if>
|
||||
<if test="task.cronExpression != null">cron_expression = #{task.cronExpression},</if>
|
||||
<if test="task.status != null">status = #{task.status},</if>
|
||||
<if test="task.description != null">description = #{task.description},</if>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<?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="org.xyzh.crontab.mapper.EmailDefaultMapper">
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.crontab.TbCrontabEmailDefault">
|
||||
<id column="id" property="ID" />
|
||||
<result column="default_id" property="defaultId" />
|
||||
<result column="meta_id" property="metaId" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="user_email" property="userEmail" />
|
||||
<result column="username" property="username" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="updater" property="updater" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="delete_time" property="deleteTime" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, default_id, meta_id, user_id,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
</sql>
|
||||
|
||||
<!-- 插入默认接收人 -->
|
||||
<insert id="insertDefault" parameterType="org.xyzh.common.dto.crontab.TbCrontabEmailDefault">
|
||||
INSERT INTO tb_crontab_email_default (
|
||||
id, default_id, meta_id, user_id, creator, create_time
|
||||
) VALUES (
|
||||
#{emailDefault.ID}, #{emailDefault.defaultId}, #{emailDefault.metaId},
|
||||
#{emailDefault.userId}, #{emailDefault.creator}, NOW()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新默认接收人 -->
|
||||
<update id="updateDefault" parameterType="org.xyzh.common.dto.crontab.TbCrontabEmailDefault">
|
||||
UPDATE tb_crontab_email_default
|
||||
SET meta_id = #{emailDefault.metaId},
|
||||
user_id = #{emailDefault.userId},
|
||||
updater = #{emailDefault.updater},
|
||||
update_time = NOW()
|
||||
WHERE default_id = #{emailDefault.defaultId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 删除默认接收人(逻辑删除) -->
|
||||
<update id="deleteDefault">
|
||||
UPDATE tb_crontab_email_default
|
||||
SET deleted = 1,
|
||||
delete_time = NOW()
|
||||
WHERE default_id = #{defaultId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 根据defaultId查询 -->
|
||||
<select id="selectDefaultById" resultMap="BaseResultMap">
|
||||
SELECT tced.id, tced.default_id, tced.meta_id, tced.user_id, tu.email as user_email, tu.username
|
||||
FROM tb_crontab_email_default tced
|
||||
LEFT JOIN tb_sys_user tu ON tced.user_id = tu.id
|
||||
WHERE tced.default_id = #{defaultId}
|
||||
AND tced.deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据metaId查询 -->
|
||||
<select id="selectDefaultByMetaId" resultMap="BaseResultMap">
|
||||
SELECT tced.id, tced.default_id, tced.meta_id, tced.user_id, tu.email as user_email, tu.username
|
||||
FROM tb_crontab_email_default tced
|
||||
LEFT JOIN tb_sys_user tu ON tced.user_id = tu.id
|
||||
WHERE tced.meta_id = #{metaId}
|
||||
AND tced.deleted = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?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="org.xyzh.crontab.mapper.EmailRecipientMapper">
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.crontab.TbCrontabEmailRecipient">
|
||||
<id column="id" property="ID" />
|
||||
<result column="recipient_id" property="recipientId" />
|
||||
<result column="task_id" property="taskId" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="email" property="email" />
|
||||
<result column="name" property="name" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="updater" property="updater" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="delete_time" property="deleteTime" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, recipient_id, task_id, user_id, email, name,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="filter.recipientId != null and filter.recipientId != ''">
|
||||
AND recipient_id = #{filter.recipientId}
|
||||
</if>
|
||||
<if test="filter.taskId != null and filter.taskId != ''">
|
||||
AND task_id = #{filter.taskId}
|
||||
</if>
|
||||
<if test="filter.userId != null and filter.userId != ''">
|
||||
AND user_id = #{filter.userId}
|
||||
</if>
|
||||
<if test="filter.email != null and filter.email != ''">
|
||||
AND email LIKE CONCAT('%', #{filter.email}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 插入邮件接收人 -->
|
||||
<insert id="insertRecipient" parameterType="org.xyzh.common.dto.crontab.TbCrontabEmailRecipient">
|
||||
INSERT INTO tb_crontab_email_recipient (
|
||||
id, recipient_id, task_id, user_id, email, name, creator, create_time
|
||||
) VALUES (
|
||||
#{recipient.ID}, #{recipient.recipientId}, #{recipient.taskId},
|
||||
#{recipient.userId}, #{recipient.email}, #{recipient.name},
|
||||
#{recipient.creator}, NOW()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入邮件接收人 -->
|
||||
<insert id="batchInsertRecipient">
|
||||
INSERT INTO tb_crontab_email_recipient (
|
||||
id, recipient_id, task_id, user_id, email, name, creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="recipients" item="item" separator=",">
|
||||
(#{item.ID}, #{item.recipientId}, #{item.taskId},
|
||||
#{item.userId}, #{item.email}, #{item.name}, #{item.creator}, NOW())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 更新邮件接收人 -->
|
||||
<update id="updateRecipient" parameterType="org.xyzh.common.dto.crontab.TbCrontabEmailRecipient">
|
||||
UPDATE tb_crontab_email_recipient
|
||||
SET task_id = #{recipient.taskId},
|
||||
user_id = #{recipient.userId},
|
||||
email = #{recipient.email},
|
||||
name = #{recipient.name},
|
||||
updater = #{recipient.updater},
|
||||
update_time = NOW()
|
||||
WHERE recipient_id = #{recipient.recipientId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 删除邮件接收人(逻辑删除) -->
|
||||
<update id="deleteRecipient">
|
||||
UPDATE tb_crontab_email_recipient
|
||||
SET deleted = 1,
|
||||
delete_time = NOW()
|
||||
WHERE recipient_id = #{recipientId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 根据ID查询 -->
|
||||
<select id="selectRecipientById" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_email_recipient
|
||||
WHERE recipient_id = #{recipientId}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询接收人列表 -->
|
||||
<select id="selectRecipientsByTaskId" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_email_recipient
|
||||
WHERE task_id = #{taskId}
|
||||
AND deleted = 0
|
||||
ORDER BY create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 查询所有接收人 -->
|
||||
<select id="selectAllRecipients" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_email_recipient
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectRecipientPage" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_email_recipient
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.offset}, #{pageParam.pageSize}
|
||||
</select>
|
||||
|
||||
<!-- 查询总数 -->
|
||||
<select id="countSelectRecipient" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM tb_crontab_email_recipient
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 删除任务的所有接收人 -->
|
||||
<update id="deleteRecipientsByTaskId">
|
||||
UPDATE tb_crontab_email_recipient
|
||||
SET deleted = 1,
|
||||
delete_time = NOW()
|
||||
WHERE task_id = #{taskId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,139 @@
|
||||
<?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="org.xyzh.crontab.mapper.TaskMetaMapper">
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.crontab.TbCrontabTaskMeta">
|
||||
<id column="id" property="ID" />
|
||||
<result column="meta_id" property="metaId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="description" property="description" />
|
||||
<result column="category" property="category" />
|
||||
<result column="bean_name" property="beanName" />
|
||||
<result column="method_name" property="methodName" />
|
||||
<result column="script_path" property="scriptPath" />
|
||||
<result column="param_schema" property="paramSchema" />
|
||||
<result column="auto_publish" property="autoPublish" />
|
||||
<result column="sort_order" property="sortOrder" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="updater" property="updater" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="delete_time" property="deleteTime" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, meta_id, name, description, category, bean_name, method_name,
|
||||
script_path, param_schema, auto_publish, sort_order,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="filter.metaId != null and filter.metaId != ''">
|
||||
AND meta_id = #{filter.metaId}
|
||||
</if>
|
||||
<if test="filter.name != null and filter.name != ''">
|
||||
AND name LIKE CONCAT('%', #{filter.name}, '%')
|
||||
</if>
|
||||
<if test="filter.category != null and filter.category != ''">
|
||||
AND category = #{filter.category}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 插入任务元数据 -->
|
||||
<insert id="insertTaskMeta" parameterType="org.xyzh.common.dto.crontab.TbCrontabTaskMeta">
|
||||
INSERT INTO tb_crontab_task_meta (
|
||||
id, meta_id, name, description, category, bean_name, method_name,
|
||||
script_path, param_schema, auto_publish, sort_order, creator, create_time
|
||||
) VALUES (
|
||||
#{taskMeta.ID}, #{taskMeta.metaId}, #{taskMeta.name}, #{taskMeta.description},
|
||||
#{taskMeta.category}, #{taskMeta.beanName}, #{taskMeta.methodName},
|
||||
#{taskMeta.scriptPath}, #{taskMeta.paramSchema}, #{taskMeta.autoPublish}, #{taskMeta.sortOrder},
|
||||
#{taskMeta.creator}, NOW()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新任务元数据 -->
|
||||
<update id="updateTaskMeta" parameterType="org.xyzh.common.dto.crontab.TbCrontabTaskMeta">
|
||||
UPDATE tb_crontab_task_meta
|
||||
SET name = #{taskMeta.name},
|
||||
description = #{taskMeta.description},
|
||||
category = #{taskMeta.category},
|
||||
bean_name = #{taskMeta.beanName},
|
||||
method_name = #{taskMeta.methodName},
|
||||
script_path = #{taskMeta.scriptPath},
|
||||
param_schema = #{taskMeta.paramSchema},
|
||||
auto_publish = #{taskMeta.autoPublish},
|
||||
sort_order = #{taskMeta.sortOrder},
|
||||
updater = #{taskMeta.updater},
|
||||
update_time = NOW()
|
||||
WHERE meta_id = #{taskMeta.metaId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 删除任务元数据(逻辑删除) -->
|
||||
<update id="deleteTaskMeta">
|
||||
UPDATE tb_crontab_task_meta
|
||||
SET deleted = 1,
|
||||
delete_time = NOW()
|
||||
WHERE meta_id = #{metaId}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 根据ID查询 -->
|
||||
<select id="selectTaskMetaById" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_task_meta
|
||||
WHERE meta_id = #{metaId}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据TaskID查询 -->
|
||||
<select id="selectTaskMetaByTaskId" resultMap="BaseResultMap">
|
||||
SELECT tcte.*
|
||||
FROM tb_crontab_task tct
|
||||
LEFT JOIN tb_crontab_task_meta tcte ON tct.meta_id = tcte.meta_id
|
||||
WHERE tct.task_id = #{taskId}
|
||||
AND tcte.deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询所有任务元数据 -->
|
||||
<select id="selectAllTaskMeta" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_task_meta
|
||||
WHERE deleted = 0
|
||||
ORDER BY sort_order ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据分类查询 -->
|
||||
<select id="selectTaskMetaByCategory" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_task_meta
|
||||
WHERE category = #{category}
|
||||
AND deleted = 0
|
||||
ORDER BY sort_order ASC
|
||||
</select>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectTaskMetaPage" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM tb_crontab_task_meta
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY sort_order ASC, create_time DESC
|
||||
LIMIT #{pageParam.offset}, #{pageParam.pageSize}
|
||||
</select>
|
||||
|
||||
<!-- 查询总数 -->
|
||||
<select id="countSelectTaskMeta" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM tb_crontab_task_meta
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user