<?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.slodon.b2b2c.dao.read.promotion.LadderGroupOrderExtendReadMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.promotion.pojo.LadderGroupOrderExtend">
    <id column="extend_id" property="extendId" />
    <result column="group_id" property="groupId" />
    <result column="order_sn" property="orderSn" />
    <result column="member_id" property="memberId" />
    <result column="member_name" property="memberName" />
    <result column="goods_id" property="goodsId" />
    <result column="goods_name" property="goodsName" />
    <result column="goods_image" property="goodsImage" />
    <result column="product_id" property="productId" />
    <result column="product_num" property="productNum" />
    <result column="product_price" property="productPrice" />
    <result column="deposit_pay_sn" property="depositPaySn" />
    <result column="remain_pay_sn" property="remainPaySn" />
    <result column="order_sub_state" property="orderSubState" />
    <result column="advance_deposit" property="advanceDeposit" />
    <result column="remain_amount" property="remainAmount" />
    <result column="remain_start_time" property="remainStartTime" />
    <result column="remain_end_time" property="remainEndTime" />
    <result column="participate_time" property="participateTime" />
    <result column="success_time" property="successTime" />
    <result column="execute_state" property="executeState" />
    <result column="is_refund_deposit" property="isRefundDeposit" />
  </resultMap>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `extend_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.extendIdNotEquals != null">
          AND `extend_id` != #{example.extendIdNotEquals}
        </if>
        <if test="example.extendIdIn != null">
          AND `extend_id` in (${example.extendIdIn})
        </if>
        <if test="example.groupId != null">
          AND `group_id` = #{example.groupId}
        </if>
        <if test="example.orderSn != null">
          AND `order_sn` = #{example.orderSn}
        </if>
        <if test="example.orderSnLike != null">
          AND `order_sn` like concat('%',#{example.orderSnLike},'%')
        </if>
        <if test="example.orderSnIn != null">
          AND `order_sn` in (${example.orderSnIn})
        </if>
        <if test="example.memberId != null">
          AND `member_id` = #{example.memberId}
        </if>
        <if test="example.memberName != null">
          AND `member_name` = #{example.memberName}
        </if>
        <if test="example.memberNameLike != null">
          AND `member_name` like concat('%',#{example.memberNameLike},'%')
        </if>
        <if test="example.goodsId != null">
          AND `goods_id` = #{example.goodsId}
        </if>
        <if test="example.goodsName != null">
          AND `goods_name` = #{example.goodsName}
        </if>
        <if test="example.goodsNameLike != null">
          AND `goods_name` like concat('%',#{example.goodsNameLike},'%')
        </if>
        <if test="example.goodsImage != null">
          AND `goods_image` = #{example.goodsImage}
        </if>
        <if test="example.productId != null">
          AND `product_id` = #{example.productId}
        </if>
        <if test="example.productNum != null">
          AND `product_num` = #{example.productNum}
        </if>
        <if test="example.productPrice != null">
          AND `product_price` = #{example.productPrice}
        </if>
        <if test="example.depositPaySn != null">
          AND `deposit_pay_sn` = #{example.depositPaySn}
        </if>
        <if test="example.depositPaySnLike != null">
          AND `deposit_pay_sn` like concat('%',#{example.depositPaySnLike},'%')
        </if>
        <if test="example.remainPaySn != null">
          AND `remain_pay_sn` = #{example.remainPaySn}
        </if>
        <if test="example.remainPaySnLike != null">
          AND `remain_pay_sn` like concat('%',#{example.remainPaySnLike},'%')
        </if>
        <if test="example.orderSubState != null">
          AND `order_sub_state` = #{example.orderSubState}
        </if>
        <if test="example.orderSubStateIn != null">
          AND `order_sub_state` in (${example.orderSubStateIn})
        </if>
        <if test="example.orderSubStateNotIn != null">
          AND `order_sub_state` not in (${example.orderSubStateNotIn})
        </if>
        <if test="example.orderSubStateNotEquals != null">
          AND `order_sub_state` != #{example.orderSubStateNotEquals}
        </if>
        <if test="example.advanceDeposit != null">
          AND `advance_deposit` = #{example.advanceDeposit}
        </if>
        <if test="example.remainAmount != null">
          AND `remain_amount` = #{example.remainAmount}
        </if>
        <if test="example.remainStartTimeAfter != null">
          AND `remain_start_time` <![CDATA[ >= ]]> #{example.remainStartTimeAfter}
        </if>
        <if test="example.remainStartTimeBefore != null">
          AND `remain_start_time` <![CDATA[ <= ]]> #{example.remainStartTimeBefore}
        </if>
        <if test="example.remainEndTimeAfter != null">
          AND `remain_end_time` <![CDATA[ >= ]]> #{example.remainEndTimeAfter}
        </if>
        <if test="example.remainEndTimeBefore != null">
          AND `remain_end_time` <![CDATA[ <= ]]> #{example.remainEndTimeBefore}
        </if>
        <if test="example.participateTimeAfter != null">
          AND `participate_time` <![CDATA[ >= ]]> #{example.participateTimeAfter}
        </if>
        <if test="example.participateTimeBefore != null">
          AND `participate_time` <![CDATA[ <= ]]> #{example.participateTimeBefore}
        </if>
        <if test="example.successTimeAfter != null">
          AND `success_time` <![CDATA[ >= ]]> #{example.successTimeAfter}
        </if>
        <if test="example.successTimeBefore != null">
          AND `success_time` <![CDATA[ <= ]]> #{example.successTimeBefore}
        </if>
        <if test="example.executeState != null">
          AND `execute_state` = #{example.executeState}
        </if>
        <if test="example.executeStateIn != null">
          AND `execute_state` in (${example.executeStateIn})
        </if>
        <if test="example.executeStateNotIn != null">
          AND `execute_state` not in (${example.executeStateNotIn})
        </if>
        <if test="example.executeStateNotEquals != null">
          AND `execute_state` != #{example.executeStateNotEquals}
        </if>
        <if test="example.isRefundDeposit != null">
          AND `is_refund_deposit` = #{example.isRefundDeposit}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `extend_id` DESC
  </sql>
  <sql id="orderByOther">
    order by ${example.orderBy}
  </sql>
  <!--分组条件-->
  <sql id="groupBy">
    group by ${example.groupBy}
  </sql>
  <!--分页条件-->
  <sql id="limit">
    <if test="size != null and size &gt; 0">
      limit #{startRow},#{size}
    </if>
  </sql>
  <!--查询符合条件的记录数-->
  <select id="countByExample" parameterType="com.slodon.b2b2c.promotion.example.LadderGroupOrderExtendExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `promotion_ladder_group_order_extend`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `promotion_ladder_group_order_extend`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `promotion_ladder_group_order_extend`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(所有字段)-->
  <select id="listPageByExample" resultMap="resultMap">
    SELECT
      *
    FROM `promotion_ladder_group_order_extend`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
  <!--查询符合条件的记录(指定字段)-->
  <select id="listFieldsByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `promotion_ladder_group_order_extend`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(指定字段)-->
  <select id="listFieldsPageByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `promotion_ladder_group_order_extend`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
</mapper>