<?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.m2pool.lease.mapper.LeaseProductMachinePriceMapper">

    <select id="getOrderTotalPriceGroupByChainAndCoin"
            resultType="com.m2pool.lease.entity.LeaseProductMachinePrice">
        select
        product_machine_id as productMachineId,
        price as price
        from lease_product_machine_price
        where
        <foreach collection="list" item="item" separator="OR">
            (`product_machine_id` = #{item.machineId} AND coin = #{item.coin} AND chain = #{item.chain})
        </foreach>
    </select>
    <select id="getMachinePriceByMachineIds" resultType="com.m2pool.lease.dto.MachinePayTypeDto">
        select
        product_machine_id as productMachineId,
        price as price,
        coin as coin,
        chain as chain
        from lease_product_machine_price
        where
        <foreach collection="list" item="item" separator="OR">
            (`product_machine_id` = #{item} AND del = false)
        </foreach>
    </select>
    <select id="getPriceByOrderItems" resultType="java.util.Map">
        select
        product_machine_id as machineId,
        price as price
        from lease_product_machine_price
        where
        <foreach collection="list" item="item" separator="OR">
            (`product_machine_id` = #{item.productMachineId} AND coin = #{item.symbol} AND chain = #{item.chain})
        </foreach>
    </select>


</mapper>
