<?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.TbOrderMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.order.entity.TbOrder" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="ORDER_NO" property="orderNo" jdbcType="VARCHAR" />
    <result column="ORDER_TYPE" property="orderType" jdbcType="INTEGER" />
    <result column="ORDER_SOURCE" property="orderSource" jdbcType="INTEGER" />
    <result column="PAYMENT_MODE" property="paymentMode" jdbcType="INTEGER" />
    <result column="OTHER_PAYMENT_MODE" property="otherPaymentMode" jdbcType="INTEGER" />
    <result column="MEMBER_CODE" property="memberCode" jdbcType="VARCHAR" />
    <result column="ORDER_STATUS" property="orderStatus" jdbcType="VARCHAR" />
    <result column="PAY_STATUS" property="payStatus" jdbcType="INTEGER" />
    <result column="CONSIGNEE_PHONE" property="consigneePhone" jdbcType="VARCHAR" />
    <result column="CONSIGNEE_NAME" property="consigneeName" jdbcType="VARCHAR" />
    <result column="CONSIGNEE_ADDRESS" property="consigneeAddress" jdbcType="VARCHAR" />
    <result column="POSTCODE" property="postcode" jdbcType="VARCHAR" />
    <result column="TRANSPORT_MODE" property="transportMode" jdbcType="INTEGER" />
    <result column="REMARK" property="remark" jdbcType="VARCHAR" />
    <result column="DISCOUNT_PRICE" property="discountPrice" jdbcType="DECIMAL" />
    <result column="TOTAL_AMOUNT" property="totalAmount" jdbcType="DECIMAL" />
    <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
    <result column="APPOINTMENT_TIME" property="appointmentTime" jdbcType="TIMESTAMP" />
    <result column="CREATE_USER_ID" property="createUserId" jdbcType="INTEGER" />
    <result column="DESPATCH_EXPRESS_ID" property="despatchExpressId" jdbcType="INTEGER" />
    <result column="EXPRESS_MEMBER_ID" property="expressMemberId" jdbcType="INTEGER" />
    <result column="COMPANY_ID" property="companyId" jdbcType="INTEGER" />
    <result column="MANAGER_ID" property="managerId" jdbcType="INTEGER" />
    <result column="BATCH_NO" property="batchNo" jdbcType="VARCHAR" />
    <result column="TOTAL_BOX_NUM" property="totalBoxNum" jdbcType="INTEGER" />
    <result column="EXPRESS_SCAN_BOX_NUM" property="expressScanBoxNum" jdbcType="INTEGER" />
    <result column="XIAJIA" property="xiajia" jdbcType="INTEGER" />
    <result column="IS_TWO_SEND" property="isTwoSend" jdbcType="INTEGER" />
    <result column="TWO_SEND_AUDIT_DATE" property="twoSendAuditDate" jdbcType="TIMESTAMP" />
    <result column="TWO_SEND_AUDIT_USER_ID" property="twoSendAuditUserId" jdbcType="INTEGER" />
    <result column="OUT_DATE" property="outDate" jdbcType="TIMESTAMP" />
    <result column="SHOU_HUO_DATE" property="shouHuoDate" jdbcType="TIMESTAMP" />
    <result column="IS_REJECT" property="isReject" jdbcType="INTEGER" />
    <result column="UPDATE_DATE" property="updateDate" jdbcType="TIMESTAMP" />
    <result column="UPDATE_USER_ID" property="updateUserId" 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, ORDER_TYPE, ORDER_SOURCE, PAYMENT_MODE, OTHER_PAYMENT_MODE, MEMBER_CODE, 
    ORDER_STATUS, PAY_STATUS, CONSIGNEE_PHONE, CONSIGNEE_NAME, CONSIGNEE_ADDRESS, POSTCODE, 
    TRANSPORT_MODE, REMARK, DISCOUNT_PRICE, TOTAL_AMOUNT, CREATE_TIME, APPOINTMENT_TIME, 
    CREATE_USER_ID, DESPATCH_EXPRESS_ID, EXPRESS_MEMBER_ID, COMPANY_ID, MANAGER_ID, BATCH_NO, 
    TOTAL_BOX_NUM, EXPRESS_SCAN_BOX_NUM, XIAJIA, IS_TWO_SEND, TWO_SEND_AUDIT_DATE, TWO_SEND_AUDIT_USER_ID, 
    OUT_DATE, SHOU_HUO_DATE, IS_REJECT, UPDATE_DATE, UPDATE_USER_ID
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.order.entity.TbOrderExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tb_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.TbOrderExample" >
    delete from tb_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.order.entity.TbOrder" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into tb_order
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="orderNo != null" >
        ORDER_NO,
      </if>
      <if test="orderType != null" >
        ORDER_TYPE,
      </if>
      <if test="orderSource != null" >
        ORDER_SOURCE,
      </if>
      <if test="paymentMode != null" >
        PAYMENT_MODE,
      </if>
      <if test="otherPaymentMode != null" >
        OTHER_PAYMENT_MODE,
      </if>
      <if test="memberCode != null" >
        MEMBER_CODE,
      </if>
      <if test="orderStatus != null" >
        ORDER_STATUS,
      </if>
      <if test="payStatus != null" >
        PAY_STATUS,
      </if>
      <if test="consigneePhone != null" >
        CONSIGNEE_PHONE,
      </if>
      <if test="consigneeName != null" >
        CONSIGNEE_NAME,
      </if>
      <if test="consigneeAddress != null" >
        CONSIGNEE_ADDRESS,
      </if>
      <if test="postcode != null" >
        POSTCODE,
      </if>
      <if test="transportMode != null" >
        TRANSPORT_MODE,
      </if>
      <if test="remark != null" >
        REMARK,
      </if>
      <if test="discountPrice != null" >
        DISCOUNT_PRICE,
      </if>
      <if test="totalAmount != null" >
        TOTAL_AMOUNT,
      </if>
      <if test="createTime != null" >
        CREATE_TIME,
      </if>
      <if test="appointmentTime != null" >
        APPOINTMENT_TIME,
      </if>
      <if test="createUserId != null" >
        CREATE_USER_ID,
      </if>
      <if test="despatchExpressId != null" >
        DESPATCH_EXPRESS_ID,
      </if>
      <if test="expressMemberId != null" >
        EXPRESS_MEMBER_ID,
      </if>
      <if test="companyId != null" >
        COMPANY_ID,
      </if>
      <if test="managerId != null" >
        MANAGER_ID,
      </if>
      <if test="batchNo != null" >
        BATCH_NO,
      </if>
      <if test="totalBoxNum != null" >
        TOTAL_BOX_NUM,
      </if>
      <if test="expressScanBoxNum != null" >
        EXPRESS_SCAN_BOX_NUM,
      </if>
      <if test="xiajia != null" >
        XIAJIA,
      </if>
      <if test="isTwoSend != null" >
        IS_TWO_SEND,
      </if>
      <if test="twoSendAuditDate != null" >
        TWO_SEND_AUDIT_DATE,
      </if>
      <if test="twoSendAuditUserId != null" >
        TWO_SEND_AUDIT_USER_ID,
      </if>
      <if test="outDate != null" >
        OUT_DATE,
      </if>
      <if test="shouHuoDate != null" >
        SHOU_HUO_DATE,
      </if>
      <if test="isReject != null" >
        IS_REJECT,
      </if>
      <if test="updateDate != null" >
        UPDATE_DATE,
      </if>
      <if test="updateUserId != null" >
        UPDATE_USER_ID,
      </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="orderType != null" >
        #{orderType,jdbcType=INTEGER},
      </if>
      <if test="orderSource != null" >
        #{orderSource,jdbcType=INTEGER},
      </if>
      <if test="paymentMode != null" >
        #{paymentMode,jdbcType=INTEGER},
      </if>
      <if test="otherPaymentMode != null" >
        #{otherPaymentMode,jdbcType=INTEGER},
      </if>
      <if test="memberCode != null" >
        #{memberCode,jdbcType=VARCHAR},
      </if>
      <if test="orderStatus != null" >
        #{orderStatus,jdbcType=VARCHAR},
      </if>
      <if test="payStatus != null" >
        #{payStatus,jdbcType=INTEGER},
      </if>
      <if test="consigneePhone != null" >
        #{consigneePhone,jdbcType=VARCHAR},
      </if>
      <if test="consigneeName != null" >
        #{consigneeName,jdbcType=VARCHAR},
      </if>
      <if test="consigneeAddress != null" >
        #{consigneeAddress,jdbcType=VARCHAR},
      </if>
      <if test="postcode != null" >
        #{postcode,jdbcType=VARCHAR},
      </if>
      <if test="transportMode != null" >
        #{transportMode,jdbcType=INTEGER},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="discountPrice != null" >
        #{discountPrice,jdbcType=DECIMAL},
      </if>
      <if test="totalAmount != null" >
        #{totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="appointmentTime != null" >
        #{appointmentTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null" >
        #{createUserId,jdbcType=INTEGER},
      </if>
      <if test="despatchExpressId != null" >
        #{despatchExpressId,jdbcType=INTEGER},
      </if>
      <if test="expressMemberId != null" >
        #{expressMemberId,jdbcType=INTEGER},
      </if>
      <if test="companyId != null" >
        #{companyId,jdbcType=INTEGER},
      </if>
      <if test="managerId != null" >
        #{managerId,jdbcType=INTEGER},
      </if>
      <if test="batchNo != null" >
        #{batchNo,jdbcType=VARCHAR},
      </if>
      <if test="totalBoxNum != null" >
        #{totalBoxNum,jdbcType=INTEGER},
      </if>
      <if test="expressScanBoxNum != null" >
        #{expressScanBoxNum,jdbcType=INTEGER},
      </if>
      <if test="xiajia != null" >
        #{xiajia,jdbcType=INTEGER},
      </if>
      <if test="isTwoSend != null" >
        #{isTwoSend,jdbcType=INTEGER},
      </if>
      <if test="twoSendAuditDate != null" >
        #{twoSendAuditDate,jdbcType=TIMESTAMP},
      </if>
      <if test="twoSendAuditUserId != null" >
        #{twoSendAuditUserId,jdbcType=INTEGER},
      </if>
      <if test="outDate != null" >
        #{outDate,jdbcType=TIMESTAMP},
      </if>
      <if test="shouHuoDate != null" >
        #{shouHuoDate,jdbcType=TIMESTAMP},
      </if>
      <if test="isReject != null" >
        #{isReject,jdbcType=INTEGER},
      </if>
      <if test="updateDate != null" >
        #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null" >
        #{updateUserId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.order.entity.TbOrderExample" resultType="java.lang.Integer" >
    select count(*) from tb_order
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update tb_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.orderType != null" >
        ORDER_TYPE = #{record.orderType,jdbcType=INTEGER},
      </if>
      <if test="record.orderSource != null" >
        ORDER_SOURCE = #{record.orderSource,jdbcType=INTEGER},
      </if>
      <if test="record.paymentMode != null" >
        PAYMENT_MODE = #{record.paymentMode,jdbcType=INTEGER},
      </if>
      <if test="record.otherPaymentMode != null" >
        OTHER_PAYMENT_MODE = #{record.otherPaymentMode,jdbcType=INTEGER},
      </if>
      <if test="record.memberCode != null" >
        MEMBER_CODE = #{record.memberCode,jdbcType=VARCHAR},
      </if>
      <if test="record.orderStatus != null" >
        ORDER_STATUS = #{record.orderStatus,jdbcType=VARCHAR},
      </if>
      <if test="record.payStatus != null" >
        PAY_STATUS = #{record.payStatus,jdbcType=INTEGER},
      </if>
      <if test="record.consigneePhone != null" >
        CONSIGNEE_PHONE = #{record.consigneePhone,jdbcType=VARCHAR},
      </if>
      <if test="record.consigneeName != null" >
        CONSIGNEE_NAME = #{record.consigneeName,jdbcType=VARCHAR},
      </if>
      <if test="record.consigneeAddress != null" >
        CONSIGNEE_ADDRESS = #{record.consigneeAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.postcode != null" >
        POSTCODE = #{record.postcode,jdbcType=VARCHAR},
      </if>
      <if test="record.transportMode != null" >
        TRANSPORT_MODE = #{record.transportMode,jdbcType=INTEGER},
      </if>
      <if test="record.remark != null" >
        REMARK = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.discountPrice != null" >
        DISCOUNT_PRICE = #{record.discountPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.totalAmount != null" >
        TOTAL_AMOUNT = #{record.totalAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null" >
        CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.appointmentTime != null" >
        APPOINTMENT_TIME = #{record.appointmentTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUserId != null" >
        CREATE_USER_ID = #{record.createUserId,jdbcType=INTEGER},
      </if>
      <if test="record.despatchExpressId != null" >
        DESPATCH_EXPRESS_ID = #{record.despatchExpressId,jdbcType=INTEGER},
      </if>
      <if test="record.expressMemberId != null" >
        EXPRESS_MEMBER_ID = #{record.expressMemberId,jdbcType=INTEGER},
      </if>
      <if test="record.companyId != null" >
        COMPANY_ID = #{record.companyId,jdbcType=INTEGER},
      </if>
      <if test="record.managerId != null" >
        MANAGER_ID = #{record.managerId,jdbcType=INTEGER},
      </if>
      <if test="record.batchNo != null" >
        BATCH_NO = #{record.batchNo,jdbcType=VARCHAR},
      </if>
      <if test="record.totalBoxNum != null" >
        TOTAL_BOX_NUM = #{record.totalBoxNum,jdbcType=INTEGER},
      </if>
      <if test="record.expressScanBoxNum != null" >
        EXPRESS_SCAN_BOX_NUM = #{record.expressScanBoxNum,jdbcType=INTEGER},
      </if>
      <if test="record.xiajia != null" >
        XIAJIA = #{record.xiajia,jdbcType=INTEGER},
      </if>
      <if test="record.isTwoSend != null" >
        IS_TWO_SEND = #{record.isTwoSend,jdbcType=INTEGER},
      </if>
      <if test="record.twoSendAuditDate != null" >
        TWO_SEND_AUDIT_DATE = #{record.twoSendAuditDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.twoSendAuditUserId != null" >
        TWO_SEND_AUDIT_USER_ID = #{record.twoSendAuditUserId,jdbcType=INTEGER},
      </if>
      <if test="record.outDate != null" >
        OUT_DATE = #{record.outDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.shouHuoDate != null" >
        SHOU_HUO_DATE = #{record.shouHuoDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.isReject != null" >
        IS_REJECT = #{record.isReject,jdbcType=INTEGER},
      </if>
      <if test="record.updateDate != null" >
        UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUserId != null" >
        UPDATE_USER_ID = #{record.updateUserId,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>