<?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.dxhy.core.job.dao.TDxHttpLogJobDao">

    <!-- 保存 -->
    <insert id="insertHttpLog" useGeneratedKeys="true" keyProperty="logId" keyColumn="log_id"
            parameterType="com.dxhy.core.job.entity.TDxHttpLogJobEntity">
        insert into t_dx_http_log (taxno, type, req_date, req_text, res_date, res_text, status)
        values (#{taxno},
                #{type},
                #{reqDate ,jdbcType=TIMESTAMP},
                #{reqText},
                #{resDate,jdbcType=TIMESTAMP},
                #{resText},
                #{status})
    </insert>
    <select id="selectHttpLogById" resultType="com.dxhy.core.job.entity.TDxHttpLog">
        select log_id   logId,
               taxno,
               type,
               req_date reqDate,
               req_text reqText,
               res_date resDate,
               res_text resText,
               status
        from t_dx_http_log
        where log_id = #{httpLogId}
    </select>

    <update id="updateHttoLogById" parameterType="com.dxhy.core.job.entity.TDxHttpLog">
        update t_dx_http_log
        set status = #{status},
            total  =#{total}
        where log_id = #{logId}
    </update>

    <select id="getNotParseHttpLogs" resultType="com.dxhy.core.job.entity.TDxHttpLog">
        select log_id,
               taxno,
               type,
               req_date,
               req_text,
               res_date,
               res_text,
               status,
               company
        from t_dx_http_log
        where type = #{type}
          and status = '0'
          and taxno = #{taxno}
    </select>
    <select id="getNotParseTaxnos" resultType="java.lang.String">
        select taxno
        from t_dx_http_log
        where type = #{type}
          and status = '0'
        group by taxno
    </select>
    <update id="updateNotParseHttpLogsStatus">
        update t_dx_http_log set status='3'
        where log_id in
        <foreach collection="logs" index="index" item="item" open="(" separator="," close=")">
            #{item.logId}
        </foreach>
    </update>
</mapper>
