EmailParseInfoMapper.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. <choose>
  93. <when test="sort != null and sort !='' and sort=='parseDate' and order != null and order !=''">
  94. order by epi.parse_date ${order}
  95. </when>
  96. <when test="sort != null and sort !='' and sort=='emailDate' and order != null and order !=''">
  97. order by epi.email_date ${order}
  98. </when>
  99. <otherwise>
  100. order by epi.parse_date desc
  101. </otherwise>
  102. </choose>
  103. limit #{offset},#{pageSize}
  104. </select>
  105. <select id="searchEmailById" resultMap="BaseResultMap">
  106. <include refid="selectEmailParse"/>
  107. where epi.isvalid =1 and epi.id =#{id}
  108. </select>
  109. <select id="searchEmailCount" resultType="java.lang.Integer">
  110. select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
  111. <if test="parseStatus != null and parseStatus != -1">
  112. and parse_status=#{parseStatus}
  113. </if>
  114. <if test="parseStatus != null and parseStatus == -1">
  115. and parse_status != 1
  116. </if>
  117. <if test="startDate != null and startDate != ''">
  118. and parse_date >= #{startDate}
  119. </if>
  120. <if test="endDate != null and endDate != ''">
  121. and parse_date <![CDATA[ <= ]]> #{endDate}
  122. </if>
  123. </select>
  124. <select id="queryById" resultMap="BaseResultMap">
  125. select id, email, email_date, parse_date, email_title, email_type, sender_email,parse_status
  126. from PPW_EMAIL.email_parse_info
  127. where isvalid = 1
  128. and id = #{id}
  129. </select>
  130. <select id="countEmailList" resultType="java.lang.Long"
  131. parameterType="com.simuwang.base.pojo.dto.query.EmailParseQuery">
  132. select count(*) from PPW_EMAIL.email_parse_info epi
  133. <include refid="sqlwhereSearch"/>
  134. </select>
  135. <update id="updateParseTime">
  136. update PPW_EMAIL.email_parse_info
  137. set updatetime = #{parseDate},
  138. parse_date = #{parseDate}
  139. where isvalid = 1
  140. and id = #{id}
  141. </update>
  142. <select id="queryValuationEmailByFileId" resultType="com.simuwang.base.pojo.dto.EmailInfoDTO">
  143. select t1.id as id,
  144. t1.email as email,
  145. t1.email_date as emailDate,
  146. t1.email_title as emailTitle,
  147. t1.email_type as emailType,
  148. t2.id as fileId,
  149. t2.file_name as fileName,
  150. t2.file_path as filePath
  151. from PPW_EMAIL.email_parse_info t1
  152. join PPW_EMAIL.email_file_info t2 on t1.id = t2.email_id and t2.isvalid = 1
  153. where t1.isvalid = 1
  154. and t1.email_type = 2
  155. and t2.id in
  156. <foreach collection="fileIdList" item="fileId" index="index" open="(" separator="," close=")">
  157. #{fileId}
  158. </foreach>
  159. </select>
  160. <select id="searchEmailDataBoard" resultType="java.util.Map"
  161. parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
  162. select parse_status as "parse_status",count(id) as "total" from PPW_EMAIL.email_parse_info
  163. where isvalid=1
  164. <if test="startDate != null and startDate != ''">
  165. and email_date >= #{startDate}
  166. </if>
  167. <if test="endDate != null and endDate != ''">
  168. and email_date <![CDATA[ <= ]]> #{endDate}
  169. </if>
  170. <if test="email !=null and email !=''">
  171. and email like concat('%',#{email},'%')
  172. </if>
  173. <if test="senderEmail !=null and senderEmail !=''">
  174. and sender_email like concat('%',#{senderEmail},'%')
  175. </if>
  176. <if test="emailType !=null">
  177. and email_type = #{emailType}
  178. </if>
  179. group by parse_status
  180. order by parse_status
  181. </select>
  182. <select id="searchEmailTypeCount" resultType="java.util.Map"
  183. parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
  184. select email_type as "email_type",count(id) as "total" from PPW_EMAIL.email_parse_info
  185. where isvalid=1
  186. <if test="startDate != null and startDate != ''">
  187. and email_date >= #{startDate}
  188. </if>
  189. <if test="endDate != null and endDate != ''">
  190. and email_date <![CDATA[ <= ]]> #{endDate}
  191. </if>
  192. <if test="email !=null and email !=''">
  193. and email like concat('%',#{email},'%')
  194. </if>
  195. <if test="senderEmail !=null and senderEmail !=''">
  196. and sender_email like concat('%',#{senderEmail},'%')
  197. </if>
  198. group by email_type
  199. order by email_type
  200. </select>
  201. <select id="countpdfNoData" resultType="java.lang.Long">
  202. select count(1) from PPW_EMAIL.email_parse_info
  203. where isvalid=1
  204. <if test="item.startDate != null and item.startDate != ''">
  205. and email_date >= #{item.startDate}
  206. </if>
  207. <if test="item.endDate != null and item.endDate != ''">
  208. and email_date <![CDATA[ <= ]]> #{item.endDate}
  209. </if>
  210. <if test="item.email !=null and item.email !=''">
  211. and email like concat('%',#{item.email},'%')
  212. </if>
  213. <if test="item.senderEmail !=null and item.senderEmail !=''">
  214. and sender_email like concat('%',#{item.senderEmail},'%')
  215. </if>
  216. <if test="item.emailType !=null">
  217. and email_type = #{item.emailType}
  218. </if>
  219. <if test="errorInfo !=null">
  220. and fail_reason like concat('%',#{errorInfo},'%')
  221. </if>
  222. </select>
  223. <select id="countEmailTotal" resultType="java.lang.Long">
  224. select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
  225. <if test="emailType !=null">
  226. and email_type = #{emailType}
  227. </if>
  228. </select>
  229. </mapper>