<?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.fs.qw.mapper.QwExternalErrRetryMapper">

    <resultMap type="QwExternalErrRetry" id="QwExternalErrRetryResult">
        <result property="id"    column="id"    />
        <result property="retryParams"    column="retry_params"    />
        <result property="takeState"    column="take_state"    />
        <result property="corpId"    column="corp_id"    />
        <result property="retryState"    column="retry_state"    />
        <result property="retryType"    column="retry_type"    />
        <result property="createTime"    column="create_time"    />
        <result property="retryNum"    column="retry_num"    />
        <result property="updateTime"    column="update_time"    />
        <result property="mark"    column="mark"    />
    </resultMap>

    <sql id="selectQwExternalErrRetryVo">
        select id, retry_params, take_state, corp_id, retry_state, retry_type, create_time, retry_num, update_time, mark from qw_external_err_retry
    </sql>

    <select id="selectQwExternalErrRetryList" parameterType="QwExternalErrRetry" resultMap="QwExternalErrRetryResult">
        <include refid="selectQwExternalErrRetryVo"/>
        <where>
            <if test="retryParams != null  and retryParams != ''"> and retry_params = #{retryParams}</if>
            <if test="takeState != null "> and take_state = #{takeState}</if>
            <if test="corpId != null  and corpId != ''"> and corp_id = #{corpId}</if>
            <if test="retryState != null "> and retry_state = #{retryState}</if>
            <if test="retryType != null "> and retry_type = #{retryType}</if>
            <if test="retryNum != null "> and retry_num = #{retryNum}</if>
            <if test="mark != null  and mark != ''"> and mark = #{mark}</if>
        </where>
    </select>

    <select id="selectQwExternalErrRetryById" parameterType="Long" resultMap="QwExternalErrRetryResult">
        <include refid="selectQwExternalErrRetryVo"/>
        where id = #{id}
    </select>

    <insert id="insertQwExternalErrRetry" parameterType="QwExternalErrRetry" useGeneratedKeys="true" keyProperty="id">
        insert into qw_external_err_retry
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="retryParams != null">retry_params,</if>
            <if test="takeState != null">take_state,</if>
            <if test="corpId != null">corp_id,</if>
            <if test="retryState != null">retry_state,</if>
            <if test="retryType != null">retry_type,</if>
            <if test="createTime != null">create_time,</if>
            <if test="retryNum != null">retry_num,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="mark != null">mark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="retryParams != null">#{retryParams},</if>
            <if test="takeState != null">#{takeState},</if>
            <if test="corpId != null">#{corpId},</if>
            <if test="retryState != null">#{retryState},</if>
            <if test="retryType != null">#{retryType},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="retryNum != null">#{retryNum},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="mark != null">#{mark},</if>
         </trim>
    </insert>

    <update id="updateQwExternalErrRetry" parameterType="QwExternalErrRetry">
        update qw_external_err_retry
        <trim prefix="SET" suffixOverrides=",">
            <if test="retryParams != null">retry_params = #{retryParams},</if>
            <if test="takeState != null">take_state = #{takeState},</if>
            <if test="corpId != null">corp_id = #{corpId},</if>
            <if test="retryState != null">retry_state = #{retryState},</if>
            <if test="retryType != null">retry_type = #{retryType},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="retryNum != null">retry_num = #{retryNum},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="mark != null">mark = #{mark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteQwExternalErrRetryById" parameterType="Long">
        delete from qw_external_err_retry where id = #{id}
    </delete>

    <delete id="deleteQwExternalErrRetryByIds" parameterType="String">
        delete from qw_external_err_retry where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
