<?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.fjhx.supplier.mapper.SupplierPricechangeMapper">

    <select id="getListBySupplierId" resultType="com.fjhx.entity.supplier.SupplierPricechange">
        SELECT
            t1.*,
            t2.`Name` AS materialName
        FROM
            supplier_pricechange t1
                LEFT JOIN material t2 ON t1.MaterialCode = t2.`Code`
        WHERE
            t1.SupplierId = #{id}
            AND ApproveBillState = 2
        ORDER BY
            ApprovalTime DESC
        <include refid="com.fjhx.supplier.mapper.SupplierMapper.sql_limit"/>
    </select>

    <select id="getListCountBySupplierId" resultType="java.lang.Integer">
        SELECT
            count(1)
        FROM
            supplier_pricechange t1
        LEFT JOIN material t2 ON t1.MaterialCode = t2.`Code`
        WHERE
            t1.SupplierId = #{id}
            AND ApproveBillState = 2
    </select>
</mapper>
