第一步在你的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参数的更多相关文章

  1. 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 ...

  2. mybatis循环、mybatis传map

    mybatis中使用循环.mybatis传入map案例 <!-- 根据id修改商户提成配置--> <update id="editStopAll" paramet ...

  3. mybatis传入map参数parameterType

    基本数据类型:包含int,String,Date等.基本数据类型作为传参,只能传入一个.通过#{参数名} 即可获取传入的值 复杂数据类型:包含JAVA实体类.Map.通过#{属性名}或#{map的Ke ...

  4. mybatis传入map参数,map中包含list(输入参数)

    1.xml中配置: <!-- 根据条件查询满足条件的ID集合开始 --> <select id="getQuestionsIdsForExamPaper" res ...

  5. Mybatis判断map参数是否存在

    <select id="selectByCondition" parameterType="java.util.HashMap" resultMap=&q ...

  6. 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 ...

  7. Mybatis传多个参数(三种解决方案)

    第一种方案 DAO层的函数方法 Public User selectUser(String name,String area); 对应的Mapper.xml <select id="s ...

  8. @Mybatis传多个参数

    首选还是按照面向对象的方式执行sql.但是有时候入参对象嵌套的比较深,类中有类,面向对象就不太好处理了 主要有以下两种方式 1.DAO层的函数方法 public User selectUser(Str ...

  9. MyBatis传入集合 list 数组 map参数的写法

    foreach的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合.foreach元素的属性主要有item,index,collection,open,separator,close.ite ...

随机推荐

  1. Linux cat 命令

    cat命令是linux下的一个文本输出命令,通常是用于观看某个文件的内容的:cat主要有三大功能:1.一次显示整个文件.$ cat   filename2.从键盘创建一个文件.$ cat  >  ...

  2. Django - 创建多对多及增加示例

    创建多对多: 方式一: 自定义关系表 备注:自定义表Host.Application,通过自定义表,将表Host和Application进行关联(通过外键方式工): 执行语句:python manag ...

  3. (C/C++学习)12.获取系统时间制作时钟(system()略解)

    说明:通过调用函数来获取系统当前时间,并制作一个数字式的时钟,时钟的显示包括年.月.日.小时.分以及秒,通过系统屏幕的刷新来对不断更新的时间进行屏幕的显示. 一.对相关函数的学习 1.time_t t ...

  4. sql server的 between and 日期问题

  5. Python与常见加密方式

    前言 我们所说的加密方式,都是对二进制编码的格式进行加密的,对应到Python中,则是我们的Bytes. 所以当我们在Python中进行加密操作的时候,要确保我们操作的是Bytes,否则就会报错. 将 ...

  6. 【郑轻邀请赛 A】tmk射气球

    [题目链接]:https://acm.zzuli.edu.cn/zzuliacm/problem.php?id=2127 [题意] [题解] 把气球和飞艇所代表的直线投影到xoy面上 设气球所在位置为 ...

  7. [Usaco2014 Mar]Sabotage

    [Usaco2014 Mar]Sabotage 题目 Farmer John"s arch-nemesis, Farmer Paul, has decided to sabotage Far ...

  8. noip模拟赛 楼

    分析:题目可以转化为对于一个数,对它进行x次减法操作,n-x次加法操作,使他变成最小的非负整数.因为每减一次数就会减小,次数是一定的,所以可以二分x,就可以了. #include <cstdio ...

  9. mode-c++

    /*感谢机房JYW的友情馈赠*/#include <iostream> #include <cstdio> #include <cstring> #include ...

  10. SQL Server内核架构剖析与NUMA

    http://www.cnblogs.com/lyhabc/p/4272053.html http://www.cnblogs.com/lyhabc/archive/2013/02/05/289247 ...