<?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.hys.app.mapper.erp.LendFormProductMapper">

    <!-- 查询待归还的借出单商品分页列表数据 -->
    <select id="selectWaitReturnProductPage" resultType="com.hys.app.model.erp.dos.LendFormProduct" useCache="false">
        select lfp.* from es_lend_form_product lfp left join es_lend_form lf on lfp.lend_id = lf.id
        where lf.`status` = 'CONFIRMED' order by lf.confirm_time desc
    </select>

    <!-- 查询产品已确认借出信息 -->
    <select id="selectByConfirm" resultType="com.hys.app.model.erp.dos.LendFormProduct" useCache="false">
        select lfp.* from es_lend_form_product lfp left join es_lend_form lf on lfp.lend_id = lf.id
        where lf.`status` = 'CONFIRMED' and lfp.stock_sn = #{stockSn} and lfp.product_id = #{productId}
    </select>
</mapper>