postgreSQL分页查询

<?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.finance.rst.map.engine.backend.dao.mapper.MapMetadataMapper">
  <resultMap id="BaseResultMap" type="com.finance.rst.map.engine.backend.dao.model.MapMetadata">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="img_name" jdbcType="VARCHAR" property="imgName" />
    <result column="satellite_source" jdbcType="VARCHAR" property="satelliteSource" />
    <result column="satellite_code" jdbcType="VARCHAR" property="satelliteCode" />
    <result column="img_channel" jdbcType="VARCHAR" property="imgChannel" />
    <result column="img_time" jdbcType="DATE" property="imgTime" />
    <result column="img_origin_path" jdbcType="VARCHAR" property="imgOriginPath" />
    <result column="img_compress_path" jdbcType="VARCHAR" property="imgCompressPath" />
    <result column="cloud_cover" jdbcType="NUMERIC" property="cloudCover" />
    <result column="off_nadir_angle" jdbcType="NUMERIC" property="offNadirAngle" />
    <result column="sun_azimuth" jdbcType="NUMERIC" property="sunAzimuth" />
    <result column="sun_elevation" jdbcType="NUMERIC" property="sunElevation" />
    <result column="projection_method" jdbcType="VARCHAR" property="projectionMethod" />
    <result column="position_tl" jdbcType="VARCHAR" property="positionTl" />
    <result column="position_tr" jdbcType="VARCHAR" property="positionTr" />
    <result column="position_bl" jdbcType="VARCHAR" property="positionBl" />
    <result column="position_br" jdbcType="VARCHAR" property="positionBr" />
    <result column="position_md" jdbcType="VARCHAR" property="positionMd" />
    <result column="position_type_tl" jdbcType="OTHER" property="positionTypeTl" />
    <result column="position_type_tr" jdbcType="OTHER" property="positionTypeTr" />
    <result column="position_type_bl" jdbcType="OTHER" property="positionTypeBl" />
    <result column="position_type_br" jdbcType="OTHER" property="positionTypeBr" />
    <result column="position_type_md" jdbcType="OTHER" property="positionTypeMd" />
    <result column="position_origin" jdbcType="VARCHAR" property="positionOrigin" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_user" jdbcType="VARCHAR" property="updateUser" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>

  <select id="getTotalMapMetadataList" parameterType="map" resultType="int">
    SELECT COUNT(1) FROM map_metadata
    where 1=1
    <if test="cloudCover != null and cloudCover != '' ">
      and cloud_cover = #{cloudCover} :: NUMERIC
    </if>
    <if test="offNadirAngle != null and offNadirAngle != '' ">
      and off_nadir_angle = #{offNadirAngle} :: NUMERIC
    </if>
    <if test="sunAzimuth != null and sunAzimuth != '' ">
      and sun_azimuth = #{sunAzimuth} :: NUMERIC
    </if>
    <if test="sunElevation != null and sunElevation != '' ">
      and sun_elevation = #{sunElevation} :: NUMERIC
    </if>
    <if test="imgTimeStart != null and imgTimeStart != '' and imgTimeEnd != null and imgTimeEnd != ''">
      and img_time BETWEEN #{imgTimeStart} :: date AND #{imgTimeEnd} :: date
    </if>
    <if test="positionLists != null and positionLists != ''">
      and ${positionLists}
    </if>
  </select>

  <select id="queryMapMetadataList" parameterType="map" resultMap="BaseResultMap">
    SELECT * FROM map_metadata
    where 1=1
    <if test="cloudCover != null and cloudCover != '' ">
      and cloud_cover = #{cloudCover} :: NUMERIC
    </if>
    <if test="offNadirAngle != null and offNadirAngle != '' ">
      and off_nadir_angle = #{offNadirAngle} :: NUMERIC
    </if>
    <if test="sunAzimuth != null and sunAzimuth != '' ">
      and sun_azimuth = #{sunAzimuth} :: NUMERIC
    </if>
    <if test="sunElevation != null and sunElevation != '' ">
      and sun_elevation = #{sunElevation} :: NUMERIC
    </if>
    <if test="imgTimeStart != null and imgTimeStart != '' and imgTimeEnd != null and imgTimeEnd != ''">
      and img_time BETWEEN #{imgTimeStart} :: date AND #{imgTimeEnd} :: date
    </if>
    <if test="positionLists != null and positionLists != ''">
      and ${positionLists}
    </if>
    <if test="start != null ">
      LIMIT #{size}  OFFSET #{start}
    </if>
  </select>
</mapper>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值