<?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="org.dromara.system.mapper.TblDzbcSitePriceMapper">

    <resultMap type="org.dromara.system.domain.vo.TblDzbcSitePriceVo" id="TblDzbcSitePriceResult">
        <result property="id"    column="id"    />
        <result property="pathId"    column="path_id"    />
        <result property="fromSiteId"    column="from_site_id"    />
        <result property="toSiteId"    column="to_site_id"    />
        <result property="price"    column="price"    />
        <result property="remark"    column="remark"    />
        <result property="ext1"    column="ext1"    />
        <result property="ext2"    column="ext2"    />
    </resultMap>

    <select id="selectVoList" parameterType="org.dromara.system.domain.vo.TblDzbcSitePriceVo" resultMap="TblDzbcSitePriceResult">
        select id, path_id, from_site_id, to_site_id, price, remark, ext1, ext2
        from tbl_dzbc_site_price
        <where>
            <if test="pathId != null">
                and path_id = #{pathId}
            </if>
            <if test="fromSiteId != null">
                and from_site_id = #{fromSiteId}
            </if>
            <if test="toSiteId != null">
                and to_site_id = #{toSiteId}
            </if>
        </where>
        order by id desc
    </select>

    <select id="selectVoById" parameterType="Long" resultMap="TblDzbcSitePriceResult">
        select id, path_id, from_site_id, to_site_id, price, remark, ext1, ext2
        from tbl_dzbc_site_price
        where id = #{id}
    </select>

    <select id="selectVoByIds" parameterType="Collection" resultMap="TblDzbcSitePriceResult">
        select id, path_id, from_site_id, to_site_id, price, remark, ext1, ext2
        from tbl_dzbc_site_price
        where id in
        <foreach item="id" collection="ids" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

    <select id="selectByPathId" parameterType="Long" resultMap="TblDzbcSitePriceResult">
        select id, path_id, from_site_id, to_site_id, price, remark, ext1, ext2
        from tbl_dzbc_site_price
        where path_id = #{pathId}
        order by id desc
    </select>

</mapper>
