<?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.aqin.dao.mapper1.TrmmIndexMapper">
<resultMap id="BaseResultMap" type="com.aqin.dao.domain.TrmmIndexDO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="created_time" property="createdTime" jdbcType="BIGINT"/>
<result column="modified_time" property="modifiedTime" jdbcType="BIGINT"/>
<result column="month" property="month" jdbcType="SMALLINT"/>
<result column="x" property="x" jdbcType="DOUBLE"/>
<result column="y" property="y" jdbcType="DOUBLE"/>
<result column="my_row" property="myRow" jdbcType="INTEGER"/>
<result column="my_col" property="myCol" jdbcType="INTEGER"/>
<result column="trmm_min" property="trmmMin" jdbcType="DOUBLE"/>
<result column="trmm_max" property="trmmMax" jdbcType="DOUBLE"/>
<result column="month_arr" property="monthArr" jdbcType="ARRAY" typeHandler="com.aqin.util.ArrayTypeHandler"/>
</resultMap>
<resultMap id="BaseResultMap2" type="com.aqin.dao.domain.CitrusDO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="city_id" property="cityId" jdbcType="VARCHAR"/>
<result column="month" property="month" jdbcType="SMALLINT"/>
<result column="test" property="test" jdbcType="SMALLINT"/>
<result column="trmmmin" property="trmmMin" jdbcType="VARCHAR"/>
<result column="trmmmax" property="trmmMax" jdbcType="VARCHAR"/>
<result column="lstmin" property="lstMin" jdbcType="VARCHAR"/>
<result column="lstmax" property="lstMax" jdbcType="VARCHAR"/>
</resultMap>
<select id="getTest" parameterType="java.lang.Integer" resultMap="BaseResultMap2">
select * from trmm_index index
left join citrus c on c.month=ANY(index.month_arr)
WHERE c.test=#{param}
</select>
</mapper>
这里涉及了两张表的嵌套查询(表1:trmm_index ,表2: citrus)
select * from trmm_index index
left join citrus c on c.month=ANY(index.month_arr)
WHERE c.test=#{param}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/135468.html