<?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.bonus.canteen.core.supply.mapper.DrpSupplierScoreHistMapper">


    <select id="pageDrpSupplierScoreHist" resultType="com.bonus.canteen.core.supply.vo.DrpSupplierScoreHistPageVO">
        SELECT
            a.supplier_id,
            b.supplier_name,
            a.period,
            a.delivery_on_time_score,
            a.product_pass_score,
            a.company_qualification_certification_score,
            a.regist_fund_score,
            a.last_year_operating_income_score,
            a.workers_num_score,
            a.order_num_score,
            a.order_amount_score,
            a.total_score,
            a.crtime
        FROM
            drp_supplier_score_hist a
            LEFT JOIN drp_supplier b ON a.supplier_id = b.supplier_id
        WHERE
            a.supplier_id = #{content.supplierId}
        order by a.crtime desc
    </select>
    <select id="getLeastScore" resultType="com.bonus.canteen.core.supply.vo.DrpSupplierScorePageVO">
        SELECT
            a.supplier_id,
            b.supplier_name,
            a.delivery_on_time_score,
            a.product_pass_score,
            a.company_qualification_certification_score,
            a.last_year_operating_income_score,
            a.regist_fund_score,
            a.workers_num_score,
            a.order_num_score,
            a.order_amount_score,
            a.total_score
        FROM
            drp_supplier_score_hist a
            LEFT JOIN drp_supplier b ON a.supplier_id = b.supplier_id
        WHERE
            a.supplier_id = #{supplierId}
        ORDER BY
            a.crtime DESC
            LIMIT 1
    </select>
</mapper>
