Commit aeb05cca by chentianzhong

搜索邮件

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