<?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.ruoyi.web.v2.mapper.JsDrugCheckMapper">

    <select id="getDrug" resultType="com.ruoyi.web.v2.model.vo.DrugCheckVo">
        select IFNULL(sum(check_amount),'0') checkAmount,result result,check_project checkProject from js_drug_check
        where entrance_batch_id=#{id}
        group by check_project
    </select>

    <select id="selectForOne" parameterType="com.ruoyi.web.v2.model.JsDrugCheck" resultType="com.ruoyi.web.v2.model.JsDrugCheck">
        SELECT * FROM js_drug_check
        <where>
            <if test="id != null">
                and id=#{id}
            </if>
            <if test="entranceBatchId != null">
                and entrance_batch_id=#{entranceBatchId}
            </if>
            <if test="checkType != null">
                and check_type=#{checkType}
            </if>
        </where>
        ORDER BY id DESC
        LIMIT 1
    </select>
</mapper>
