Commit aeb05cca by chentianzhong

搜索邮件

parent 4ced4205
......@@ -16,7 +16,7 @@ public enum EmailFolderEnum {
FOLDER_OUTBOX(3, "草稿箱"),
FOLDER_ALREADY_SEND(4, "已发送"),
FOLDER_ALREADY_DELETE(5, "回收站"),
FOLDER_OTHER(6, "邮箱(文件夹)"),
FOLDER_OTHER(6, "我的文件夹"),
FOLDER_MANAGE(7, "邮件管理"),
;
......
......@@ -50,8 +50,6 @@ public class EmailSearchReqVo extends PageReqVo {
private Integer isPerson ;
@ApiModelProperty("当前人员id :前端不用传")
private Long userId;
@ApiModelProperty("是否获取人员头像")
private Boolean isSenderPhoto = false;
......
......@@ -2,4 +2,5 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zq.email.mapper.EmailFolderMapper">
</mapper>
......@@ -4,7 +4,7 @@
<select id="selectSearchTotal" resultType="integer" parameterType="com.zq.email.vo.EmailSearchReqVo">
SELECT
COUNT(1)
COUNT(EP."ID")
FROM
"EMAIL_PERSON" EP
<where>
......@@ -36,19 +36,18 @@
AND EP."SEND_TIME" &lt;= #{s.endTime}
</if>
<!-- 已发送,收件人 -->
<!-- <if test="s.receiveUserId != null">-->
<!-- AND EP."ID" IN(-->
<!-- SELECT-->
<!-- EP2."ID"-->
<!-- FROM-->
<!-- "EMAIL_PERSON" EP2-->
<!-- WHERE-->
<!-- EP2."PERSON_TYPE" = 2-->
<!-- AND EP2."IS_SEND" = 1-->
<!-- AND EP2."USER_ID" = #{s.receiveUserId}-->
<!-- )-->
<!-- </if>-->
<if test="s.receiveUserId != null">
AND EP."EMAIL_CONTENT_ID" IN(
SELECT
EP2."EMAIL_CONTENT_ID"
FROM
"EMAIL_PERSON" EP2
WHERE
EP2."PERSON_TYPE" = 2
AND EP2."IS_SEND" = 1
AND EP2."USER_ID" = #{s.receiveUserId}
)
</if>
<!-- 其他文件夹,发件人、标题、内容 -->
<if test="s.sendUserId != null or (s.title!=null and s.title!='') or (s.content!=null and s.content!='')">
......@@ -84,92 +83,101 @@
)
</if>
</where>
GROUP BY EP.id
</select>
<select id="selectSearchPage" resultType="com.zq.email.entity.EmailPerson" parameterType="com.zq.email.vo.EmailSearchReqVo">
SELECT
EP.*
EP1.*
FROM
"EMAIL_PERSON" EP
<where>
<if test="s.folderId != null">
AND EP."FOLDER_ID" = #{s.folderId}
</if>
<if test="s.isPerson != null">
AND EP."IS_PERSON" = #{s.isPerson}
</if>
<if test="s.isSend != null">
AND EP."IS_SEND" = #{s.isSend}
</if>
<if test="s.personType != null">
AND EP."PERSON_TYPE" = #{s.personType}
</if>
<if test="s.userId != null">
AND EP."USER_ID" = #{s.userId}
</if>
<if test="s.isRead != null">
AND EP."IS_READ" = #{s.isRead}
</if>
<if test="s.startTime != null and s.endTime!=null ">
AND EP."SEND_TIME" &gt;= #{s.startTime}
AND EP."SEND_TIME" &lt;= #{s.endTime}
</if>
<!-- 已发送,收件人 -->
<!-- <if test="s.receiveUserId != null">-->
<!-- AND EP."ID" IN(-->
<!-- SELECT-->
<!-- EP2."ID"-->
<!-- FROM-->
<!-- "EMAIL_PERSON" EP2-->
<!-- WHERE-->
<!-- EP2."PERSON_TYPE" = 2-->
<!-- AND EP2."IS_SEND" = 1-->
<!-- AND EP2."USER_ID" = #{s.receiveUserId}-->
<!-- )-->
<!-- </if>-->
<if test="s.sendUserId != null or (s.title!=null and s.title!='') or (s.content!=null and s.content!='')">
AND EP."EMAIL_CONTENT_ID" IN(
SELECT
EC."ID"
FROM
"EMAIL_CONTENT" EC
<where>
<if test="s.sendUserId != null">
AND EC."SEND_USER_ID" = #{s.sendUserId}
</if>
<if test="s.title != null and s.title !='' ">
AND EC."TITLE" LIKE concat('%', #{s.title}, '%')
</if>
<if test="s.content != null and s.content !='' ">
AND EC."CONTENT" LIKE concat('%', #{s.content}, '%')
</if>
</where>
)
</if>
<if test="s.attachName!=null and s.attachName!=''">
AND EP."EMAIL_CONTENT_ID" IN(
"EMAIL_PERSON" EP1
WHERE
EP1."ID" IN
(
SELECT
EP."ID"
FROM
"EMAIL_PERSON" EP
<where>
<if test="s.folderId != null">
AND EP."FOLDER_ID" = #{s.folderId}
</if>
<if test="s.isPerson != null">
AND EP."IS_PERSON" = #{s.isPerson}
</if>
<if test="s.isSend != null">
AND EP."IS_SEND" = #{s.isSend}
</if>
<if test="s.personType != null">
AND EP."PERSON_TYPE" = #{s.personType}
</if>
<if test="s.userId != null">
AND EP."USER_ID" = #{s.userId}
</if>
<if test="s.isRead != null">
AND EP."IS_READ" = #{s.isRead}
</if>
<if test="s.startTime != null and s.endTime!=null ">
AND EP."SEND_TIME" &gt;= #{s.startTime}
AND EP."SEND_TIME" &lt;= #{s.endTime}
</if>
<if test="s.receiveUserId != null">
AND EP."EMAIL_CONTENT_ID" IN(
SELECT
EA."EMAIL_CONTENT_ID"
EP2."EMAIL_CONTENT_ID"
FROM
"EMAIL_ATTACH" EA
"EMAIL_PERSON" EP2
WHERE
EA."ATTACH_NAME" LIKE concat('%', #{s.attachName}, '%')
)
</if>
</where>
ORDER BY EP."SEND_TIME" DESC
EP2."PERSON_TYPE" = 2
AND EP2."IS_SEND" = 1
AND EP2."USER_ID" = #{s.receiveUserId}
)
</if>
<if test="s.sendUserId != null or (s.title!=null and s.title!='') or (s.content!=null and s.content!='')">
AND EP."EMAIL_CONTENT_ID" IN(
SELECT
EC."ID"
FROM
"EMAIL_CONTENT" EC
<where>
<if test="s.sendUserId != null">
AND EC."SEND_USER_ID" = #{s.sendUserId}
</if>
<if test="s.title != null and s.title !='' ">
AND EC."TITLE" LIKE concat('%', #{s.title}, '%')
</if>
<if test="s.content != null and s.content !='' ">
AND EC."CONTENT" LIKE concat('%', #{s.content}, '%')
</if>
</where>
)
</if>
<if test="s.attachName!=null and s.attachName!=''">
AND EP."EMAIL_CONTENT_ID" IN(
SELECT
EA."EMAIL_CONTENT_ID"
FROM
"EMAIL_ATTACH" EA
WHERE
EA."ATTACH_NAME" LIKE concat('%', #{s.attachName}, '%')
)
</if>
</where>
GROUP BY EP."ID"
)
ORDER BY EP1."SEND_TIME" DESC
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment