<?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.ruoyi.system.mapper.TaxiPricesMapper">
    
    <resultMap type="TaxiPrices" id="TaxiPricesResult">
        <result property="id"    column="id"    />
        <result property="startingPrice"    column="starting_price"    />
        <result property="startingDistance"    column="starting_distance"    />
        <result property="skipPrice"    column="skip_price"    />
        <result property="skipDistance"    column="skip_distance"    />
    </resultMap>

    <sql id="selectTaxiPricesVo">
        select id, starting_price, starting_distance, skip_price, skip_distance from taxi_prices
    </sql>

    <select id="selectTaxiPricesList" parameterType="TaxiPrices" resultMap="TaxiPricesResult">
        <include refid="selectTaxiPricesVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectTaxiPricesById" parameterType="Long" resultMap="TaxiPricesResult">
        <include refid="selectTaxiPricesVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTaxiPrices" parameterType="TaxiPrices" useGeneratedKeys="true" keyProperty="id">
        insert into taxi_prices
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="startingPrice != null">starting_price,</if>
            <if test="startingDistance != null">starting_distance,</if>
            <if test="skipPrice != null">skip_price,</if>
            <if test="skipDistance != null">skip_distance,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="startingPrice != null">#{startingPrice},</if>
            <if test="startingDistance != null">#{startingDistance},</if>
            <if test="skipPrice != null">#{skipPrice},</if>
            <if test="skipDistance != null">#{skipDistance},</if>
         </trim>
    </insert>

    <update id="updateTaxiPrices" parameterType="TaxiPrices">
        update taxi_prices
        <trim prefix="SET" suffixOverrides=",">
            <if test="startingPrice != null">starting_price = #{startingPrice},</if>
            <if test="startingDistance != null">starting_distance = #{startingDistance},</if>
            <if test="skipPrice != null">skip_price = #{skipPrice},</if>
            <if test="skipDistance != null">skip_distance = #{skipDistance},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTaxiPricesById" parameterType="Long">
        delete from taxi_prices where id = #{id}
    </delete>

    <delete id="deleteTaxiPricesByIds" parameterType="String">
        delete from taxi_prices where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>