<?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="cn.freemud.order.mapper.OpenPlatformPartnerReportDetailDao">


     <resultMap id="BaseResultMap" type="cn.freemud.order.entity.OpenPlatformPartnerReportDetail" >
          <id column="id" jdbcType="BIGINT" property="id" />
          <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
          <result column="brand_name" jdbcType="VARCHAR" property="brandName" />
          <result column="store_id" jdbcType="VARCHAR" property="storeId" />
          <result column="store_name" jdbcType="VARCHAR" property="storeName" />
          <result column="report_type" jdbcType="TINYINT" property="reportType" />
          <result column="status" jdbcType="TINYINT" property="status" />
          <result column="order_id" jdbcType="VARCHAR" property="orderId" />
          <result column="deal_no" jdbcType="VARCHAR" property="dealNo" />
          <result column="third_deal_no" jdbcType="VARCHAR" property="thirdDealNo" />
          <result column="wx_order_id" jdbcType="VARCHAR" property="wxOrderId" />
          <result column="pay_amount" jdbcType="INT" property="payAmount" />
          <result column="sub_mchid" jdbcType="VARCHAR" property="subMchid" />
          <result column="sub_appid" jdbcType="VARCHAR" property="subAppid" />
          <result column="gmt_created" jdbcType="TIMESTAMP" property="gmtCreated" />
          <result column="gmt_updated" jdbcType="TIMESTAMP" property="gmtModified" />
     </resultMap>


     <select id="selectPartnerReportDetails" resultMap="BaseResultMap">
          select * from open_platform_parntner_report_detail where partner_id = #{partnerId}
          <if test="brandName != null">
               and brand_name = #{brandName}
          </if>
          <if test="storeName != null">
               and store_name = #{storeName}
          </if>
          <if test="orderId != null">
               and order_id = #{orderId}
          </if>
          <if test="startTime != null">
               and gmt_created > #{startTime}
          </if>
          <if test="endTime != null">
               and  #{endTime} > gmt_created
          </if>
          <if test="reportType != null">
               and  report_type = #{reportType}
          </if>
          <if test="status != null">
               and  status = #{status}
          </if>
     </select>

</mapper>