<?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="org.springblade.modules.api.mapper.VendingOrderMapper">

    <select id="getVendingOrder" resultType="org.springblade.modules.finance.vo.OrderGoodsVO">
        select a.*
        from t_order_goods a
                 left join t_order b on a.order_id = b.id
        where b.order_state = 2
          and a.device_id = #{param.machine_id}
        order by b.create_time asc
    </select>

    <select id="getBackOrder" resultType="org.springblade.modules.finance.vo.OrderVO">
        select a.*
        from t_order a
                 left join t_order_goods b on a.id = b.order_id
        where a.order_state = 2
          and b.device_id = #{param.machine_id}
        order by a.create_time asc
    </select>

</mapper>