<?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.project.business.mapper.TpAreaBasicPriceMapper">

    <resultMap type="com.ruoyi.project.business.domain.TpAreaBasicPrice" id="TpAreaBasicPriceResult">
        <result property="id" column="id"/>
        <result property="elevatorModelId" column="elevator_model_id"/>
        <result property="ratedLoadCapacity" column="rated_load_capacity"/>
        <result property="ratedSpeed" column="rated_speed"/>
        <result property="standardDoorWidth" column="standard_door_width"/>
        <result property="standardDoorHeight" column="standard_door_height"/>
        <result property="maxLiftingHeight" column="max_lifting_height"/>
        <result property="standardFloors" column="standard_floors"/>
        <result property="basicPrice" column="basic_price"/>
        <result property="addOnefloorPrice" column="add_onefloor_price"/>
        <result property="subtractOnefloorPrice" column="subtract_onefloor_price"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <resultMap type="com.ruoyi.project.business.domain.vo.paramSelectItem.TpAreaBasicPriceVo" id="TpAreaBasicPriceVoResult" extends="TpAreaBasicPriceResult">

    </resultMap>

    <sql id="selectTpAreaBasicPriceVo">
        select id,
               elevator_model_id,
               rated_load_capacity,
               rated_speed,
               standard_door_width,
               standard_door_height,
               max_lifting_height,
               standard_floors,
               basic_price,
               add_onefloor_price,
               subtract_onefloor_price,
               del_flag,
               create_time,
               create_by,
               update_time,
               update_by,
               remark
        from tp_area_basic_price
    </sql>

    <select id="selectTpAreaBasicPriceList" parameterType="com.ruoyi.project.business.domain.TpAreaBasicPrice" resultMap="TpAreaBasicPriceResult">
        <include refid="selectTpAreaBasicPriceVo"/>
        <where>
            <if test="elevatorModelId != null ">and elevator_model_id = #{elevatorModelId}</if>
            <if test="ratedLoadCapacity != null ">and rated_load_capacity = #{ratedLoadCapacity}</if>
            <if test="ratedSpeed != null ">and rated_speed = #{ratedSpeed}</if>
            <if test="standardDoorWidth != null ">and standard_door_width = #{standardDoorWidth}</if>
            <if test="standardDoorHeight != null ">and standard_door_height = #{standardDoorHeight}</if>
            <if test="maxLiftingHeight != null ">and max_lifting_height = #{maxLiftingHeight}</if>
            <if test="standardFloors != null ">and standard_floors = #{standardFloors}</if>
            <if test="basicPrice != null ">and basic_price = #{basicPrice}</if>
            <if test="addOnefloorPrice != null ">and add_onefloor_price = #{addOnefloorPrice}</if>
            <if test="subtractOnefloorPrice != null ">and subtract_onefloor_price = #{subtractOnefloorPrice}</if>
        </where>
    </select>

    <select id="selectTpAreaBasicPriceById" parameterType="Long" resultMap="TpAreaBasicPriceResult">
        <include refid="selectTpAreaBasicPriceVo"/>
        where id = #{id}
    </select>

    <insert id="insertTpAreaBasicPrice" parameterType="com.ruoyi.project.business.domain.TpAreaBasicPrice" useGeneratedKeys="true" keyProperty="id">
        insert into tp_area_basic_price
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="elevatorModelId != null">elevator_model_id,</if>
            <if test="ratedLoadCapacity != null">rated_load_capacity,</if>
            <if test="ratedSpeed != null">rated_speed,</if>
            <if test="standardDoorWidth != null">standard_door_width,</if>
            <if test="standardDoorHeight != null">standard_door_height,</if>
            <if test="maxLiftingHeight != null">max_lifting_height,</if>
            <if test="standardFloors != null">standard_floors,</if>
            <if test="basicPrice != null">basic_price,</if>
            <if test="addOnefloorPrice != null">add_onefloor_price,</if>
            <if test="subtractOnefloorPrice != null">subtract_onefloor_price,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="elevatorModelId != null">#{elevatorModelId},</if>
            <if test="ratedLoadCapacity != null">#{ratedLoadCapacity},</if>
            <if test="ratedSpeed != null">#{ratedSpeed},</if>
            <if test="standardDoorWidth != null">#{standardDoorWidth},</if>
            <if test="standardDoorHeight != null">#{standardDoorHeight},</if>
            <if test="maxLiftingHeight != null">#{maxLiftingHeight},</if>
            <if test="standardFloors != null">#{standardFloors},</if>
            <if test="basicPrice != null">#{basicPrice},</if>
            <if test="addOnefloorPrice != null">#{addOnefloorPrice},</if>
            <if test="subtractOnefloorPrice != null">#{subtractOnefloorPrice},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updateTpAreaBasicPrice" parameterType="com.ruoyi.project.business.domain.TpAreaBasicPrice">
        update tp_area_basic_price
        <trim prefix="SET" suffixOverrides=",">
            <if test="elevatorModelId != null">elevator_model_id = #{elevatorModelId},</if>
            <if test="ratedLoadCapacity != null">rated_load_capacity = #{ratedLoadCapacity},</if>
            <if test="ratedSpeed != null">rated_speed = #{ratedSpeed},</if>
            <if test="standardDoorWidth != null">standard_door_width = #{standardDoorWidth},</if>
            <if test="standardDoorHeight != null">standard_door_height = #{standardDoorHeight},</if>
            <if test="maxLiftingHeight != null">max_lifting_height = #{maxLiftingHeight},</if>
            <if test="standardFloors != null">standard_floors = #{standardFloors},</if>
            <if test="basicPrice != null">basic_price = #{basicPrice},</if>
            <if test="addOnefloorPrice != null">add_onefloor_price = #{addOnefloorPrice},</if>
            <if test="subtractOnefloorPrice != null">subtract_onefloor_price = #{subtractOnefloorPrice},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTpAreaBasicPriceById" parameterType="Long">
        delete
        from tp_area_basic_price
        where id = #{id}
    </delete>

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

    <select id="getTpAreaBasicPriceList" parameterType="com.ruoyi.project.business.domain.TpAreaBasicPrice" resultMap="TpAreaBasicPriceVoResult">
        <include refid="selectTpAreaBasicPriceVo"/>
        <where>
            <if test="elevatorModelId != null ">and elevator_model_id = #{elevatorModelId}</if>
            <if test="ratedLoadCapacity != null ">and rated_load_capacity = #{ratedLoadCapacity}</if>
            <if test="ratedSpeed != null ">and rated_speed = #{ratedSpeed}</if>
            <if test="standardDoorWidth != null ">and standard_door_width = #{standardDoorWidth}</if>
            <if test="standardDoorHeight != null ">and standard_door_height = #{standardDoorHeight}</if>
            <if test="maxLiftingHeight != null ">and max_lifting_height = #{maxLiftingHeight}</if>
            <if test="standardFloors != null ">and standard_floors = #{standardFloors}</if>
            <if test="basicPrice != null ">and basic_price = #{basicPrice}</if>
            <if test="addOnefloorPrice != null ">and add_onefloor_price = #{addOnefloorPrice}</if>
            <if test="subtractOnefloorPrice != null ">and subtract_onefloor_price = #{subtractOnefloorPrice}</if>
        </where>
    </select>
</mapper>