mybatis 查询返回Map<String,Object>类型
作者:菜鸟笔记 发布时间:2023-11-14 07:06:09
标签:mybatis,返回,Map类型
mybatis 查询返回Map<String,Object> 类型,平时没太注意怎么用,今天又遇到了总结记录一下,方便以后处理此类问题。
Mapper.java中的方法:
@MapKey("userId")
Map<String,UserInfo> personalInfoByUserIds(List<String> list);
mapper.xml文件中的配置:
<resultMap id="BaseResultMap" type="com.*.*.entity.UserInfo">
<id column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="user_code" jdbcType="INTEGER" property="userCode" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="user_gender" jdbcType="INTEGER" property="userGender" />
<result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
<result column="birthday" jdbcType="DATE" property="birthday" />
</resultMap>
<select id="personalInfoByUserIds" resultMap="BaseResultMap">
select * from t_user_info i where i.user_id in
<foreach collection="list" item="item" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
返回结果如下:
来源:https://xingfeiyin.blog.csdn.net/article/details/123738647
0
投稿
猜你喜欢
- 本文实例为大家分享了Android自定义View图片按Path运动旋转的具体代码,供大家参考,具体内容如下View:/** * autho
- 本文实例总结了C#中split用法。分享给大家供大家参考,具体如下:以下是我转载的两个不同的人的,方便大家及自己查阅string s=&qu
- 本文实例讲述了java生成jar包的方法,是非常实用的技巧。分享给大家供大家参考。具体分析如下:很多Java初学者都会有这样的疑问:Java
- 以前使用MyEclipse已经习惯了,后来改成Eclipse感觉怪怪的。在创建web项目之前首先配置好jdk环境和tomcat环境(即在开发
- 前言我们在学习Windows应用程序开发中,经常会用到消息对话框给用户或者管理员一些的消息提示,它们都是基于对MessageBox类的消息对
- 本文实例讲述了C#检测上传文件真正类型的方法。分享给大家供大家参考。具体分析如下:对于用户上传的文件如果只是根据扩展名判断,很容易上传上来可
- 本文实例为大家分享了C#实现快速排序的具体代码,供大家参考,具体内容如下代码:/// <summary> /// 排序 ///
- 前言本文告诉大家如何使用 Marshal 做出可以快速释放内存的大数组。最近在做 3D ,需要不断申请一段大内存数组,然后就释放他,但是 C
- 突然对悬浮窗体感兴趣,查资料做了个小Demo,效果是点击按钮后,关闭当前Activity,显示悬浮窗口,窗口可以拖动,双击后消失。效果图如下
- 一直以来做对外的接口文档都比较原始,基本上都是手写的文档传来传去,最近发现了一个新玩具,可以在接口上省去不少麻烦。swagger是一款方便展
- 前言最近被问到了这个问题,第一次回答的也是很不好,在此参考网上答案进行整理记录。供大家学习参考。Synchronized修饰非静态方法Syn
- 混合事务在ORM框架的事务管理器的事务内,使用JdbcTemplate执行SQL是不会纳入事务管理的。下面进行源码分析,看为什么必须要在Da
- 本文实例讲述了C#实现控制Windows系统关机、重启和注销的方法。分享给大家供大家参考。具体分析如下:使用.NET和C#.NET,我们可以
- jpa配置多数据源教程很多,在Springboot2之后有一些变化,来看一下。application.yml如下spring:
- android studio 版本不同连接手机方式有细微的不同,主要方式相似。介绍主要分手机和电脑两部分介绍。一、手机部分1、手机端下载一个
- TCPServer 1、使用的通讯通道:socket2、用到的基本功能:①Bind,②Listen,③BeginAccept④En
- 一、项目简述环境配置:Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,
- 1.分发对象-MotionEvent事件类型有:1.ACTION_DOWN-----手指刚接触屏幕2.ACTION_MOVE------手指
- 前言前面几篇我们学习的都是单表查询,就是对一张表中的数据进行查询。而实际项目中,基本都会有多张表联合查询的情况,今天我们就来了解下JPA的联
- 自定义注解实现接口幂等性方式近期需要对接口进行幂等性的改造,特此记录下。背景在微服务架构中,幂等是一致性方面的一个重要概念。一个幂等操作的特