123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.simuwang.base.mapper.EmailParseInfoMapper">
- <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailParseInfoDO">
- <id column="id" property="id"/>
- <result column="email" property="email"/>
- <result column="sender_email" property="senderEmail"/>
- <result column="email_date" property="emailDate" />
- <result column="parse_date" property="parseDate" />
- <result column="email_title" property="emailTitle"/>
- <result column="email_type" property="emailType"/>
- <result column="parse_status" property="parseStatus"/>
- <result column="fail_reason" property="failReason"/>
- <result column="isvalid" property="isvalid"/>
- <result column="creatorid" property="creatorId"/>
- <result column="createtime" property="createTime"/>
- <result column="updaterid" property="updaterId"/>
- <result column="updatetime" property="updateTime"/>
- <result column="sender_email" property="senderEmail"/>
- </resultMap>
- <insert id="insert" parameterType="com.simuwang.base.pojo.dos.EmailParseInfoDO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
- insert into PPW_EMAIL.email_parse_info(email, sender_email, email_date, parse_date, email_title, email_type, parse_status,
- isvalid, creatorid, createtime, updaterid, updatetime)
- values (#{itemDo.email}, #{itemDo.senderEmail}, #{itemDo.emailDate}, #{itemDo.parseDate}, #{itemDo.emailTitle}, #{itemDo.emailType}, #{itemDo.parseStatus},
- #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
- </insert>
- <update id="updateParseStatus">
- update PPW_EMAIL.email_parse_info
- set parse_status = #{parseStatus},
- fail_reason = #{failReason}
- where isvalid = 1
- and id = #{id}
- </update>
- <sql id="selectEmailParse">
- SELECT
- epi.id,
- epi.email,
- epi.email_date,
- epi.parse_date,
- epi.email_title,
- epi.email_type,
- epi.parse_status,
- epi.fail_reason,
- epi.isvalid,
- epi.creatorid,
- epi.createtime,
- epi.updatetime,
- epi.updaterid,
- epi.sender_email
- FROM
- PPW_EMAIL.email_parse_info epi
- </sql>
- <!-- 查询条件 -->
- <sql id="sqlwhereSearch">
- <where>
- epi.isvalid=1
- <if test="emailTitle !=null and emailTitle !=''">
- and epi.email_title like concat('%',#{emailTitle},'%')
- </if>
- <if test="emailType !=null">
- and epi.email_type = #{emailType}
- </if>
- <if test="parseStatus !=null">
- and epi.parse_status = #{parseStatus}
- </if>
- <if test="startDate !=null and startDate != ''">
- and epi.parse_date <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="endDate !=null and endDate != ''">
- and epi.parse_date <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="emailStartDate !=null and emailStartDate != ''">
- and epi.email_date <![CDATA[ >= ]]> #{emailStartDate}
- </if>
- <if test="emailEndDate !=null and emailEndDate != ''">
- and epi.email_date <![CDATA[ <= ]]> #{emailEndDate}
- </if>
- <if test="id !=null">
- and epi.id = #{id}
- </if>
- <if test="email !=null and email !=''">
- and epi.email like concat('%',#{email},'%')
- </if>
- <if test="senderEmail !=null and senderEmail !=''">
- and epi.sender_email like concat('%',#{senderEmail},'%')
- </if>
- </where>
- </sql>
- <select id="searchEmailList" resultMap="BaseResultMap">
- <include refid="selectEmailParse"/>
- <include refid="sqlwhereSearch"/>
- <choose>
- <when test="sort != null and sort !='' and sort=='parseDate' and order != null and order !=''">
- order by epi.parse_date ${order}
- </when>
- <when test="sort != null and sort !='' and sort=='emailDate' and order != null and order !=''">
- order by epi.email_date ${order}
- </when>
- <otherwise>
- order by epi.parse_date desc
- </otherwise>
- </choose>
- limit #{offset},#{pageSize}
- </select>
- <select id="searchEmailById" resultMap="BaseResultMap">
- <include refid="selectEmailParse"/>
- where epi.isvalid =1 and epi.id =#{id}
- </select>
- <select id="searchEmailCount" resultType="java.lang.Integer">
- select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
- <if test="parseStatus != null and parseStatus != -1">
- and parse_status=#{parseStatus}
- </if>
- <if test="parseStatus != null and parseStatus == -1">
- and parse_status != 1
- </if>
- <if test="startDate != null and startDate != ''">
- and parse_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and parse_date <![CDATA[ <= ]]> #{endDate}
- </if>
- </select>
- <select id="queryById" resultMap="BaseResultMap">
- select id, email, email_date, parse_date, email_title, email_type, sender_email,parse_status
- from PPW_EMAIL.email_parse_info
- where isvalid = 1
- and id = #{id}
- </select>
- <select id="countEmailList" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.EmailParseQuery">
- select count(*) from PPW_EMAIL.email_parse_info epi
- <include refid="sqlwhereSearch"/>
- </select>
- <update id="updateParseTime">
- update PPW_EMAIL.email_parse_info
- set updatetime = #{parseDate},
- parse_date = #{parseDate}
- where isvalid = 1
- and id = #{id}
- </update>
- <select id="queryValuationEmailByFileId" resultType="com.simuwang.base.pojo.dto.EmailInfoDTO">
- select t1.id as id,
- t1.email as email,
- t1.email_date as emailDate,
- t1.email_title as emailTitle,
- t1.email_type as emailType,
- t2.id as fileId,
- t2.file_name as fileName,
- t2.file_path as filePath
- from PPW_EMAIL.email_parse_info t1
- join PPW_EMAIL.email_file_info t2 on t1.id = t2.email_id and t2.isvalid = 1
- where t1.isvalid = 1
- and t1.email_type = 2
- and t2.id in
- <foreach collection="fileIdList" item="fileId" index="index" open="(" separator="," close=")">
- #{fileId}
- </foreach>
- </select>
- <select id="searchEmailDataBoard" resultType="java.util.Map"
- parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
- select parse_status as "parse_status",count(id) as "total" from PPW_EMAIL.email_parse_info
- where isvalid=1
- <if test="startDate != null and startDate != ''">
- and email_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and email_date <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="email !=null and email !=''">
- and email like concat('%',#{email},'%')
- </if>
- <if test="senderEmail !=null and senderEmail !=''">
- and sender_email like concat('%',#{senderEmail},'%')
- </if>
- <if test="emailType !=null">
- and email_type = #{emailType}
- </if>
- group by parse_status
- order by parse_status
- </select>
- <select id="searchEmailTypeCount" resultType="java.util.Map"
- parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
- select email_type as "email_type",count(id) as "total" from PPW_EMAIL.email_parse_info
- where isvalid=1
- <if test="startDate != null and startDate != ''">
- and email_date >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and email_date <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="email !=null and email !=''">
- and email like concat('%',#{email},'%')
- </if>
- <if test="senderEmail !=null and senderEmail !=''">
- and sender_email like concat('%',#{senderEmail},'%')
- </if>
- group by email_type
- order by email_type
- </select>
- <select id="countpdfNoData" resultType="java.lang.Long">
- select count(1) from PPW_EMAIL.email_parse_info
- where isvalid=1
- <if test="item.startDate != null and item.startDate != ''">
- and email_date >= #{item.startDate}
- </if>
- <if test="item.endDate != null and item.endDate != ''">
- and email_date <![CDATA[ <= ]]> #{item.endDate}
- </if>
- <if test="item.email !=null and item.email !=''">
- and email like concat('%',#{item.email},'%')
- </if>
- <if test="item.senderEmail !=null and item.senderEmail !=''">
- and sender_email like concat('%',#{item.senderEmail},'%')
- </if>
- <if test="item.emailType !=null">
- and email_type = #{item.emailType}
- </if>
- <if test="errorInfo !=null">
- and fail_reason like concat('%',#{errorInfo},'%')
- </if>
- </select>
- <select id="countEmailTotal" resultType="java.lang.Long">
- select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
- <if test="emailType !=null">
- and email_type = #{emailType}
- </if>
- </select>
- </mapper>
|