<?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.purchase.mapper.quality.QualityDetailMapper">
    <select id="getPage" resultType="com.fjhx.purchase.entity.quality.vo.QualityDetailVo">
        select
            qd.id,
            qd.bussiness_id,
            qd.purchase_detail_id,
            qd.arrival_id,
            qd.count,
            qd.status,
            qd.qualified_count,
            qd.no_qualified_count,
            qd.remark,
            qd.create_user,
            qd.create_time,
            qd.update_user,
            qd.update_time
        from quality_detail qd
            ${ew.customSqlSegment}
    </select>

    <select id="getSumQualityCount" resultType="java.math.BigDecimal">
        SELECT
            IFNULL(SUM(qualified_count+no_qualified_count),0) AS sumQualityCount
        FROM
            quality_detail
        WHERE
            arrival_detail_id = #{arrivalDetailId}
    </select>
</mapper>
