EmailParseInfoMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.simuwang.base.mapper.EmailParseInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailParseInfoDO">
  5. <id column="id" property="id"/>
  6. <result column="email" property="email"/>
  7. <result column="sender_email" property="senderEmail"/>
  8. <result column="email_date" property="emailDate" />
  9. <result column="parse_date" property="parseDate" />
  10. <result column="email_title" property="emailTitle"/>
  11. <result column="email_type" property="emailType"/>
  12. <result column="parse_status" property="parseStatus"/>
  13. <result column="isvalid" property="isvalid"/>
  14. <result column="creatorid" property="creatorId"/>
  15. <result column="createtime" property="createTime"/>
  16. <result column="updaterid" property="updaterId"/>
  17. <result column="updatetime" property="updateTime"/>
  18. <result column="sender_email" property="senderEmail"/>
  19. </resultMap>
  20. <insert id="insert" parameterType="com.simuwang.base.pojo.dos.EmailParseInfoDO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  21. insert into PPW_EMAIL.email_parse_info(email, sender_email, email_date, parse_date, email_title, email_type, parse_status,
  22. isvalid, creatorid, createtime, updaterid, updatetime)
  23. values (#{itemDo.email}, #{itemDo.senderEmail}, #{itemDo.emailDate}, #{itemDo.parseDate}, #{itemDo.emailTitle}, #{itemDo.emailType}, #{itemDo.parseStatus},
  24. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
  25. </insert>
  26. <update id="updateParseStatus">
  27. update PPW_EMAIL.email_parse_info
  28. set parse_status = #{parseStatus}
  29. where isvalid = 1
  30. and id = #{id}
  31. </update>
  32. <sql id="selectEmailParse">
  33. SELECT
  34. epi.id,
  35. epi.email,
  36. epi.email_date,
  37. epi.parse_date,
  38. epi.email_title,
  39. epi.email_type,
  40. epi.parse_status,
  41. epi.isvalid,
  42. epi.creatorid,
  43. epi.createtime,
  44. epi.updatetime,
  45. epi.updaterid,
  46. epi.sender_email
  47. FROM
  48. PPW_EMAIL.email_parse_info epi
  49. </sql>
  50. <!-- 查询条件 -->
  51. <sql id="sqlwhereSearch">
  52. <where>
  53. epi.isvalid=1
  54. <if test="emailTitle !=null and emailTitle !=''">
  55. and epi.email_title like concat('%',#{emailTitle},'%')
  56. </if>
  57. <if test="emailType !=null">
  58. and epi.email_type = #{emailType}
  59. </if>
  60. <if test="parseStatus !=null">
  61. and epi.parse_status = #{parseStatus}
  62. </if>
  63. <if test="startDate !=null and startDate != ''">
  64. and epi.parse_date <![CDATA[ >= ]]> #{startDate}
  65. </if>
  66. <if test="endDate !=null and endDate != ''">
  67. and epi.parse_date <![CDATA[ <= ]]> #{endDate}
  68. </if>
  69. <if test="emailStartDate !=null and emailStartDate != ''">
  70. and epi.email_date <![CDATA[ >= ]]> #{startDate}
  71. </if>
  72. <if test="emailEndDate !=null and emailEndDate != ''">
  73. and epi.email_date <![CDATA[ <= ]]> #{emailEndDate}
  74. </if>
  75. <if test="id !=null">
  76. and epi.id = #{id}
  77. </if>
  78. <if test="email !=null and email !=''">
  79. and epi.email like concat('%',#{email},'%')
  80. </if>
  81. <if test="senderEmail !=null and senderEmail !=''">
  82. and epi.sender_email like concat('%',#{senderEmail},'%')
  83. </if>
  84. </where>
  85. </sql>
  86. <select id="searchEmailList" resultMap="BaseResultMap">
  87. <include refid="selectEmailParse"/>
  88. <include refid="sqlwhereSearch"/>
  89. limit #{offset},#{pageSize}
  90. </select>
  91. <select id="searchEmailById" resultMap="BaseResultMap">
  92. <include refid="selectEmailParse"/>
  93. where epi.isvalid =1 and epi.id =#{id}
  94. </select>
  95. <select id="searchEmailCount" resultType="java.lang.Integer">
  96. select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
  97. <if test="parseStatus != null and parseStatus != -1">
  98. and parse_status=#{parseStatus}
  99. </if>
  100. <if test="parseStatus != null and parseStatus == -1">
  101. and parse_status != 1
  102. </if>
  103. <if test="startDate != null and startDate != ''">
  104. and parse_date >= #{startDate}
  105. </if>
  106. <if test="endDate != null and endDate != ''">
  107. and parse_date <![CDATA[ <= ]]> #{endDate}
  108. </if>
  109. </select>
  110. <select id="queryById" resultMap="BaseResultMap">
  111. select id, email, email_date, parse_date, email_title, email_type
  112. from PPW_EMAIL.email_parse_info
  113. where isvalid = 1
  114. and id = #{id}
  115. </select>
  116. <select id="countEmailList" resultType="java.lang.Long"
  117. parameterType="com.simuwang.base.pojo.dto.query.EmailParseQuery">
  118. select count(*) from PPW_EMAIL.email_parse_info epi
  119. <include refid="sqlwhereSearch"/>
  120. </select>
  121. <update id="updateParseTime">
  122. update PPW_EMAIL.email_parse_info
  123. set updatetime = #{parseDate},
  124. parse_date = #{parseDate}
  125. where isvalid = 1
  126. and id = #{id}
  127. </update>
  128. <select id="queryValuationEmailByFileId" resultType="com.simuwang.base.pojo.dto.EmailInfoDTO">
  129. select t1.id as id,
  130. t1.email as email,
  131. t1.email_date as emailDate,
  132. t1.email_title as emailTitle,
  133. t1.email_type as emailType,
  134. t2.id as fileId,
  135. t2.file_name as fileName,
  136. t2.file_path as filePath
  137. from PPW_EMAIL.email_parse_info t1
  138. join PPW_EMAIL.email_file_info t2 on t1.id = t2.email_id and t2.isvalid = 1
  139. where t1.isvalid = 1
  140. and t1.email_type = 2
  141. and t2.id in
  142. <foreach collection="fileIdList" item="fileId" index="index" open="(" separator="," close=")">
  143. #{fileId}
  144. </foreach>
  145. </select>
  146. </mapper>