欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mybatis返回Map<Long,Object>

程序员文章站 2022-03-01 12:37:01
...

接口写@Mapkey(‘字段属性’)


    @MapKey("sourceId")
    Map<Long, MainTainInfoVO> selectBySourceIdsAndMaintainSource(@Param("alarmIdList") List<Long> alarmIdList, @Param("maintainSource") int maintainSource);
 <select id="selectBySourceIdsAndMaintainSource" resultMap="BaseResultMapVO">
      select
      <include refid="Base_Column_List_VO"/>
      from bs_maintain_info_t mt
      <where>
        mt.maintain_source = #{maintainSource,jdbcType=INTEGER}
        and
        <if test="alarmIdList !=null and alarmIdList.size()>0">
          mt.source_id in
          <foreach item="item" index="index" collection="alarmIdList" open="(" separator="," close=")">
            #{item}
          </foreach>
        </if>
      </where>

    </select>
相关标签: mybatis mybatis