<?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.goafanti.common.dao.TOrderBackMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderBack">
    <!--

      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="back_status" jdbcType="INTEGER" property="backStatus" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="initiate" jdbcType="VARCHAR" property="initiate" />
    <result column="accept" jdbcType="VARCHAR" property="accept" />
    <result column="reason" jdbcType="VARCHAR" property="reason" />
    <result column="result" jdbcType="VARCHAR" property="result" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.TOrderBack">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    <result column="reason_attachment_url" jdbcType="LONGVARCHAR" property="reasonAttachmentUrl" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    id, order_no, back_status, create_time, initiate, accept, reason, result
  </sql>
  <sql id="Blob_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    reason_attachment_url
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.goafanti.common.model.TOrderBackExample" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_order_back
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderBackExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_order_back
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_order_back
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    delete from t_order_back
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderBackExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    delete from t_order_back
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.TOrderBack">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    insert into t_order_back (id, order_no, back_status, 
      create_time, initiate, accept, 
      reason, result, reason_attachment_url
      )
    values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER}, 
      #{createTime,jdbcType=TIMESTAMP}, #{initiate,jdbcType=VARCHAR}, #{accept,jdbcType=VARCHAR}, 
      #{reason,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{reasonAttachmentUrl,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderBack">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    insert into t_order_back
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="backStatus != null">
        back_status,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="initiate != null">
        initiate,
      </if>
      <if test="accept != null">
        accept,
      </if>
      <if test="reason != null">
        reason,
      </if>
      <if test="result != null">
        result,
      </if>
      <if test="reasonAttachmentUrl != null">
        reason_attachment_url,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="backStatus != null">
        #{backStatus,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="initiate != null">
        #{initiate,jdbcType=VARCHAR},
      </if>
      <if test="accept != null">
        #{accept,jdbcType=VARCHAR},
      </if>
      <if test="reason != null">
        #{reason,jdbcType=VARCHAR},
      </if>
      <if test="result != null">
        #{result,jdbcType=VARCHAR},
      </if>
      <if test="reasonAttachmentUrl != null">
        #{reasonAttachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderBackExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    select count(*) from t_order_back
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    update t_order_back
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.orderNo != null">
        order_no = #{record.orderNo,jdbcType=VARCHAR},
      </if>
      <if test="record.backStatus != null">
        back_status = #{record.backStatus,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.initiate != null">
        initiate = #{record.initiate,jdbcType=VARCHAR},
      </if>
      <if test="record.accept != null">
        accept = #{record.accept,jdbcType=VARCHAR},
      </if>
      <if test="record.reason != null">
        reason = #{record.reason,jdbcType=VARCHAR},
      </if>
      <if test="record.result != null">
        result = #{record.result,jdbcType=VARCHAR},
      </if>
      <if test="record.reasonAttachmentUrl != null">
        reason_attachment_url = #{record.reasonAttachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    update t_order_back
    set id = #{record.id,jdbcType=INTEGER},
      order_no = #{record.orderNo,jdbcType=VARCHAR},
      back_status = #{record.backStatus,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      initiate = #{record.initiate,jdbcType=VARCHAR},
      accept = #{record.accept,jdbcType=VARCHAR},
      reason = #{record.reason,jdbcType=VARCHAR},
      result = #{record.result,jdbcType=VARCHAR},
      reason_attachment_url = #{record.reasonAttachmentUrl,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    update t_order_back
    set id = #{record.id,jdbcType=INTEGER},
      order_no = #{record.orderNo,jdbcType=VARCHAR},
      back_status = #{record.backStatus,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      initiate = #{record.initiate,jdbcType=VARCHAR},
      accept = #{record.accept,jdbcType=VARCHAR},
      reason = #{record.reason,jdbcType=VARCHAR},
      result = #{record.result,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderBack">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    update t_order_back
    <set>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="backStatus != null">
        back_status = #{backStatus,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="initiate != null">
        initiate = #{initiate,jdbcType=VARCHAR},
      </if>
      <if test="accept != null">
        accept = #{accept,jdbcType=VARCHAR},
      </if>
      <if test="reason != null">
        reason = #{reason,jdbcType=VARCHAR},
      </if>
      <if test="result != null">
        result = #{result,jdbcType=VARCHAR},
      </if>
      <if test="reasonAttachmentUrl != null">
        reason_attachment_url = #{reasonAttachmentUrl,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.TOrderBack">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    update t_order_back
    set order_no = #{orderNo,jdbcType=VARCHAR},
      back_status = #{backStatus,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      initiate = #{initiate,jdbcType=VARCHAR},
      accept = #{accept,jdbcType=VARCHAR},
      reason = #{reason,jdbcType=VARCHAR},
      result = #{result,jdbcType=VARCHAR},
      reason_attachment_url = #{reasonAttachmentUrl,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderBack">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 21 11:44:14 CST 2018.
    -->
    update t_order_back
    set order_no = #{orderNo,jdbcType=VARCHAR},
      back_status = #{backStatus,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      initiate = #{initiate,jdbcType=VARCHAR},
      accept = #{accept,jdbcType=VARCHAR},
      reason = #{reason,jdbcType=VARCHAR},
      result = #{result,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByOrderNoAndBackStatus" parameterType="java.lang.String">
  update t_order_back set back_status=1 where  back_status=0 and order_no= #{orderNo,jdbcType=VARCHAR} 

  </update>
</mapper>