<?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="cn.reghao.tnb.file.app.zoss.db.mapper.StoreVolumeMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert into file_store_volume
        (`store_node_id`,`name`,`volume`,`mount_point`,`fs_type`,`block_id`,`total_space`,`avail_space`,`total_inode`,`avail_inode`,`store_dir`)
        values
        (#{storeNodeId},#{name},#{volume},#{mountPoint},#{fsType},#{blockId},#{totalSpace},#{availSpace},#{totalInode},#{availInode},#{storeDir})
    </insert>
    <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
        insert into file_store_volume
        (`store_node_id`,`name`,`volume`,`mount_point`,`fs_type`,`block_id`,`total_space`,`avail_space`,`total_inode`,`avail_inode`,`store_dir`)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.storeNodeId},#{item.name},#{item.volume},#{item.mountPoint},#{item.fsType},#{item.blockId},#{item.totalSpace},#{item.availSpace},#{item.totalInode},#{item.availInode},#{item.storeDir})
        </foreach>
    </insert>

    <select id="findByStoreNodeId" resultType="cn.reghao.tnb.file.app.zoss.model.po.StoreVolume">
        select *
        from file_store_volume
        where store_node_id=#{storeNodeId}
    </select>
</mapper>
