290 lines
12 KiB
XML
290 lines
12 KiB
XML
|
<?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="cn.com.tenlion.systemoa.dao.mail.IMailDao">
|
||
|
|
||
|
<!-- 发件箱DTO -->
|
||
|
<resultMap id="mailSendDTO" type="cn.com.tenlion.systemoa.pojo.dtos.mail.MailSendDTO">
|
||
|
<id column="mail_id" property="mailId"/>
|
||
|
<result column="recipient_ids" property="recipientIds"/>
|
||
|
<result column="recipient_names" property="recipientNames"/>
|
||
|
<result column="copy_for_ids" property="copyForIds"/>
|
||
|
<result column="copy_for_names" property="copyForNames"/>
|
||
|
<result column="secret_ids" property="secretIds"/>
|
||
|
<result column="secret_names" property="secretNames"/>
|
||
|
<result column="title" property="title"/>
|
||
|
<result column="mail_files" property="mailFiles"/>
|
||
|
<result column="content_rich" property="contentRich"/>
|
||
|
<result column="content" property="content"/>
|
||
|
<result column="creator" property="creator"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
<result column="modifier" property="modifier"/>
|
||
|
<result column="gmt_modified" property="gmtModified"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<!-- 收件箱DTO -->
|
||
|
<resultMap id="mailInboxDTO" type="cn.com.tenlion.systemoa.pojo.dtos.mail.MailInboxDTO">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="mail_id_link" property="mailIdLink"/>
|
||
|
<result column="recipient_ids" property="recipientIds"/>
|
||
|
<result column="recipient_names" property="recipientNames"/>
|
||
|
<result column="copy_for_ids" property="copyForIds"/>
|
||
|
<result column="copy_for_names" property="copyForNames"/>
|
||
|
<result column="secret_ids" property="secretIds"/>
|
||
|
<result column="secret_names" property="secretNames"/>
|
||
|
<result column="title" property="title"/>
|
||
|
<result column="mail_files" property="mailFiles"/>
|
||
|
<result column="content_rich" property="contentRich"/>
|
||
|
<result column="content" property="content"/>
|
||
|
<result column="creator" property="creator"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<!-- 垃圾箱DTO -->
|
||
|
<resultMap id="mailDelDTO" type="cn.com.tenlion.systemoa.pojo.dtos.mail.MailDelDTO">
|
||
|
<id column="id" property="id"/>
|
||
|
<result column="mail_id" property="mailId"/>
|
||
|
<result column="recipient_ids" property="recipientIds"/>
|
||
|
<result column="recipient_names" property="recipientNames"/>
|
||
|
<result column="copy_for_ids" property="copyForIds"/>
|
||
|
<result column="copy_for_names" property="copyForNames"/>
|
||
|
<result column="secret_ids" property="secretIds"/>
|
||
|
<result column="secret_names" property="secretNames"/>
|
||
|
<result column="title" property="title"/>
|
||
|
<result column="mail_files" property="mailFiles"/>
|
||
|
<result column="content_rich" property="contentRich"/>
|
||
|
<result column="content" property="content"/>
|
||
|
<result column="creator" property="creator"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
<result column="source_from" property="sourceFrom"/>
|
||
|
<result column="del_user_id" property="delUserId"/>
|
||
|
<result column="del_time" property="delTime"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<!-- 发信 -->
|
||
|
<insert id="saveSendMail" parameterType="map">
|
||
|
INSERT INTO oa_mail_send(
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create, modifier, gmt_modified
|
||
|
) VALUES(
|
||
|
#{mailId}, #{recipientIds}, #{recipientNames}, #{copyForIds}, #{copyForNames}, #{secretIds}, #{secretNames},
|
||
|
#{title}, #{mailFiles}, #{contentRich}, #{content}, #{creator}, #{gmtCreate}, #{modifier}, #{gmtModified}
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 发件箱列表 -->
|
||
|
<select id="listSendMail" parameterType="map" resultMap="mailSendDTO">
|
||
|
SELECT
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create, modifier, gmt_modified
|
||
|
FROM
|
||
|
oa_mail_send
|
||
|
WHERE
|
||
|
creator = #{creator}
|
||
|
<if test="keywords != null and keywords != ''">
|
||
|
AND (
|
||
|
recipient_names like CONCAT('%', CONCAT(#{keywords}, '%'))
|
||
|
OR
|
||
|
title like CONCAT('%', CONCAT(#{keywords}, '%'))
|
||
|
)
|
||
|
</if>
|
||
|
ORDER BY gmt_create DESC
|
||
|
</select>
|
||
|
|
||
|
<!-- 发件箱详情 -->
|
||
|
<select id="getSendMail" parameterType="map" resultMap="mailSendDTO">
|
||
|
SELECT
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create, modifier, gmt_modified
|
||
|
FROM
|
||
|
oa_mail_send
|
||
|
WHERE
|
||
|
mail_id = #{mailId}
|
||
|
</select>
|
||
|
|
||
|
<!-- 保存到收件箱 -->
|
||
|
<insert id="saveInboxMail" parameterType="map">
|
||
|
INSERT INTO oa_mail_inbox(
|
||
|
mail_id_link, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create
|
||
|
) VALUES (
|
||
|
#{mailIdLink}, #{recipientIds}, #{recipientNames}, #{copyForIds}, #{copyForNames}, #{secretIds}, #{secretNames},
|
||
|
#{title}, #{mailFiles}, #{contentRich}, #{content}, #{creator}, #{gmtCreate}
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 收件箱列表 -->
|
||
|
<select id="listInboxMail" parameterType="map" resultMap="mailInboxDTO">
|
||
|
SELECT
|
||
|
id, mail_id_link, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create
|
||
|
FROM
|
||
|
oa_mail_inbox
|
||
|
WHERE
|
||
|
FIND_IN_SET(#{userId}, recipient_ids)
|
||
|
OR
|
||
|
FIND_IN_SET(#{userId}, copy_for_ids)
|
||
|
OR
|
||
|
FIND_IN_SET(#{userId}, secret_ids)
|
||
|
ORDER BY gmt_create DESC
|
||
|
</select>
|
||
|
|
||
|
<select id="getInboxMail" parameterType="map" resultMap="mailInboxDTO">
|
||
|
SELECT
|
||
|
id, mail_id_link, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create
|
||
|
FROM
|
||
|
oa_mail_inbox
|
||
|
WHERE
|
||
|
id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<!-- 保存草稿 -->
|
||
|
<insert id="saveDraftMail" parameterType="map">
|
||
|
INSERT INTO oa_mail_send_draft(
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create
|
||
|
) VALUES(
|
||
|
#{mailId}, #{recipientIds}, #{recipientNames}, #{copyForIds}, #{copyForNames}, #{secretIds}, #{secretNames},
|
||
|
#{title}, #{mailFiles}, #{contentRich}, #{content}, #{creator}, #{gmtCreate}
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 草稿箱列表 -->
|
||
|
<select id="listDraftMail" parameterType="map" resultMap="mailSendDTO">
|
||
|
SELECT
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create
|
||
|
FROM
|
||
|
oa_mail_send_draft
|
||
|
WHERE
|
||
|
creator = #{creator}
|
||
|
<if test="keywords != null and keywords != ''">
|
||
|
AND (
|
||
|
recipient_names like CONCAT('%', CONCAT(#{keywords}, '%'))
|
||
|
OR
|
||
|
title like CONCAT('%', CONCAT(#{keywords}, '%'))
|
||
|
)
|
||
|
</if>
|
||
|
ORDER BY gmt_create DESC
|
||
|
</select>
|
||
|
|
||
|
<!-- 草稿箱详情 -->
|
||
|
<select id="getDraftMail" parameterType="map" resultMap="mailSendDTO">
|
||
|
SELECT
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create
|
||
|
FROM
|
||
|
oa_mail_send_draft
|
||
|
WHERE
|
||
|
mail_id = #{mailId}
|
||
|
</select>
|
||
|
|
||
|
<!-- 修改草稿 -->
|
||
|
<update id="updateDraftMail" parameterType="map">
|
||
|
UPDATE oa_mail_send_draft SET
|
||
|
mail_id = #{mailId}
|
||
|
<if test="recipientIds != null and recipientIds != ''">
|
||
|
,recipient_ids = #{recipientIds}
|
||
|
</if>
|
||
|
<if test="recipientNames != null and recipientNames != ''">
|
||
|
,recipient_names = #{recipientNames}
|
||
|
</if>
|
||
|
<if test="copyForIds != null and copyForIds != ''">
|
||
|
,copy_for_ids = #{copyForIds}
|
||
|
</if>
|
||
|
<if test="copyForNames != null and copyForNames != ''">
|
||
|
,copy_for_names = #{copyForNames}
|
||
|
</if>
|
||
|
<if test="secretIds != null and secretIds != ''">
|
||
|
,secret_ids = #{secretIds}
|
||
|
</if>
|
||
|
<if test="secretNames != null and secretNames != ''">
|
||
|
,secret_names = #{secretNames}
|
||
|
</if>
|
||
|
<if test="title != null and title != ''">
|
||
|
,title = #{title}
|
||
|
</if>
|
||
|
<if test="mailFiles != null and mailFiles != ''">
|
||
|
,mail_files = #{mailFiles}
|
||
|
</if>
|
||
|
<if test="contentRich != null and contentRich != ''">
|
||
|
,content_rich = #{contentRich}
|
||
|
</if>
|
||
|
<if test="content != null and content != ''">
|
||
|
,content = #{content}
|
||
|
</if>
|
||
|
<if test="gmtCreate != null and gmtCreate != ''">
|
||
|
,gmt_create = #{gmtCreate}
|
||
|
</if>
|
||
|
WHERE
|
||
|
mail_id = #{mailId}
|
||
|
</update>
|
||
|
|
||
|
<!-- 删除草稿 -->
|
||
|
<delete id="deleteDraftMail" parameterType="string">
|
||
|
DELETE FROM oa_mail_send_draft
|
||
|
WHERE
|
||
|
FIND_IN_SET(mail_id, #{mailIds})
|
||
|
</delete>
|
||
|
|
||
|
<!-- 删除发件箱 -->
|
||
|
<delete id="deleteSendMail" parameterType="string">
|
||
|
DELETE FROM oa_mail_send
|
||
|
WHERE
|
||
|
FIND_IN_SET(mail_id, #{mailIds})
|
||
|
</delete>
|
||
|
|
||
|
<!-- 删除收件箱 -->
|
||
|
<delete id="deleteInboxMail" parameterType="string">
|
||
|
DELETE FROM oa_mail_inbox
|
||
|
WHERE
|
||
|
FIND_IN_SET(id, #{ids})
|
||
|
</delete>
|
||
|
|
||
|
<!-- 删除收件箱 -->
|
||
|
<delete id="deleteDelMail" parameterType="string">
|
||
|
DELETE FROM oa_mail_del
|
||
|
WHERE
|
||
|
FIND_IN_SET(id, #{ids})
|
||
|
</delete>
|
||
|
|
||
|
<!-- 垃圾箱保存 -->
|
||
|
<insert id="saveDelMail" parameterType="map">
|
||
|
INSERT INTO oa_mail_del (
|
||
|
mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create, source_from, del_user_id, del_time
|
||
|
) VALUES(
|
||
|
#{mailId}, #{recipientIds}, #{recipientNames}, #{copyForIds}, #{copyForNames}, #{secretIds}, #{secretNames},
|
||
|
#{title}, #{mailFiles}, #{contentRich}, #{content}, #{creator}, #{gmtCreate}, #{sourceFrom}, #{delUserId}, #{delTime}
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 垃圾箱分页列表 -->
|
||
|
<select id="listDelMail" parameterType="map" resultMap="mailDelDTO">
|
||
|
SELECT
|
||
|
id, mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create, source_from, del_user_id, del_time
|
||
|
FROM
|
||
|
oa_mail_del
|
||
|
WHERE
|
||
|
del_user_id = #{delUserId}
|
||
|
<if test="keywords != null and keywords != ''">
|
||
|
AND (
|
||
|
recipient_names like CONCAT('%', CONCAT(#{keywords}, '%'))
|
||
|
OR
|
||
|
title like CONCAT('%', CONCAT(#{keywords}, '%'))
|
||
|
)
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 垃圾箱详情 -->
|
||
|
<select id="getDelMail" parameterType="map" resultMap="mailDelDTO">
|
||
|
SELECT
|
||
|
id, mail_id, recipient_ids, recipient_names, copy_for_ids, copy_for_names, secret_ids, secret_names,
|
||
|
title, mail_files, content_rich, content, creator, gmt_create, source_from, del_user_id, del_time
|
||
|
FROM
|
||
|
oa_mail_del
|
||
|
WHERE
|
||
|
id = #{id}
|
||
|
</select>
|
||
|
</mapper>
|