TdCBusinessOrderParkRecordSMapper.xml 5.27 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.TdCBusinessOrderParkRecordSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.business.domain.TdCBusinessOrderParkRecord">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="order_id" jdbcType="VARCHAR" property="orderId" />
    <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
    <result column="pl_name" jdbcType="VARCHAR" property="plName" />
    <result column="order_act_fee" jdbcType="BIGINT" property="orderActFee" />
    <result column="order_total_fee" jdbcType="BIGINT" property="orderTotalFee" />
    <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
    <result column="car_type" jdbcType="INTEGER" property="carType" />
    <result column="park_in_time" jdbcType="TIMESTAMP" property="parkInTime" />
    <result column="park_out_time" jdbcType="TIMESTAMP" property="parkOutTime" />
    <result column="parking_duration" jdbcType="BIGINT" property="parkingDuration" />
    <result column="business_id" jdbcType="VARCHAR" property="businessId" />
    <result column="b_coupon_id" jdbcType="BIGINT" property="bCouponId" />
    <result column="b_coupon_code" jdbcType="VARCHAR" property="bCouponCode" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="type_value" jdbcType="INTEGER" property="typeValue" />
    <result column="real_value" jdbcType="INTEGER" property="realValue" />
    <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" />
    <result column="business_name" jdbcType="VARCHAR" property="businessName" />
    <result column="type_name" jdbcType="VARCHAR" property="typeName" />
  </resultMap>
  <select id="queryBusinessOrderParkRecordForPageList" parameterType="com.zteits.clouds.api.dto.business.param.TdCBusinessOrderParkRecordRequest" resultMap="BaseResultMap">
    select
        re.id,
        re.order_id,
        re.pl_no,
        re.pl_name,
        re.order_act_fee,
        re.order_total_fee,
        re.car_number,
        re.car_type ,
        re.park_in_time ,
        re.park_out_time ,
        re.parking_duration ,
        re.business_id ,
        re.b_coupon_id ,
        re.b_coupon_code ,
        re.type ,
        re.type_value ,
        re.real_value ,
        re.data_state ,
        re.org_id ,
        re.create_emp_id ,
        re.create_date ,
        re.modfiy_emp_id ,
        re.modfiy_date ,
        re.business_name ,
        re.type_name
    from td_c_business_order_park_record re,
    td_c_business_coupon co
    where re.data_state = 1
    and re.b_coupon_code = co.card_no
    and co.is_uesed = 1

    <if test="businessId !=null and businessId !=''">
      AND re.business_id LIKE CONCAT('%',#{businessId},'%')
    </if>
    <if test="businessName !=null and businessName !=''">
      AND re.business_name LIKE CONCAT('%',#{businessName},'%')
    </if>
    <if test="startTime !=null">
      AND re.create_date &gt; #{startTime}
    </if>
    <if test="endTime !=null">
      AND re.create_date &lt; #{endTime}
    </if>
    <if test="carNumber !=null  and carNumber !=''">
      AND re.car_number = #{carNumber}
    </if>
    <if test="type !=null  and type !=''">
      AND re.type = #{type}
    </if>
    <if test="orgId !=null  and orgId !=''">
      AND re.org_id = #{orgId}
    </if>
    <if test="orderId !=null  and orderId !=''">
      AND re.order_id = #{orderId}
    </if>

  </select>


    <select id="queryParkingCouponSummary" parameterType="com.zteits.clouds.api.dto.business.param.TdCBusinessOrderParkRecordRequest" resultType="com.zteits.clouds.api.dto.business.dto.TdCBusinessOrderParkCouponSummaryDTO">
        select
        sum((IFNULL(re.order_act_fee,0))) as orderActFeeAll,
        sum((IFNULL(re.order_total_fee,0))) as orderTotalFeeAll,
        (sum((IFNULL(re.order_total_fee,0))) - sum((IFNULL(re.order_act_fee,0)))) as dicountFeeAll

        from td_c_business_order_park_record re,
        td_c_business_coupon co
        where re.data_state = 1
        and re.b_coupon_code = co.card_no
        and co.is_uesed = 1

        <if test="businessId !=null and businessId !=''">
            AND re.business_id LIKE CONCAT('%',#{businessId},'%')
        </if>
        <if test="startTime !=null">
            AND re.create_date &gt; #{startTime}
        </if>
        <if test="endTime !=null">
            AND re.create_date &lt; #{endTime}
        </if>
        <if test="carNumber !=null  and carNumber !=''">
            AND re.car_number = #{carNumber}
        </if>
        <if test="type !=null  and type !=''">
            AND re.type = #{type}
        </if>
        <if test="orgId !=null  and orgId !=''">
            AND re.org_id = #{orgId}
        </if>
        <if test="orderId !=null  and orderId !=''">
            AND re.order_id = #{orderId}
        </if>

    </select>

</mapper>