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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.m2pool.lease.entity.LeaseMachineTempConfig">
        <id column="id" property="id" />
        <result column="machine_id" property="machineId" />
        <result column="brand" property="brand" />
        <result column="name" property="name" />
        <result column="memory" property="memory" />
        <result column="status" property="status" />
        <result column="coin" property="coin" />
        <result column="hashrate" property="hashrate" />
        <result column="algorithm" property="algorithm" />
        <result column="icon" property="icon" />
        <result column="unit" property="unit" />
        <result column="month_income" property="monthIncome" />
        <result column="power_dissipation" property="powerDissipation" />
        <result column="del" property="del" />
        <result column="effect_time" property="effectTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, machine_id, brand, name, memory, status, coin, hashrate, algorithm, icon, unit, month_income, power_dissipation, del, effect_time
    </sql>
    <insert id="insertBatch">
        INSERT INTO lease_machine_temp_config (
            machine_id,
            brand,
            `name`,
            memory,
            status,
            coin,
            hashrate,
            algorithm,
            icon,
            unit,
            month_income,
            power_dissipation,
            effect_time
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.machineId},
             #{item.brand},
             #{item.name},
             #{item.memory},
             #{item.status},
             #{item.coin},
             #{item.hashrate},
             #{item.algorithm},
             #{item.icon},
             #{item.unit},
             #{item.monthIncome},
             #{item.powerDissipation},
             #{item.effectTime})
        </foreach>
    </insert>
    <insert id="insertBatchByTempList">
        INSERT INTO lease_machine_config (
        machine_id,
        brand,
        `name`,
        memory,
        status,
        coin,
        hashrate,
        algorithm,
        icon,
        unit,
        month_income,
        power_dissipation
        )
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.machineId},
            #{item.brand},
            #{item.name},
            #{item.memory},
            #{item.status},
            #{item.coin},
            #{item.hashrate},
            #{item.algorithm},
            #{item.icon},
            #{item.unit},
            #{item.monthIncome},
            #{item.powerDissipation})
        </foreach>
    </insert>

</mapper>
