HMIT_Frank
HMIT_Frank
采纳率38.5%
2016-03-05 03:14 阅读 3.3k
已采纳

mybatis 查询返回map<id,javabean>

mybatis 查询返回map,key为某一字段,value为实体类

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    HMIT_Frank HMIT_Frank 2016-11-11 04:28

    --- @MapKey

    点赞 评论 复制链接分享
  • wojiushiwo945you 毕小宝 2016-03-05 03:32

    直接配置查询返回值类型为resultMap就可以了啊。

    点赞 1 评论 复制链接分享
  • qq_15046309 天杪 2019-07-24 18:58

    楼上说的很对,

     <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Enterprise">
            <id column="id" property="id" />
            <result column="e_business_name" property="eBusinessName" />
            <result column="e_telephone" property="eTelephone" />
            <result column="e_websiteurl" property="eWebsiteurl" />
            <result column="e_mailbox" property="eMailbox" />
            <result column="e_address" property="eAddress" />
            <result column="e_introduction" property="eIntroduction" />
            <result column="e_creation_time" property="eCreationTime" />
            <result column="e_creating_users" property="eCreatingUsers" />
            <result column="e_release_time" property="eReleaseTime" />
            <result column="e_release_users" property="eReleaseUsers" />
            <result column="e_edit_users" property="eEditUsers" />
            <result column="e_edit_time" property="eEditTime" />
        </resultMap>
    
      <select id="list" resultMap="BaseResultMap">
            select
            *
             from bw_enterprise
            <if test="condition != null and condition != ''">
                where e_business_name like CONCAT('%',#{condition},'%')
            </if>
        </select>
    
    
    点赞 评论 复制链接分享

相关推荐