<?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.sckw.payment.dao.KwpSettlementOfflineMapper">
    <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpSettlementOffline">
        <!--@mbg.generated-->
        <!--@Table kwp_settlement_offline-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="ent_id" jdbcType="BIGINT" property="entId"/>
        <result column="settlement_id" jdbcType="BIGINT" property="settlementId"/>
        <result column="order_type" jdbcType="BOOLEAN" property="orderType"/>
        <result column="pay_time" jdbcType="TIMESTAMP" property="payTime"/>
        <result column="pay_price" jdbcType="DECIMAL" property="payPrice"/>
        <result column="topay_price" jdbcType="DECIMAL" property="topayPrice"/>
        <result column="url" jdbcType="VARCHAR" property="url"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id,
        ent_id,
        settlement_id,
        order_type,
        pay_time,
        pay_price,
        topay_price,
        url,
        remark,
        `status`,
        create_by,
        create_time,
        update_by,
        update_time,
        del_flag
    </sql>

    <!-- 物流-线下付款(运费收款)记录-列表 -->
    <select id="pageListLogisticsCollection" resultType="com.sckw.payment.model.dto.SettlementOfflineDto">
        select
        <include refid="Base_Column_List"/>
        FROM kwp_settlement_offline
        <where>
            del_flag = 0
            <if test="offlineReq.orderType != null">
                and order_type = #{offlineReq.orderType,jdbcType=INTEGER}
            </if>
            <if test="offlineReq.id != null and offlineReq.id != ''">
                and settlement_id = #{offlineReq.id,jdbcType=INTEGER}
            </if>
            order by pay_time desc
        </where>
    </select>

    <select id="detailLogisticsCollection" resultType="com.sckw.payment.model.dto.SettlementOfflineDto">
        select
        <include refid="Base_Column_List"/>
        FROM kwp_settlement_offline
        <where>
            order_type = 1
            order by pay_time desc
        </where>
    </select>

    <select id="appList" resultType="com.sckw.payment.model.vo.SettlementVo">
        select
        <include refid="Base_Column_List"/>
        FROM kwp_settlement_offline
        <where>
            del_flag = 0
            <if test="offlineReq.orderType != null">
                and order_type = #{offlineReq.orderType,jdbcType=INTEGER}
            </if>
            <if test="offlineReq.id != null and offlineReq.id != ''">
                and settlement_id = #{offlineReq.id,jdbcType=INTEGER}
            </if>
            order by pay_time desc
        </where>
    </select>
    <select id="pageList" resultType="com.sckw.payment.model.dto.SettlementOfflineDto">
        select
        <include refid="Base_Column_List"/>
        FROM kwp_settlement_offline
        <where>
            del_flag = 0
            <if test="offlineReq.orderType != null">
                and order_type = #{offlineReq.orderType,jdbcType=INTEGER}
            </if>
            <if test="offlineReq.id != null and offlineReq.id != ''">
                and settlement_id = #{offlineReq.id,jdbcType=INTEGER}
            </if>
            order by pay_time desc
        </where>
    </select>
    <select id="list" resultType="com.sckw.payment.model.dto.SettlementOfflineDto">
        select
        <include refid="Base_Column_List"/>
        FROM kwp_settlement_offline
        <where>
            del_flag = 0
            <if test="offlineReq.orderType != null">
                and order_type = #{offlineReq.orderType,jdbcType=INTEGER}
            </if>
            <if test="offlineReq.id != null and offlineReq.id != ''">
                and settlement_id = #{offlineReq.id,jdbcType=INTEGER}
            </if>
            order by pay_time desc
        </where>
    </select>
</mapper>
