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 ...
随机推荐
- Ogre Compositor解析
Compositor脚本与类型 我们先看下面一张基本的Compositor的脚本图: 上面就是一个Composition资源.在解析时,主要是使用CompositionPass, Compositio ...
- Quick solution to java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices error
In case if you face this problem, one of the possible solutions that will work for you is to make su ...
- vector 用法小例子
1. vector<int> vec; vec.push_back(1); 2. vector<int> vec(10); vec[0] = 1;
- e816. 创建工具栏
A toolbar can be either horizontal or vertical. When the orientation is horizontal, the objects in t ...
- 导入Maven项目后,Eclipse提示“Missing artifact ”类的错误
导入Maven项目后,Eclipse提示“Missing artifact ”类的错误 标签: Maven Missing art 2016-08-15 16:05 679人阅读 评论(0) 收藏 举 ...
- 启动其他APK的Activity方法 (转至http://www.cnblogs.com/lijunamneg/archive/2013/02/26/2934060.html)
有两个app,分别叫做App1和App2.App1包含两个Activity,分别叫做App1_A和App1_B.其中App1_A是入口Activity.也就是App1_A设置intent-filter ...
- ELK filter过滤器来收集Nginx日志
前面已经有ELK-Redis的安装,此处只讲在不改变日志格式的情况下收集Nginx日志. 1.Nginx端的日志格式设置如下: log_format access '$remote_addr - $r ...
- 多个IoC容器适配器设计及性能测试(Castle.Windsor Autofac Spring.Core)
[转]多个IoC容器适配器设计及性能测试和容器选择 1. 采用的IoC容器和版本 Autofac.2.6.3.862 Castle.Windsor.3.1.0 Spring.Core.2.0.0 2. ...
- matlab中 %d,%f,%c,%s代表什么意思
1.%d就是输出整型:%3d就是说按照长度为3的整型输出,比如10,输出就是“_10”,“_”代表空格. 2.%f就是输出小数:%6.2f就是小数点后保留2位,输出总长度为6,比如3.14159,输出 ...
- css只改变input输入框光标颜色不改变文字颜色实现方法
input:focus{color:blue}//光标颜色 input{ text-shadow: 0px 0px 0px red;//文字颜色 -webkit-text-fill-color: tr ...