<?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.price.mapper.PriceInfoMapper">
    <resultMap type="PriceInfo" id="PriceInfoResult">
        <result property="id"    column="id"    />
        <result property="unitModel"    column="unit_model"    />
        <result property="unitPowerKw"    column="unit_power_kw"    />
        <result property="unitPowerKva"    column="unit_power_kva"    />
        <result property="rate"    column="rate"    />
        <result property="brand"    column="brand"    />
        <result property="dieselEngineModel"    column="diesel_engine_model"    />
        <result property="speed"    column="speed"    />
        <result property="powerPrice"    column="power_price"    />
        <result property="generatorModelFstf"    column="generator_model_fstf"    />
        <result property="generatorPriceFstf"    column="generator_price_fstf"    />
        <result property="generatorModelStf"    column="generator_model_stf"    />
        <result property="generatorPriceStf"    column="generator_price_stf"    />
        <result property="generatorModelLlsm"    column="generator_model_llsm"    />
        <result property="generatorPriceLlsm"    column="generator_price_llsm"    />
        <result property="generatorModelMls"    column="generator_model_mls"    />
        <result property="generatorPriceMls"    column="generator_price_mls"    />
        <result property="generatorModelMda"    column="generator_model_mda"    />
        <result property="generatorPriceMda"    column="generator_price_mda"    />
        <result property="mutePrice"    column="mute_price"    />
        <result property="openPrice"    column="open_price"    />
        <result property="atsModel"    column="ats_model"    />
        <result property="atsPrice"    column="ats_price"    />
        <result property="batteryModel"    column="battery_model"    />
        <result property="batteryPrice"    column="battery_price"    />
        <result property="totalCostMuteFstf"    column="total_cost_mute_fstf"    />
        <result property="totalCostOpenFstf"    column="total_cost_open_fstf"    />
        <result property="totalCostMuteStf"    column="total_cost_mute_stf"    />
        <result property="totalCostOpenStf"    column="total_cost_open_stf"    />
        <result property="totalCostMuteLlsm"    column="total_cost_mute_llsm"    />
        <result property="totalCostOpenLlsm"    column="total_cost_open_llsm"    />
        <result property="totalCostMuteMls"    column="total_cost_mute_mls"    />
        <result property="totalCostOpenMls"    column="total_cost_open_mls"    />
        <result property="totalCostMuteMda"    column="total_cost_mute_mda"    />
        <result property="totalCostOpenMda"    column="total_cost_open_mda"    />
        <result property="muteParms"    column="mute_parms"    />
        <result property="openParms"    column="open_parms"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectPriceInfoVo">
        select * from price_info
    </sql>

    <select id="selectPriceInfoList" parameterType="PriceInfo" resultMap="PriceInfoResult">
        <include refid="selectPriceInfoVo"/>
        <where>
            <if test="unitPowerKwMin != null "> and unit_power_kw <![CDATA[>=]]> #{unitPowerKwMin}</if>
            <if test="unitPowerKwMax != null "> and unit_power_kw <![CDATA[<=]]> #{unitPowerKwMax}</if>
            <if test="unitPowerKvaMin != null "> and unit_power_kva <![CDATA[>=]]> #{unitPowerKvaMin}</if>
            <if test="unitPowerKvaMax != null "> and unit_power_kva <![CDATA[<=]]> #{unitPowerKvaMax}</if>
            <if test="unitModel != null  and unitModel != ''"> and unit_model = #{unitModel}</if>
            <if test="unitPowerKw != null "> and unit_power_kw = #{unitPowerKw}</if>
            <if test="unitPowerKva != null "> and unit_power_kva = #{unitPowerKva}</if>
            <if test="rate != null "> and rate = #{rate}</if>
            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
            <if test="dieselEngineModel != null  and dieselEngineModel != ''"> and diesel_engine_model = #{dieselEngineModel}</if>
            <if test="speed != null "> and speed = #{speed}</if>
            <if test="powerPrice != null "> and power_price = #{powerPrice}</if>
            <if test="generatorModelFstf != null  and generatorModelFstf != ''"> and generator_model_fstf = #{generatorModelFstf}</if>
            <if test="generatorPriceFstf != null "> and generator_price_fstf = #{generatorPriceFstf}</if>
            <if test="generatorModelStf != null  and generatorModelStf != ''"> and generator_model_stf = #{generatorModelStf}</if>
            <if test="generatorPriceStf != null "> and generator_price_stf = #{generatorPriceStf}</if>
            <if test="generatorModelLlsm != null  and generatorModelLlsm != ''"> and generator_model_llsm = #{generatorModelLlsm}</if>
            <if test="generatorPriceLlsm != null "> and generator_price_llsm = #{generatorPriceLlsm}</if>
            <if test="generatorModelMls != null  and generatorModelMls != ''"> and generator_model_mls = #{generatorModelMls}</if>
            <if test="generatorPriceMls != null "> and generator_price_mls = #{generatorPriceMls}</if>
            <if test="generatorModelMda != null  and generatorModelMda != ''"> and generator_model_mda = #{generatorModelMda}</if>
            <if test="generatorPriceMda != null "> and generator_price_mda = #{generatorPriceMda}</if>
            <if test="mutePrice != null "> and mute_price = #{mutePrice}</if>
            <if test="openPrice != null "> and open_price = #{openPrice}</if>
            <if test="atsModel != null  and atsModel != ''"> and ats_model = #{atsModel}</if>
            <if test="atsPrice != null "> and ats_price = #{atsPrice}</if>
            <if test="batteryModel != null  and batteryModel != ''"> and battery_model = #{batteryModel}</if>
            <if test="batteryPrice != null "> and battery_price = #{batteryPrice}</if>
            <if test="totalCostMuteFstf != null "> and total_cost_mute_fstf = #{totalCostMuteFstf}</if>
            <if test="totalCostOpenFstf != null "> and total_cost_open_fstf = #{totalCostOpenFstf}</if>
            <if test="totalCostMuteStf != null "> and total_cost_mute_stf = #{totalCostMuteStf}</if>
            <if test="totalCostOpenStf != null "> and total_cost_open_stf = #{totalCostOpenStf}</if>
            <if test="totalCostMuteLlsm != null "> and total_cost_mute_llsm = #{totalCostMuteLlsm}</if>
            <if test="totalCostOpenLlsm != null "> and total_cost_open_llsm = #{totalCostOpenLlsm}</if>
            <if test="totalCostMuteMls != null "> and total_cost_mute_mls = #{totalCostMuteMls}</if>
            <if test="totalCostOpenMls != null "> and total_cost_open_mls = #{totalCostOpenMls}</if>
            <if test="totalCostMuteMda != null "> and total_cost_mute_mda = #{totalCostMuteMda}</if>
            <if test="totalCostOpenMda != null "> and total_cost_open_mda = #{totalCostOpenMda}</if>
            <if test="muteParms != null  and muteParms != ''"> and mute_parms = #{muteParms}</if>
            <if test="openParms != null  and openParms != ''"> and open_parms = #{openParms}</if>
        </where>
    </select>




    <select id="getListByFieldName" resultType="string">
        select distinct (${fieldName}) as vals from price_info order by ${fieldName}

    </select>

</mapper>
