EmailParseInfoMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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="fail_reason" property="failReason"/>
  14. <result column="isvalid" property="isvalid"/>
  15. <result column="creatorid" property="creatorId"/>
  16. <result column="createtime" property="createTime"/>
  17. <result column="updaterid" property="updaterId"/>
  18. <result column="updatetime" property="updateTime"/>
  19. <result column="sender_email" property="senderEmail"/>
  20. </resultMap>
  21. <insert id="insert" parameterType="com.simuwang.base.pojo.dos.EmailParseInfoDO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  22. insert into PPW_EMAIL.email_parse_info(email, sender_email, email_date, parse_date, email_title, email_type, parse_status,
  23. isvalid, creatorid, createtime, updaterid, updatetime)
  24. values (#{itemDo.email}, #{itemDo.senderEmail}, #{itemDo.emailDate}, #{itemDo.parseDate}, #{itemDo.emailTitle}, #{itemDo.emailType}, #{itemDo.parseStatus},
  25. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
  26. </insert>
  27. <update id="updateParseStatus">
  28. update PPW_EMAIL.email_parse_info
  29. set parse_status = #{parseStatus},
  30. fail_reason = #{failReason}
  31. where isvalid = 1
  32. and id = #{id}
  33. </update>
  34. <sql id="selectEmailParse">
  35. SELECT
  36. epi.id,
  37. epi.email,
  38. epi.email_date,
  39. epi.parse_date,
  40. epi.email_title,
  41. epi.email_type,
  42. epi.parse_status,
  43. epi.fail_reason,
  44. epi.isvalid,
  45. epi.creatorid,
  46. epi.createtime,
  47. epi.updatetime,
  48. epi.updaterid,
  49. epi.sender_email
  50. FROM
  51. PPW_EMAIL.email_parse_info epi
  52. </sql>
  53. <!-- 查询条件 -->
  54. <sql id="sqlwhereSearch">
  55. <where>
  56. epi.isvalid=1
  57. <if test="emailTitle !=null and emailTitle !=''">
  58. and epi.email_title like concat('%',#{emailTitle},'%')
  59. </if>
  60. <if test="emailType !=null">
  61. and epi.email_type = #{emailType}
  62. </if>
  63. <if test="parseStatus !=null">
  64. and epi.parse_status = #{parseStatus}
  65. </if>
  66. <if test="startDate !=null and startDate != ''">
  67. and epi.parse_date <![CDATA[ >= ]]> #{startDate}
  68. </if>
  69. <if test="endDate !=null and endDate != ''">
  70. and epi.parse_date <![CDATA[ <= ]]> #{endDate}
  71. </if>
  72. <if test="emailStartDate !=null and emailStartDate != ''">
  73. and epi.email_date <![CDATA[ >= ]]> #{emailStartDate}
  74. </if>
  75. <if test="emailEndDate !=null and emailEndDate != ''">
  76. and epi.email_date <![CDATA[ <= ]]> #{emailEndDate}
  77. </if>
  78. <if test="id !=null">
  79. and epi.id = #{id}
  80. </if>
  81. <if test="email !=null and email !=''">
  82. and epi.email like concat('%',#{email},'%')
  83. </if>
  84. <if test="senderEmail !=null and senderEmail !=''">
  85. and epi.sender_email like concat('%',#{senderEmail},'%')
  86. </if>
  87. </where>
  88. </sql>
  89. <select id="searchEmailList" resultMap="BaseResultMap">
  90. <include refid="selectEmailParse"/>
  91. <include refid="sqlwhereSearch"/>
  92. order by epi.parse_date desc
  93. limit #{offset},#{pageSize}
  94. </select>
  95. <select id="searchEmailById" resultMap="BaseResultMap">
  96. <include refid="selectEmailParse"/>
  97. where epi.isvalid =1 and epi.id =#{id}
  98. </select>
  99. <select id="searchEmailCount" resultType="java.lang.Integer">
  100. select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
  101. <if test="parseStatus != null and parseStatus != -1">
  102. and parse_status=#{parseStatus}
  103. </if>
  104. <if test="parseStatus != null and parseStatus == -1">
  105. and parse_status != 1
  106. </if>
  107. <if test="startDate != null and startDate != ''">
  108. and parse_date >= #{startDate}
  109. </if>
  110. <if test="endDate != null and endDate != ''">
  111. and parse_date <![CDATA[ <= ]]> #{endDate}
  112. </if>
  113. </select>
  114. <select id="queryById" resultMap="BaseResultMap">
  115. select id, email, email_date, parse_date, email_title, email_type, sender_email
  116. from PPW_EMAIL.email_parse_info
  117. where isvalid = 1
  118. and id = #{id}
  119. </select>
  120. <select id="countEmailList" resultType="java.lang.Long"
  121. parameterType="com.simuwang.base.pojo.dto.query.EmailParseQuery">
  122. select count(*) from PPW_EMAIL.email_parse_info epi
  123. <include refid="sqlwhereSearch"/>
  124. </select>
  125. <update id="updateParseTime">
  126. update PPW_EMAIL.email_parse_info
  127. set updatetime = #{parseDate},
  128. parse_date = #{parseDate}
  129. where isvalid = 1
  130. and id = #{id}
  131. </update>
  132. <select id="queryValuationEmailByFileId" resultType="com.simuwang.base.pojo.dto.EmailInfoDTO">
  133. select t1.id as id,
  134. t1.email as email,
  135. t1.email_date as emailDate,
  136. t1.email_title as emailTitle,
  137. t1.email_type as emailType,
  138. t2.id as fileId,
  139. t2.file_name as fileName,
  140. t2.file_path as filePath
  141. from PPW_EMAIL.email_parse_info t1
  142. join PPW_EMAIL.email_file_info t2 on t1.id = t2.email_id and t2.isvalid = 1
  143. where t1.isvalid = 1
  144. and t1.email_type = 2
  145. and t2.id in
  146. <foreach collection="fileIdList" item="fileId" index="index" open="(" separator="," close=")">
  147. #{fileId}
  148. </foreach>
  149. </select>
  150. <select id="searchEmailDataBoard" resultType="java.util.Map"
  151. parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
  152. select parse_status as "parse_status",count(id) as "total" from PPW_EMAIL.email_parse_info
  153. where isvalid=1
  154. <if test="startDate != null and startDate != ''">
  155. and email_date >= #{startDate}
  156. </if>
  157. <if test="endDate != null and endDate != ''">
  158. and email_date <![CDATA[ <= ]]> #{endDate}
  159. </if>
  160. <if test="email !=null and email !=''">
  161. and email like concat('%',#{email},'%')
  162. </if>
  163. <if test="senderEmail !=null and senderEmail !=''">
  164. and sender_email like concat('%',#{senderEmail},'%')
  165. </if>
  166. <if test="emailType !=null">
  167. and email_type = #{emailType}
  168. </if>
  169. group by parse_status
  170. </select>
  171. <select id="searchEmailTypeCount" resultType="java.util.Map"
  172. parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
  173. select email_type as "email_type",count(id) as "total" from PPW_EMAIL.email_parse_info
  174. where isvalid=1
  175. <if test="startDate != null and startDate != ''">
  176. and email_date >= #{startDate}
  177. </if>
  178. <if test="endDate != null and endDate != ''">
  179. and email_date <![CDATA[ <= ]]> #{endDate}
  180. </if>
  181. <if test="email !=null and email !=''">
  182. and email like concat('%',#{email},'%')
  183. </if>
  184. <if test="senderEmail !=null and senderEmail !=''">
  185. and sender_email like concat('%',#{senderEmail},'%')
  186. </if>
  187. <if test="emailType !=null">
  188. and email_type = #{emailType}
  189. </if>
  190. group by email_type
  191. </select>
  192. <select id="countpdfNoData" resultType="java.lang.Long">
  193. select count(1) from PPW_EMAIL.email_parse_info
  194. where isvalid=1
  195. <if test="item.startDate != null and item.startDate != ''">
  196. and email_date >= #{item.startDate}
  197. </if>
  198. <if test="item.endDate != null and item.endDate != ''">
  199. and email_date <![CDATA[ <= ]]> #{item.endDate}
  200. </if>
  201. <if test="item.email !=null and item.email !=''">
  202. and email like concat('%',#{item.email},'%')
  203. </if>
  204. <if test="senderEmail !=null and senderEmail !=''">
  205. and sender_email like concat('%',#{senderEmail},'%')
  206. </if>
  207. <if test="item.emailType !=null">
  208. and email_type = #{item.emailType}
  209. </if>
  210. <if test="errorInfo !=null">
  211. and fail_reason like concat('%',#{errorInfo},'%')
  212. </if>
  213. </select>
  214. <select id="countEmailTotal" resultType="java.lang.Long">
  215. select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
  216. <if test="emailType !=null">
  217. and email_type = #{emailType}
  218. </if>
  219. </select>
  220. </mapper>