<?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.zm.order.tool.server.dao.OrderSyncErrorDao">
  <resultMap id="BaseResultMap" type="com.zm.order.tool.server.model.OrderSyncError">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="biz_type" jdbcType="INTEGER" property="bizType" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="order_id" jdbcType="BIGINT" property="orderId" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
    <result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
    <result column="db_index" jdbcType="INTEGER" property="dbIndex" />
    <result column="tb_index" jdbcType="INTEGER" property="tbIndex" />
    <result column="type" jdbcType="INTEGER" property="type" />
  </resultMap>
  <sql id="Base_Column_List">
    id, order_no, biz_type, user_id, order_id, created_at, updated_at, is_deleted, db_index,
    tb_index,type
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from order_sync_error
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from order_sync_error
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.zm.order.tool.server.model.OrderSyncError">
    insert into order_sync_error (id, order_no, biz_type, 
      user_id, order_id, created_at, 
      updated_at, is_deleted, db_index, 
      tb_index,type)
    values (#{id,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, #{bizType,jdbcType=INTEGER}, 
      #{userId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, now(), now(), 0, 0, 0,#{type})
  </insert>
  <insert id="insertSelective" parameterType="com.zm.order.tool.server.model.OrderSyncError">
    insert into order_sync_error
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="bizType != null">
        biz_type,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="orderId != null">
        order_id,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
      <if test="isDeleted != null">
        is_deleted,
      </if>
      <if test="dbIndex != null">
        db_index,
      </if>
      <if test="tbIndex != null">
        tb_index,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="bizType != null">
        #{bizType,jdbcType=INTEGER},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null">
        #{orderId,jdbcType=BIGINT},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="isDeleted != null">
        #{isDeleted,jdbcType=INTEGER},
      </if>
      <if test="dbIndex != null">
        #{dbIndex,jdbcType=INTEGER},
      </if>
      <if test="tbIndex != null">
        #{tbIndex,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.zm.order.tool.server.model.OrderSyncError">
    update order_sync_error
    <set>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="bizType != null">
        biz_type = #{bizType,jdbcType=INTEGER},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="orderId != null">
        order_id = #{orderId,jdbcType=BIGINT},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="isDeleted != null">
        is_deleted = #{isDeleted,jdbcType=INTEGER},
      </if>
      <if test="dbIndex != null">
        db_index = #{dbIndex,jdbcType=INTEGER},
      </if>
      <if test="tbIndex != null">
        tb_index = #{tbIndex,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zm.order.tool.server.model.OrderSyncError">
    update order_sync_error
    set order_no = #{orderNo,jdbcType=VARCHAR},
      biz_type = #{bizType,jdbcType=INTEGER},
      user_id = #{userId,jdbcType=BIGINT},
      order_id = #{orderId,jdbcType=BIGINT},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      is_deleted = #{isDeleted,jdbcType=INTEGER},
      db_index = #{dbIndex,jdbcType=INTEGER},
      tb_index = #{tbIndex,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>