<?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.xmomen.module.order.entity.mapper.TbReturnOrderMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.order.entity.TbReturnOrder" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="ORDER_NO" property="orderNo" jdbcType="VARCHAR" />
    <result column="RETURN_TIME" property="returnTime" jdbcType="TIMESTAMP" />
    <result column="RETURN_STATUS" property="returnStatus" jdbcType="INTEGER" />
    <result column="AUDIT_STATUS" property="auditStatus" jdbcType="INTEGER" />
    <result column="AUDIT_DATE" property="auditDate" jdbcType="TIMESTAMP" />
    <result column="AUDIT_USER_ID" property="auditUserId" jdbcType="INTEGER" />
    <result column="TAKE_GOODS_DATE" property="takeGoodsDate" jdbcType="TIMESTAMP" />
    <result column="TAKE_GOODS_USER_ID" property="takeGoodsUserId" jdbcType="INTEGER" />
    <result column="TAKE_GOODS_PHONE" property="takeGoodsPhone" jdbcType="VARCHAR" />
    <result column="RETURN_TOTAL_AMOUNT" property="returnTotalAmount" jdbcType="DECIMAL" />
    <result column="IS_NORMAL" property="isNormal" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    ID, ORDER_NO, RETURN_TIME, RETURN_STATUS, AUDIT_STATUS, AUDIT_DATE, AUDIT_USER_ID, 
    TAKE_GOODS_DATE, TAKE_GOODS_USER_ID, TAKE_GOODS_PHONE, RETURN_TOTAL_AMOUNT, IS_NORMAL
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.order.entity.TbReturnOrderExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tb_return_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.xmomen.module.order.entity.TbReturnOrderExample" >
    delete from tb_return_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.order.entity.TbReturnOrder" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into tb_return_order
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="orderNo != null" >
        ORDER_NO,
      </if>
      <if test="returnTime != null" >
        RETURN_TIME,
      </if>
      <if test="returnStatus != null" >
        RETURN_STATUS,
      </if>
      <if test="auditStatus != null" >
        AUDIT_STATUS,
      </if>
      <if test="auditDate != null" >
        AUDIT_DATE,
      </if>
      <if test="auditUserId != null" >
        AUDIT_USER_ID,
      </if>
      <if test="takeGoodsDate != null" >
        TAKE_GOODS_DATE,
      </if>
      <if test="takeGoodsUserId != null" >
        TAKE_GOODS_USER_ID,
      </if>
      <if test="takeGoodsPhone != null" >
        TAKE_GOODS_PHONE,
      </if>
      <if test="returnTotalAmount != null" >
        RETURN_TOTAL_AMOUNT,
      </if>
      <if test="isNormal != null" >
        IS_NORMAL,
      </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="returnTime != null" >
        #{returnTime,jdbcType=TIMESTAMP},
      </if>
      <if test="returnStatus != null" >
        #{returnStatus,jdbcType=INTEGER},
      </if>
      <if test="auditStatus != null" >
        #{auditStatus,jdbcType=INTEGER},
      </if>
      <if test="auditDate != null" >
        #{auditDate,jdbcType=TIMESTAMP},
      </if>
      <if test="auditUserId != null" >
        #{auditUserId,jdbcType=INTEGER},
      </if>
      <if test="takeGoodsDate != null" >
        #{takeGoodsDate,jdbcType=TIMESTAMP},
      </if>
      <if test="takeGoodsUserId != null" >
        #{takeGoodsUserId,jdbcType=INTEGER},
      </if>
      <if test="takeGoodsPhone != null" >
        #{takeGoodsPhone,jdbcType=VARCHAR},
      </if>
      <if test="returnTotalAmount != null" >
        #{returnTotalAmount,jdbcType=DECIMAL},
      </if>
      <if test="isNormal != null" >
        #{isNormal,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.order.entity.TbReturnOrderExample" resultType="java.lang.Integer" >
    select count(*) from tb_return_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update tb_return_order
    <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.returnTime != null" >
        RETURN_TIME = #{record.returnTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.returnStatus != null" >
        RETURN_STATUS = #{record.returnStatus,jdbcType=INTEGER},
      </if>
      <if test="record.auditStatus != null" >
        AUDIT_STATUS = #{record.auditStatus,jdbcType=INTEGER},
      </if>
      <if test="record.auditDate != null" >
        AUDIT_DATE = #{record.auditDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.auditUserId != null" >
        AUDIT_USER_ID = #{record.auditUserId,jdbcType=INTEGER},
      </if>
      <if test="record.takeGoodsDate != null" >
        TAKE_GOODS_DATE = #{record.takeGoodsDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.takeGoodsUserId != null" >
        TAKE_GOODS_USER_ID = #{record.takeGoodsUserId,jdbcType=INTEGER},
      </if>
      <if test="record.takeGoodsPhone != null" >
        TAKE_GOODS_PHONE = #{record.takeGoodsPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.returnTotalAmount != null" >
        RETURN_TOTAL_AMOUNT = #{record.returnTotalAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.isNormal != null" >
        IS_NORMAL = #{record.isNormal,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>