Skip to content

map value #2865

Open
Open
@min1854

Description

@min1854

Feature request

In daily query, only the key of the map can be defined. I hope that the value of the map can also be defined, which can be returned directly Map<Integer, Integer>

public interface NoticeMapper {

  @MapKey("status")
  @MapValue("count")
  Map<Integer, Integer> groupStatus();


}
<mapper namespace="org.apache.ibatis.submitted.mapkey_value.NoticeMapper">



  <resultMap id="groupStatusMap" type="hashmap">
    <result column="count" javaType="Integer" property="count"/>
    <result column="status" javaType="Integer" property="status"/>
  </resultMap>


  <select id="groupStatus" resultMap="groupStatusMap">
  select count(*) as count , status
    from notice group by status
  </select>



</mapper>

#2863

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions