<?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.bonus.canteen.core.order.deprecated.mapper.OrdDetailMapper">

    <select id="getAppDtlOrdDetail" resultType="com.bonus.canteen.core.order.deprecated.vo.AppDtlOrdDetailVO">
        SELECT
        A.id as id,
        A.menu_price as price,
        B.dishes_name as goodsName,
        A.salse_mode as salesMode,
        -- A.quantity,
        A.quantity as realRefundNum,
        A.apply_refund_num,
        A.menu_weigh,
        A.weight as weight,
        B.*,
        A.*
        FROM mac_weigh_consum_report A LEFT JOIN menu_dishes B ON A.menu_no = B.custom_id
        WHERE A.mac_ord_id = #{macOrdId}
        <if test="param.shopstallId != null and param.shopstallId != -1">
            AND B.shopstall_id = #{param.shopstallId}
        </if>
        <if test="param.canteenId != null and param.canteenId != -1">
            AND B.canteen_id = #{param.canteenId}
        </if>
        <if test="openId == null or openId == ''">
            And A.if_redress = 1
        </if>
    </select>

</mapper>
