mybatis 之 parameterType="java.util.HashMap">
/**
* 根据goods_no 和 goods_id 来查询商品信息
*
* @param goodsNos
* @return
*/
public List<Goods> getGoodsListByIdandNo(Map<String, List> goodsList);
public ServiceMessage<List<Goods>> getGoodsListByIdandNo(
List<Goods> goodsList) {
try {
if (goodsList == null || goodsList.size() <= 0) {
return super.returnParamsError("goodsNoList is null");
}
List<String> list1 = new ArrayList<String>();
List<Long> list2 = new ArrayList<Long>();
Map<String, List> map = new HashMap<String, List>();
for (Goods g : goodsList) {
list1.add(g.getGoodsNo());
list2.add(g.getGoodsId());
}
map.put("list1", list1);
map.put("list2", list2);
return super.returnCorrectResult(iGoodsMapper
.getGoodsListByIdandNo(map));
} catch (Throwable e) {
logger.error(e.getMessage(), e);
return super.returnException(e);
}
}
<select id="getGoodsListByIdandNo" resultMap="goodsResultImg" parameterType="java.util.HashMap">
<if test="list1 != null or list2!= null ">
select g.*, pi.pro_image_url
from goods g
left join (select pig.product_id as product_id,
pig.image_order,
pig.pro_image_url as pro_image_url
from product_img pig
where pig.image_type = 'list'
) pi
on g.product_id = pi.product_id
where g.is_delete = 'N'
<if test="list1 != null">
and g.goods_no in
<foreach item="goodsNo" collection="list1" open="(" close=")" separator=",">
#{goodsNo}
</foreach>
</if>
<if test="list2 != null">
and g.goods_id in
<foreach item="goodsId" collection="list2" open="(" close=")" separator=",">
#{goodsId}
</foreach>
</if>
</if>
</select>
mybatis 之 parameterType="java.util.HashMap">的更多相关文章
- mybatis 之 parameterType="java.util.List"
<!-- 添加 --> <insert id="saveBatchMemberRoleConnRepModel" parameterType="java ...
- mybatis 之 parameterType="String" resultType="java.util.HashMap">
public ServiceMessage<Map<String, String>> getGoodsStockNo( List<Map<String, Strin ...
- org.apache.ibatis.builder.IncompleteElementException: Could not find result map java.util.HashMap
这样的配置有问题吗? <select id="getFreightCollectManagementList" resultMap="java.util.HashM ...
- Mabitis 多表查询(一)resultType=“java.util.hashMap”
1.进行单表查询的时候,xml标签的写法如下 进行多表查询,且无确定返回类型时 xml标签写法如下: <select id="Volume" parameterType=&q ...
- EL1008E: Property or field 'timestamp' cannot be found on object of type 'java.util.HashMap
2018-06-22 09:50:19.488 INFO 20096 --- [nio-8081-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : ...
- Could not find result map java.util.HashMap
Could not find result map java.util.HashMap 找不到结果图java.util.HashMap MyBatis 找不到返回的 'resultMap'!把resu ...
- java:警告:[unchecked] 对作为普通类型 java.util.HashMap 的成员的put(K,V) 的调用未经检查
java:警告:[unchecked] 对作为普通类型 java.util.HashMap 的成员的put(K,V) 的调用未经检查 一.问题:学习HashMap时候,我做了这样一个程序: impor ...
- 解决Apache CXF 不支持传递java.sql.Timestamp和java.util.HashMap类型问题
在项目中使用Apache开源的Services Framework CXF来发布WebService,CXF能够很简洁与Spring Framework 集成在一起,在发布WebService的过程中 ...
- LinkedHashMap和HashMap的比较使用 由于现在项目中用到了LinkedHashMap,并不是太熟悉就到网上搜了一下。 ? import java.util.HashMap; impo
LinkedHashMap和HashMap的比较使用 由于现在项目中用到了LinkedHashMap,并不是太熟悉就到网上搜了一下. import java.util.HashMap; import ...
随机推荐
- ps 和 grep 查找消除 grep自身查找
用ps -def | grep查找进程很方便,最后一行总是会grep自己. $ ps -def | grep dragonfly-framework dean 5273 5272 0 15:23 pt ...
- 关于Unity中协程、多线程、线程锁、www网络类的使用
协程 我们要下载一张图片,加载一个资源,这个时候一定不是一下子就加载好的,或者说我们不一定要等它下载好了才进行其他操作,如果那样的话我就就卡在了下载图片那个地方,傻住了.我们希望我们只要一启动加载的命 ...
- 【Python】CentOs7 Python3安装Openssl以及解决ssl问题
一.安装OpenssL 1.下载的压缩包放在根目录 wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz 2.在文件夹下解压缩,得到open ...
- 第三百五十七节,Python分布式爬虫打造搜索引擎Scrapy精讲—利用开源的scrapy-redis编写分布式爬虫代码
第三百五十七节,Python分布式爬虫打造搜索引擎Scrapy精讲—利用开源的scrapy-redis编写分布式爬虫代码 scrapy-redis是一个可以scrapy结合redis搭建分布式爬虫的开 ...
- unity----------------3D模型讲解
图文详解Unity3D中Material的Tiling和Offset是怎么回事 回到顶部(go to top) Tiling和Offset概述 Tiling表示UV坐标的缩放倍数,Offset表示UV ...
- CI框架 -- 创建类库
当我们使用 “类库” 这个词的时候,通常我们指的是位于 libraries 这个目录下的那些类. 接下来我们将介绍 如何在 application/libraries 目录下创建你自己的类库,和全局的 ...
- (实用)Ubuntu 、CentOS更换国内源
Ubuntu更换apt-get源 通过编辑/etc/apt/sources.list文件,我们能够更换Ubuntu的默认软件更新源.通常是将其换成一些国内比较知名的源.本文主要列举这些内容. 注意,在 ...
- Linux服务器 java生成的图片验证码乱码问题
问题:如图所示项目中生成的图形验证码不能正常显示出需要的字体 原因: linux下没有对应的字体 查找项目中使用到系统字体的地方,如下: 解决: 1. 在本地 路径 C:\Windows\Fonts ...
- mysql 5.1超过默认8小时空闲时间解决办法(错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure)
报错: MySQL第二天早上第一次连接超时报错, com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications lin ...
- UITableView:改变 TableHeaderView 的高度
参考:http://stackoverflow.com/a/526825 有这么一种需求,在列表顶端显示一些别样的数据,而这个别样的数据则需要通过一个别样的 View 来展现,它便是 UITableV ...