<?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.TpAreaOptionalParaPriceMapper">
    
    <resultMap type="com.ruoyi.project.business.domain.TpAreaOptionalParaPrice" id="TpAreaOptionalParaPriceResult">
        <result property="id"    column="id"    />
        <result property="elevatorModelId"    column="elevator_model_id"    />
        <result property="markupId"    column="markup_id"    />
        <result property="markupKey"    column="markup_key"    />
        <result property="markupName"    column="markup_name"    />
        <result property="paraCode"    column="para_code"    />
        <result property="relatedParaValue1"    column="related_para_value1"    />
        <result property="relatedParaValue2"    column="related_para_value2"    />
        <result property="relatedParaValue3"    column="related_para_value3"    />
        <result property="relatedParaValue4"    column="related_para_value4"    />
        <result property="relatedParaValue5"    column="related_para_value5"    />
        <result property="relatedParaValue6"    column="related_para_value6"    />
        <result property="relatedParaValue7"    column="related_para_value7"    />
        <result property="relatedParaValue8"    column="related_para_value8"    />
        <result property="relatedParaValue9"    column="related_para_value9"    />
        <result property="relatedParaValue10"    column="related_para_value10"    />
        <result property="quantityType"    column="quantity_type"    />
        <result property="quantity"    column="quantity"    />
        <result property="quantityFormula"    column="quantity_formula"    />
        <result property="quantityUnit"    column="quantity_unit"    />
        <result property="priceType"    column="price_type"    />
        <result property="price"    column="price"    />
        <result property="priceFormula"    column="price_formula"    />
        <result property="status"    column="status"    />
        <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>

    <sql id="selectTpAreaOptionalParaPriceVo">
        select id, elevator_model_id, markup_id, markup_key, markup_name, para_code, related_para_value1, related_para_value2, related_para_value3, related_para_value4, related_para_value5, related_para_value6, related_para_value7, related_para_value8, related_para_value9, related_para_value10, quantity_type, quantity, quantity_formula, quantity_unit, price_type, price, price_formula, status, del_flag, create_time, create_by, update_time, update_by, remark from tp_area_optional_para_price
    </sql>

    <select id="selectTpAreaOptionalParaPriceList" parameterType="com.ruoyi.project.business.domain.TpAreaOptionalParaPrice" resultMap="TpAreaOptionalParaPriceResult">
        <include refid="selectTpAreaOptionalParaPriceVo"/>
        <where>  
            <if test="elevatorModelId != null "> and elevator_model_id = #{elevatorModelId}</if>
            <if test="markupId != null "> and markup_id = #{markupId}</if>
            <if test="markupKey != null  and markupKey != ''"> and markup_key = #{markupKey}</if>
            <if test="markupName != null  and markupName != ''"> and markup_name like concat('%', #{markupName}, '%')</if>
            <if test="paraCode != null  and paraCode != ''"> and para_code = #{paraCode}</if>
            <if test="relatedParaValue1 != null  and relatedParaValue1 != ''"> and related_para_value1 = #{relatedParaValue1}</if>
            <if test="relatedParaValue2 != null  and relatedParaValue2 != ''"> and related_para_value2 = #{relatedParaValue2}</if>
            <if test="relatedParaValue3 != null  and relatedParaValue3 != ''"> and related_para_value3 = #{relatedParaValue3}</if>
            <if test="relatedParaValue4 != null  and relatedParaValue4 != ''"> and related_para_value4 = #{relatedParaValue4}</if>
            <if test="relatedParaValue5 != null  and relatedParaValue5 != ''"> and related_para_value5 = #{relatedParaValue5}</if>
            <if test="relatedParaValue6 != null  and relatedParaValue6 != ''"> and related_para_value6 = #{relatedParaValue6}</if>
            <if test="relatedParaValue7 != null  and relatedParaValue7 != ''"> and related_para_value7 = #{relatedParaValue7}</if>
            <if test="relatedParaValue8 != null  and relatedParaValue8 != ''"> and related_para_value8 = #{relatedParaValue8}</if>
            <if test="relatedParaValue9 != null  and relatedParaValue9 != ''"> and related_para_value9 = #{relatedParaValue9}</if>
            <if test="relatedParaValue10 != null  and relatedParaValue10 != ''"> and related_para_value10 = #{relatedParaValue10}</if>
            <if test="quantityType != null  and quantityType != ''"> and quantity_type = #{quantityType}</if>
            <if test="quantity != null "> and quantity = #{quantity}</if>
            <if test="quantityFormula != null  and quantityFormula != ''"> and quantity_formula = #{quantityFormula}</if>
            <if test="quantityUnit != null  and quantityUnit != ''"> and quantity_unit = #{quantityUnit}</if>
            <if test="priceType != null  and priceType != ''"> and price_type = #{priceType}</if>
            <if test="price != null "> and price = #{price}</if>
            <if test="priceFormula != null  and priceFormula != ''"> and price_formula = #{priceFormula}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectTpAreaOptionalParaPriceById" parameterType="Long" resultMap="TpAreaOptionalParaPriceResult">
        <include refid="selectTpAreaOptionalParaPriceVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTpAreaOptionalParaPrice" parameterType="com.ruoyi.project.business.domain.TpAreaOptionalParaPrice" useGeneratedKeys="true" keyProperty="id">
        insert into tp_area_optional_para_price
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="elevatorModelId != null">elevator_model_id,</if>
            <if test="markupId != null">markup_id,</if>
            <if test="markupKey != null">markup_key,</if>
            <if test="markupName != null">markup_name,</if>
            <if test="paraCode != null">para_code,</if>
            <if test="relatedParaValue1 != null">related_para_value1,</if>
            <if test="relatedParaValue2 != null">related_para_value2,</if>
            <if test="relatedParaValue3 != null">related_para_value3,</if>
            <if test="relatedParaValue4 != null">related_para_value4,</if>
            <if test="relatedParaValue5 != null">related_para_value5,</if>
            <if test="relatedParaValue6 != null">related_para_value6,</if>
            <if test="relatedParaValue7 != null">related_para_value7,</if>
            <if test="relatedParaValue8 != null">related_para_value8,</if>
            <if test="relatedParaValue9 != null">related_para_value9,</if>
            <if test="relatedParaValue10 != null">related_para_value10,</if>
            <if test="quantityType != null">quantity_type,</if>
            <if test="quantity != null">quantity,</if>
            <if test="quantityFormula != null">quantity_formula,</if>
            <if test="quantityUnit != null">quantity_unit,</if>
            <if test="priceType != null">price_type,</if>
            <if test="price != null">price,</if>
            <if test="priceFormula != null">price_formula,</if>
            <if test="status != null">status,</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="markupId != null">#{markupId},</if>
            <if test="markupKey != null">#{markupKey},</if>
            <if test="markupName != null">#{markupName},</if>
            <if test="paraCode != null">#{paraCode},</if>
            <if test="relatedParaValue1 != null">#{relatedParaValue1},</if>
            <if test="relatedParaValue2 != null">#{relatedParaValue2},</if>
            <if test="relatedParaValue3 != null">#{relatedParaValue3},</if>
            <if test="relatedParaValue4 != null">#{relatedParaValue4},</if>
            <if test="relatedParaValue5 != null">#{relatedParaValue5},</if>
            <if test="relatedParaValue6 != null">#{relatedParaValue6},</if>
            <if test="relatedParaValue7 != null">#{relatedParaValue7},</if>
            <if test="relatedParaValue8 != null">#{relatedParaValue8},</if>
            <if test="relatedParaValue9 != null">#{relatedParaValue9},</if>
            <if test="relatedParaValue10 != null">#{relatedParaValue10},</if>
            <if test="quantityType != null">#{quantityType},</if>
            <if test="quantity != null">#{quantity},</if>
            <if test="quantityFormula != null">#{quantityFormula},</if>
            <if test="quantityUnit != null">#{quantityUnit},</if>
            <if test="priceType != null">#{priceType},</if>
            <if test="price != null">#{price},</if>
            <if test="priceFormula != null">#{priceFormula},</if>
            <if test="status != null">#{status},</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="updateTpAreaOptionalParaPrice" parameterType="com.ruoyi.project.business.domain.TpAreaOptionalParaPrice">
        update tp_area_optional_para_price
        <trim prefix="SET" suffixOverrides=",">
            <if test="elevatorModelId != null">elevator_model_id = #{elevatorModelId},</if>
            <if test="markupId != null">markup_id = #{markupId},</if>
            <if test="markupKey != null">markup_key = #{markupKey},</if>
            <if test="markupName != null">markup_name = #{markupName},</if>
            <if test="paraCode != null">para_code = #{paraCode},</if>
            <if test="relatedParaValue1 != null">related_para_value1 = #{relatedParaValue1},</if>
            <if test="relatedParaValue2 != null">related_para_value2 = #{relatedParaValue2},</if>
            <if test="relatedParaValue3 != null">related_para_value3 = #{relatedParaValue3},</if>
            <if test="relatedParaValue4 != null">related_para_value4 = #{relatedParaValue4},</if>
            <if test="relatedParaValue5 != null">related_para_value5 = #{relatedParaValue5},</if>
            <if test="relatedParaValue6 != null">related_para_value6 = #{relatedParaValue6},</if>
            <if test="relatedParaValue7 != null">related_para_value7 = #{relatedParaValue7},</if>
            <if test="relatedParaValue8 != null">related_para_value8 = #{relatedParaValue8},</if>
            <if test="relatedParaValue9 != null">related_para_value9 = #{relatedParaValue9},</if>
            <if test="relatedParaValue10 != null">related_para_value10 = #{relatedParaValue10},</if>
            <if test="quantityType != null">quantity_type = #{quantityType},</if>
            <if test="quantity != null">quantity = #{quantity},</if>
            <if test="quantityFormula != null">quantity_formula = #{quantityFormula},</if>
            <if test="quantityUnit != null">quantity_unit = #{quantityUnit},</if>
            <if test="priceType != null">price_type = #{priceType},</if>
            <if test="price != null">price = #{price},</if>
            <if test="priceFormula != null">price_formula = #{priceFormula},</if>
            <if test="status != null">status = #{status},</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="deleteTpAreaOptionalParaPriceById" parameterType="Long">
        delete from tp_area_optional_para_price where id = #{id}
    </delete>

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