mybatis 传map参数
第一步在你的mapper写上:
List<WeixinUserLocationList> findweixinUserLocations(@Param("params") Map<String, Object> map);
注意就是注解@param 这个,是mybatis的
然后在xml中这样写:
<if test="params.accountId!=null">
and a.accountid=#{params.accountId}
</if>
<if test="params.nickname!=null and params.nickname !=''">
and a.nickname like '%${params.nickname}%'
</if>
<if test="params.beginDate!=null and params.beginDate!=''">
and date_format(a.createtime,'%Y-%m-%d')>=${params.beginDate}
</if>
<if test="params.endDate!=null and params.endDate!=''">
<![CDATA[ and date_format(a.createtime,'%Y-%m-%d')<=${params.endDate} ]]>
</if>
${params.nickname}这种写法参数默认是传字符串,
#{params.accountId}可以取Long,Integer之类的。
好久没有用了,今天记一下...
mybatis 传map参数的更多相关文章
- MyBatis 传List参数 nested exception is org.apache.ibatis.binding.BindingException: Parameter 'idList' not found.
在MyBatis传入List参数时,MyBatis报错:nested exception is org.apache.ibatis.binding.BindingException: Paramete ...
- mybatis循环、mybatis传map
mybatis中使用循环.mybatis传入map案例 <!-- 根据id修改商户提成配置--> <update id="editStopAll" paramet ...
- mybatis传入map参数parameterType
基本数据类型:包含int,String,Date等.基本数据类型作为传参,只能传入一个.通过#{参数名} 即可获取传入的值 复杂数据类型:包含JAVA实体类.Map.通过#{属性名}或#{map的Ke ...
- mybatis传入map参数,map中包含list(输入参数)
1.xml中配置: <!-- 根据条件查询满足条件的ID集合开始 --> <select id="getQuestionsIdsForExamPaper" res ...
- Mybatis判断map参数是否存在
<select id="selectByCondition" parameterType="java.util.HashMap" resultMap=&q ...
- MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer
用MyBatis进行查询,传入参数只有一个时(非Map)如int,报错 There is no getter for property named 'sleevetype' in 'class jav ...
- Mybatis传多个参数(三种解决方案)
第一种方案 DAO层的函数方法 Public User selectUser(String name,String area); 对应的Mapper.xml <select id="s ...
- @Mybatis传多个参数
首选还是按照面向对象的方式执行sql.但是有时候入参对象嵌套的比较深,类中有类,面向对象就不太好处理了 主要有以下两种方式 1.DAO层的函数方法 public User selectUser(Str ...
- MyBatis传入集合 list 数组 map参数的写法
foreach的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合.foreach元素的属性主要有item,index,collection,open,separator,close.ite ...
随机推荐
- 1 JSONP
一.什么是跨域访问举个栗子:在A网站中,我们希望使用Ajax来获得B网站中的特定内容.如果A网站与B网站不在同一个域中,那么就出现了跨域访问问题.你可以理解为两个域名之间不能跨过域名来发送请求或者请求 ...
- perf-perf stat用户层代码分析
perf_event 源码分析 前言 简单来说,perf是一种性能监测工具,它首先对通用处理器提供的performance counter进行编程,设定计数器阈值和事件,然后性能计数器就会在设定事件发 ...
- [如何在Mac下使用gulp] 1.创建项目及安装gulp
1.创建项目 2.安装gulp 3.创建gulpfile.js文件 4.运行gulp 创建项目 -创建项目文件夹命名为firstGulp,并在firstGulp目录下运行 npm init .npm ...
- 2.使用term filter搜索数据
主要知识点 根据用户ID.是否隐藏.帖子ID.发帖日期来搜索帖子 一.准备数据 1.插入一些测试帖子数据 POST /forum/article/_bulk { "index&quo ...
- 洛谷 3391 【模板】文艺平衡树 Treap区间翻转
[题解] 用Treap维护这个序列. 加入的时候直接插入到末尾,这样Treap就变成一棵以插入时间先后为排序关键字的二叉搜索树. 对于翻转操作,我们分裂出需要翻转的区间,给这个区间的root打一个翻转 ...
- [luoguP2870] [USACO07DEC]最佳牛线,黄金Best Cow Line, Gold(后缀数组)
传送门 数据小的话贪心就行. 可以把这个串翻转再接到后面,再求后缀数组,求出 rank 数组就很简单了. ——代码 #include <cstdio> #include <iostr ...
- mysql5.7 简易修改mysql密码
MySQL 5.7 mysql库的user表中已经不再有password字段,取而代之的为authentication_string修改语法相同,步骤也相同.注意:/etc/my.cnf这个配置文件中 ...
- 【ACM】hdu_zs3_1006_AB_201308101123
A/B Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission ...
- 【ACM】NYOJ_288_Time_20130725
Time时间限制:1000 ms | 内存限制:65535 KB 难度:2描述 Digital clock use 4 digits to express time, each digit is ...
- svn重新定位或checkout,提示输入用户名密码,输入后报错
在MyEclipse中,source——>clean up.然后重新定位或checkout