OrderBusinessCouponSubSMapper.xml 4.28 KB
<?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.zteits.business.mapper.smapper.OrderBusinessCouponSubSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.business.domain.OrderBusinessCouponSub">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="order_sub_no" jdbcType="VARCHAR" property="orderSubNo" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="card_rule_no" jdbcType="VARCHAR" property="cardRuleNo" />
    <result column="card_rule_name" jdbcType="VARCHAR" property="cardRuleName" />
    <result column="buy_num" jdbcType="INTEGER" property="buyNum" />
    <result column="unit_price" jdbcType="INTEGER" property="unitPrice" />
    <result column="act_total_fee" jdbcType="INTEGER" property="actTotalFee" />
    <result column="total_total_fee" jdbcType="INTEGER" property="totalTotalFee" />
    <result column="dicount_total_fee" jdbcType="INTEGER" property="dicountTotalFee" />
    <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo" />
    <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
    <result column="card_type" jdbcType="INTEGER" property="cardType" />
    <result column="coupons_type" jdbcType="INTEGER" property="couponsType" />
    <result column="use_rule" jdbcType="INTEGER" property="useRule" />
    <result column="disc_value" jdbcType="VARCHAR" property="discValue" />
    <result column="full_cut_value" jdbcType="INTEGER" property="fullCutValue" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <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>

  <select id="queryOrderBusinessCouponList" resultType="com.zteits.clouds.api.dto.business.dto.OrderBusinessCouponSubListDTO">
    select obcs.order_sub_no orderSubNo,
       obc.business_id   businessId,
       obc.business_name businessName,
       obcs.card_rule_name cardRuleName,
       obcs.card_rule_no cardRuleNo,
       obcs.buy_num buyNum,
       obcs.card_type cardType,
       obcs.unit_price unitPrice,
       obcs.act_total_fee actTotalFee,
       obcs.pay_time payTime,
       obcs.create_date createDate,
       obc.order_state orderState
    from order_business_coupon obc,
         order_business_coupon_sub obcs
    where obc.order_no = obcs.order_no
    <if test="startTime !=null and endTime !=null">
      and obcs.create_date BETWEEN #{startTime} and #{endTime}
    </if>
    <if test="orderState !=null and orderState !=''">
      AND obc.order_state = #{orderState}
    </if>
    <if test="businessName !=null and businessName !=''">
      AND obc.business_name like CONCAT(#{businessName},'%')
    </if>
    <if test="orderNo !=null and orderNo !=''">
      AND obcs.order_no = #{orderNo}
    </if>


    </select>
</mapper>