mybatis 中IN 查询写法
来源:互联网 发布:开淘宝店需要什么费用 编辑:程序博客网 时间:2024/05/21 07:59
这个问题昨天困扰了我2个小时,终于在同事的开导下,这么写出来了,其实这种方法以前也写过,但是忘记了,现在发表到博客上面备忘。
- /**
- * 获取性别分析指标
- *
- * @author shangql
- * @date 2013-1-17
- * @param date
- * @return
- * @return List<Map<String,Object>>
- */
- @Override
- public List<Map<String, Object>> getGender(String countValue, String date, Integer[] brandIds)throws Exception {
- Map<String, Object> inParamMap = new HashMap<String, Object>();
- inParamMap.put("countValue", countValue);
- inParamMap.put("date", date);
- inParamMap.put("brandIdsList", parseToParam(brandIds));
- inParamMap.put("size", EmptyUtil.isEmpty(brandIds)?0:brandIds.length);
- List<Map<String, Object>> resultList = dao.queryForList("ConsumerInfoServiceImpl/getGender", inParamMap);
- return nonEmpty(resultList);
- }
- /**
- * 判断非空数据
- *
- * @author shangql
- * @date 2013-1-23
- * @param srcList
- * @return
- * @return List<Map<String,Object>>
- */
- private List<Map<String, Object>> nonEmpty(List<Map<String, Object>> srcList) {
- List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
- Map<String, Object> itemMap = null;
- if (EmptyUtil.isEmpty(srcList)) {
- itemMap = new HashMap<String, Object>();
- itemMap.put("name", "暂无数据");
- itemMap.put("data1", 0);
- resultList.add(itemMap);
- return resultList;
- } else {
- return srcList;
- }
- }
- /**
- * 装配条件参数
- *
- * @author shangql
- * @date 2013-1-24
- * @param brandNames
- * @return
- * @return String
- */
- private List<Map<String, Object>> parseToParam(Integer[] brandIds)throws Exception{
- List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
- Map<String, Object> itemMap = null;
- if(!EmptyUtil.isEmpty(brandIds)){
- for (Integer i : brandIds) {
- itemMap = new HashMap<String, Object>();
- itemMap.put("brandId", i);
- resultList.add(itemMap);
- }
- }
- return resultList;
- }
- mybatis 中IN 查询写法
- MyBatis中like查询写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的写法总结
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- mybatis中模糊查询的写法
- mybatis中模糊查询的写法
- JAVA通过反映方法实现C#的委托
- 分享70套约2000个视频教程(js,Jquery,java,.net,html5,php,数据库)
- highcharts中x轴曲线不连续时的解决办法
- java 倒序读取文件(最后一行开始读取)
- 线段树HDU1698(成段更新)
- mybatis 中IN 查询写法
- 在QQ通讯录之前拦截短信(android)
- hessian杂篇
- myeclipse10.0优化
- Java程序发送邮件的两种方法
- JSF之介绍篇
- 线性表的简单实现
- log日志框架和LocationAwareLogger问题
- UITableView for Android