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 ...
随机推荐
- git clone下载代码,中途断掉怎么办?
问题如下: 解决办法: 1)运行以下命令进行clone $ git clone --recursive https:xxxxxx 2)进入项目根目录,继续下载 $ cd eigen-git-mirro ...
- linux 的sed命令解释 sed ':t;N;s/\n/,/;b t' 将换行符换成逗号
linux 的sed命令解释 sed ':t;N;s/\n/,/;b t' 将换行符换成逗号 实现的功能是吧换行符换成逗号了,自己试验过. 求解释,:t N b t 都是什么意思??? :t 定义la ...
- JS练习:商品的左右选择
代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title ...
- MySQL之索引以及正确使用索引
一.MySQL中常见索引类型 普通索引:仅加速查询 主键索引:加速查询.列值唯一.表中只有一个(不可有null) 唯一索引:加速查询.列值唯一(可以有null) 组合索引:多列值组成一个索引,专门用于 ...
- vs2015 配置 cplex
首先设置模式为Release, 根据软件选择x86或x64 附加库目录(链接器 - 常规) C:\Program Files\IBM\ILOG\CPLEX_Studio128\cplex\lib\x6 ...
- emacs 定制进缩风格
纵览 emacs 文档中描述,进缩风格实现只需要两步:第一步,根据内容与上下文找到对应的进缩风格的类别:第二步,依据进缩风格决定的表达式锚点的进缩偏移.下面我们对 cc-mode 风格定制加以说明. ...
- Linxu基础入门
Linux命令大全:http://man.linuxde.net/ 创建目录 使用 mkdir 命令创建目录 mkdir $HOME/testFolder 切换目录 使用 cd 命令切换目录 cd $ ...
- 【MFC Programming】 Using Dialog To Set A Correlate Menu
This blog will show how to display a menu we designed in a dialog. 1.Insert a new dialog& a new ...
- 20180620关于使用xtrabackup热还原数据库
参看:http://www.cnblogs.com/waynechou/p/xtrabackup_backup.html http://www.cnblogs.com/waynechou/p/xtra ...
- assign retain 和copy的区别
assign 对基础数据类型 (NSInteger,CGFloat)和C数据类型(int, float, double, char)等 等. 此标记说明设置器直接进⾏行赋值,这也是默认值.在使⽤用垃圾 ...