<?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.LeaseMachinePriceMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.m2pool.lease.entity.LeaseMachinePrice">
        <id column="id" property="id" />
        <result column="machine_id" property="machineId" />
        <result column="price" property="price" />
        <result column="coin" property="coin" />
        <result column="chain" property="chain" />
        <result column="del" property="del" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, machine_id, price, coin, chain, del
    </sql>
    <select id="getMachinePriceByMachineIds" resultType="com.m2pool.lease.dto.MachinePayTypeDto">
        select
        machine_id as productMachineId,
        price as price,
        coin as coin,
        chain as chain
        from lease_machine_price
        where
        <foreach collection="list" item="item" separator="OR">
            (`machine_id` = #{item} AND del = false)
        </foreach>
    </select>
    <select id="getOrderTotalPriceGroupByChainAndCoin" resultType="com.m2pool.lease.entity.LeaseMachinePrice">
        select
        machine_id as machineId,
        price as price
        from lease_machine_price
        where
        <foreach collection="list" item="item" separator="OR">
            (`machine_id` = #{item.machineId} AND coin = #{item.coin} AND chain = #{item.chain})
        </foreach>
    </select>

</mapper>
