<?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.tofly.xrtygis.custom.mapper.PricePlanMapper">

    <select id="selectMaxTime" resultType="map">
        select year, max(CREATE_TIME) time
        from TF_YWPN_COSTBGPRICE_W
        group by year
        order by year
    </select>

    <select id="getPriceHistory" resultType="map">
        select id, year,UP_DATE, pacdj, yldj, pam_zsdj, pam_wndj, ftdj, cndj, gmsjfhydj, sydj, dlddj_one, dlddj_two, wnzydj,
        ysfdj, szysdj, bcsdj, create_time, pac2dj, qbjzgdj, otherdj, jbdldj_one, jbdldj_two,
        ( select real_name from tf_smpn_user_x where id= p.CREATE_USER) user_name
        from TF_YWPN_COSTBGPRICE_W p
        <where>
            <if test="year != null">
                YEAR = #{year}
            </if>
            <if test="start != null and end != null">
                and to_char(UP_DATE,'yyyy-mm-dd hh24:mi:ss') between #{start} and #{end}
            </if>
        </where>
        order by UP_DATE desc
    </select>


</mapper>