<?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.miaxis.engine.mapper.EngineInfoMapper">

    <resultMap type="EngineInfo" id="EngineInfoResult">
        <result property="id"    column="id"    />
        <result property="brand"    column="brand"    />
        <result property="model"    column="model"    />
        <result property="enginePowerMajor1500rpm"    column="engine_power_major_1500RPM"    />
        <result property="enginePowerMinor1500rpm"    column="engine_power_minor_1500RPM"    />
        <result property="unitPowerMajor1500rpm"    column="unit_power_major_1500RPM"    />
        <result property="unitPowerMinor1500rpm"    column="unit_power_minor_1500RPM"    />
        <result property="enginePowerMajor1800rpm"    column="engine_power_major_1800RPM"    />
        <result property="enginePowerMinor1800rpm"    column="engine_power_minor_1800RPM"    />
        <result property="unitPowerMajor1800rpm"    column="unit_power_major_1800RPM"    />
        <result property="unitPowerMinor1800rpm"    column="unit_power_minor_1800RPM"    />
        <result property="oilForm"    column="oil_form"    />
        <result property="airIntakeMode"    column="air_intake_mode"    />
        <result property="voltage"    column="voltage"    />
        <result property="displacement"    column="displacement"    />
        <result property="oilConsumption"    column="oil_consumption"    />
        <result property="emissionStandard"    column="emission_standard"    />
        <result property="enginePrice"    column="engine_price"    />
        <result property="engineWeight"    column="engine_weight"    />
        <result property="powerSize"    column="power_size"    />
        <result property="tank40LvPrice"    column="tank_40_lv_price"    />
        <result property="tank40TongPrice"    column="tank_40_tong_price"    />
        <result property="tank50LvPrice"    column="tank_50_lv_price"    />
        <result property="tank50TongPrice"    column="tank_50_tong_price"    />
        <result property="tank40LvWeight"    column="tank_40_lv_weight"    />
        <result property="tank40TongWeight"    column="tank_40_tong_weight"    />
        <result property="tank50LvWeight"    column="tank_50_lv_weight"    />
        <result property="tank50TongWeight"    column="tank_50_tong_weight"    />
        <result property="tankSize"    column="tank_size"    />
        <result property="configurationDescription"    column="configuration_description"    />
        <result property="price"    column="price"    />
        <result property="tankPrice"    column="tank_price"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectEngineInfoVo">
        select * from engine_info
    </sql>

    <select id="selectEngineInfoList" parameterType="EngineInfo" resultMap="EngineInfoResult">
        <include refid="selectEngineInfoVo"/>
        <where>
            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
            <if test="model != null  and model != ''"> and model = #{model}</if>
            <if test="enginePowerMajor1500rpm != null "> and engine_power_major_1500RPM = #{enginePowerMajor1500rpm}</if>
            <if test="enginePowerMinor1500rpm != null "> and engine_power_minor_1500RPM = #{enginePowerMinor1500rpm}</if>
            <if test="unitPowerMajor1500rpm != null "> and unit_power_major_1500RPM = #{unitPowerMajor1500rpm}</if>
            <if test="unitPowerMinor1500rpm != null "> and unit_power_minor_1500RPM = #{unitPowerMinor1500rpm}</if>
            <if test="enginePowerMajor1800rpm != null "> and engine_power_major_1800RPM = #{enginePowerMajor1800rpm}</if>
            <if test="enginePowerMinor1800rpm != null "> and engine_power_minor_1800RPM = #{enginePowerMinor1800rpm}</if>
            <if test="unitPowerMajor1800rpm != null "> and unit_power_major_1800RPM = #{unitPowerMajor1800rpm}</if>
            <if test="unitPowerMinor1800rpm != null "> and unit_power_minor_1800RPM = #{unitPowerMinor1800rpm}</if>
            <if test="oilForm != null  and oilForm != ''"> and oil_form = #{oilForm}</if>
            <if test="airIntakeMode != null  and airIntakeMode != ''"> and air_intake_mode = #{airIntakeMode}</if>
            <if test="voltage != null  and voltage != ''"> and voltage = #{voltage}</if>
            <if test="displacement != null  and displacement != ''"> and displacement = #{displacement}</if>
            <if test="oilConsumption != null  and oilConsumption != ''"> and oil_consumption = #{oilConsumption}</if>
            <if test="emissionStandard != null  and emissionStandard != ''"> and emission_standard = #{emissionStandard}</if>
            <if test="enginePrice != null "> and engine_price = #{enginePrice}</if>
            <if test="engineWeight != null "> and engine_weight = #{engineWeight}</if>
            <if test="powerSize != null  and powerSize != ''"> and power_size = #{powerSize}</if>
            <if test="tank40LvPrice != null "> and tank_40_lv_price = #{tank40LvPrice}</if>
            <if test="tank40TongPrice != null "> and tank_40_tong_price = #{tank40TongPrice}</if>
            <if test="tank50LvPrice != null "> and tank_50_lv_price = #{tank50LvPrice}</if>
            <if test="tank50TongPrice != null "> and tank_50_tong_price = #{tank50TongPrice}</if>
            <if test="tank40LvWeight != null "> and tank_40_lv_weight = #{tank40LvWeight}</if>
            <if test="tank40TongWeight != null "> and tank_40_tong_weight = #{tank40TongWeight}</if>
            <if test="tank50LvWeight != null "> and tank_50_lv_weight = #{tank50LvWeight}</if>
            <if test="tank50TongWeight != null "> and tank_50_tong_weight = #{tank50TongWeight}</if>
            <if test="tankSize != null  and tankSize != ''"> and tank_size = #{tankSize}</if>
            <if test="configurationDescription != null  and configurationDescription != ''"> and configuration_description = #{configurationDescription}</if>
            <if test="price != null "> and price = #{price}</if>
            <if test="tankPrice != null "> and tank_price = #{tankPrice}</if>
        </where>
    </select>
    <select id="getListByFieldName" resultType="string">
        select distinct (${fieldName}) as vals from price_info order by ${fieldName}

    </select>

    <select id="selectEngineInfoList2"  resultMap="EngineInfoResult">
        <include refid="selectEngineInfoVo"/>
        <where>
            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
            <if test="powerKwMin != null "> and engine_power_major_1500RPM <![CDATA[>=]]> #{powerKwMin}</if>
            <if test="powerKwMax != null "> and engine_power_major_1500RPM <![CDATA[<=]]> #{powerKwMax}</if>
        </where>
    </select>

</mapper>
