<?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.yc.ship.module.otc.dal.mysql.storecreditlog.StorePlatCreditLogMapper">

    <select id="selectLogPage" resultType="com.yc.ship.module.otc.controller.admin.storeplatcreditlog.vo.StorePlatCreditLogRespVO">
        SELECT t1.* ,t2.store_name,t3.`name`  as distributor_name
        from otc_store_plat_credit_log t1 INNER JOIN otc_agency_store t2 on t1.store_id = t2.id and t2.deleted =0
        left join ota_distributor t3 on t3.id = t1.distributor_id and t3.deleted = 0
        where 1=1
        <if test="pageReqVO.storeName != null and pageReqVO.storeName !=''">
            and t2.store_name = #{pageReqVO.storeName}
        </if>
        <if test="pageReqVO.creditMode != null ">
            and t1.credit_mode = #{pageReqVO.creditMode}
        </if>
        <if test="pageReqVO.tenantId != null ">
            and t1.tenant_id = #{pageReqVO.tenantId} and t3.tenant_id = #{pageReqVO.tenantId}
        </if>

        ORDER BY t1.create_time desc,t1.update_time desc
    </select>

</mapper>