Mybatis传多个参数
来源:互联网 发布:最好的java培训机构 编辑:程序博客网 时间:2024/06/05 22:42
第一种方案
DAO层的函数方法
public User selectUser(String name,String area);
对应的Mapper.xml
<select id="selectUser" resultMap="BaseResultMap"> select * from user_user_t where user_name = #{0} and user_area=#{1}</select>
其中,#{0}代表接收的是dao层中的第一个参数,#{1}代表dao层中第二参数,更多参数一致往后加即可。
第二种方案
此方法采用Map传多参数.
Dao层的函数方法
public User selectUser(Map paramMap);
对应的Mapper.xml
<select id="selectUser" resultMap="BaseResultMap"> select * from user_user_t where user_name = #{userName,jdbcType=VARCHAR} and user_area=#{userArea,jdbcType=VARCHAR}</select>
第三种方案
Dao层的函数方法
public User selectUser(@param("userName")Stringname, @param("userArea")String area);
对应的Mapper.xml
<select id="selectUser" resultMap="BaseResultMap"> select * from user_user_t where user_name = #{userName,jdbcType=VARCHAR} and user_area=#{userArea,jdbcType=VARCHAR}</select>
<resultMap id="BaseResultMap" type="User"> <id column="id" property="id" jdbcType="BIGINT" /> <result column="user_name " property="userName" jdbcType="VARCHAR" /> <result column="user_area" property="userArea" jdbcType="VARCHAR" /></resultMap>
阅读全文
0 0
- MyBatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数解析
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- Mybatis传多个参数
- MyBatis之传多个参数
- mybatis传多个参数
- Mybatis传多个参数
- Mybatis 传多个参数
- mybatis传多个参数
- POJ 3252Round Numbers(数位dp)
- 迷宫最小步数
- 微信本地调试神器==Charles入门案例
- iOS自动化测试之一体化平台搭建过程中需要学习的部分知识
- Unity3D开发之自绘地形图
- Mybatis传多个参数
- Volatile、AtomicInteger、java并发
- Android游戏开发之飞行射击类游戏原理
- 排序算法
- maven安装本地jar包到maven仓库中
- [UIImage imageWithContentsOfFile:]引发的图片显示异常问题(一半图片是黑的)
- zabbix 3.0.9邮件报警设置
- SDUT-数据结构实验之二叉树六:哈夫曼编码
- RDS for MySQL 通过分区归档历史数据