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 ...
随机推荐
- Spring面试,IoC和AOP的理解
spring 的优点?1.降低了组件之间的耦合性 ,实现了软件各层之间的解耦 2.可以使用容易提供的众多服务,如事务管理,消息服务等 3.容器提供单例模式支持 4.容器提供了AOP技术,利用它很容易实 ...
- python2 python3 字符串 编码格式 处理
使用python的ctypes调用c语言中的函数,传入字符串,打印输出异常.解决方法记录于此. 参考连接: http://blog.csdn.net/u011546806/article/detail ...
- Newtonsoft.Json 序列化小写首字母
//json对象命名小驼峰式转换var json = JsonConvert.SerializeObject(newAccount, Formatting.Indented, new JsonSeri ...
- (原创)关于FFmpeg的一些有关的初始化默认值的问题
最近手头上要做一个媒体格式分析库,能解析文件,流的视频格式,编码格式等一些重要的视频参数能进行尽量多的提取.当我们做媒体相关方面的东西,自然而然就会想到FFmpeg这个强大的开源媒体库,所以我们肯定会 ...
- 使用sphinx创建和查看文档
1. 安装pip $ sudo apt-get install python-pip 2. 安装全文本浏览器lynx $ sudo apt-get install lynx 3. 使用pip安装sph ...
- Python——eventlet.event
该模块提供eventlet的事件支持,事件提供了跨 greenthread 的操作原语. 同一个事件对象既可以发出事件也可以接收(等待)事件,不同的协程共享这一个事件对象,就为不同协程之间基于事件的同 ...
- c# winform 获取当前程序运行根目录,winform 打开程序运行的文件夹
// 获取程序的基目录. System.AppDomain.CurrentDomain.BaseDirectory // 获取模块的完整路径. System.Diagnostics.Process.G ...
- C# 各种输入格式验证#各种输入格式验证
/// <summary> /// 各种输入格式验证 /// </summary> public class ValidateUtil { private static Reg ...
- Windows下安装Oracle12C(一)
1,在官网上下载oracle的压缩文件,两个都要下载. 并两个同时选中解压在一个文件夹里面. 2,解压之后,如下图,点击setup.exe稍等一会儿 ,3,开始安装: 不选点击下一步,或者直接点击下一 ...
- YII2 搭建redis拓展
安装redis扩展: 1.通过composer进行安装,到项目根目录cmd运行(推荐) php composer.phar require --prefer-dist yiisoft/yii2-red ...