mybatis里面的时间段写法

来源:互联网 发布:php csrf漏洞 编辑:程序博客网 时间:2024/05/19 14:17
  <!-- 雨情数据查询-->
 <select id="queryRain" parameterType="java.util.HashMap" resultType="java.util.HashMap">
        select * from (select row_number() over (order by a.id desc) rn, a.*,b.stnm  
        from
        dt_rain a inner join tb_station b on  a.stcd=b.stcd
        <where>
          
            <if test="null != stcd and stcd != ''">
                and a.stcd=#{stcd}
            </if>
             <if test="null != tmbegin and tmbegin != ''">
                and
            tm&gt;=#{tmbegin}
            </if>
           <if test="null != tmend and tmend != ''">
                and
            tm&lt;=#{tmend}
            </if>

        </where>
        
        ) t 
        <where>
            <if test="null != pageInfo">
        t.rn&gt;=#{pageInfo.startRow} and t.rn&lt;=#{pageInfo.endRow} 
        </if>
        </where>
        order by t.rn desc
    </select>
 <select id="queryRaincount" parameterType="java.util.HashMap" resultType="java.lang.Integer">
        select count(*)
        from
        dt_rain 
        <where>
          
            <if test="null != stcd and stcd != ''">
                and stcd=#{stcd}
            </if>
              <if test="null != tmbegin and tmbegin != ''">
                and
            tm&gt;=#{tmbegin}
            </if>
           <if test="null != tmend and tmend != ''">
                and
            tm&lt;=#{tmend}
            </if>
        </where>
       
    </select>
0 0
原创粉丝点击