mybatis 之 parameterType="Map"
// 获得品牌下的商品
Map<String, Object> params = new HashMap<String, Object>();
params.put("brands", brandId);
List<HashMap<String, Object>> productBrands = productBrandService.getBrandProductByBrandId(params);
public List<HashMap<String, Object>> getBrandProductByBrandId(Map<String, Object> params) {
return commonDao.queryForList("ProductBrand.getBrandProductByBrandId",params);
}
<!-- 根据品牌id获取品牌下的商品列表 -->
<select id="getBrandProductByBrandId" parameterType="Map" resultMap="simpleProductExtBrand">
select
pro.*,pi.pro_image_url
from
(
select g.goods_no,
p.product_id,p.product_name,p.drug_treatment,p.drug_prescription_type,g.goods_id,g.market_price,p.product_least_order,g.sale_amount as
sale_amount,g.click_amount,g.available_stock,
(case when
g.discount_state' and
to_char(sysdate,'yyyy-mm-dd hh24:mi:dd') between g.begin_time
and
g.end_time
then g.discount_price
else g.ec_price
end
) as ec_price,
(case when
g.discount_state='enable' and to_char(sysdate,'yyyy-mm-dd
hh24:mi:dd')
between
g.begin_time and g.end_time
then g.promote_phrase
else ''
end
) as
promote_phrase
<!-- 商品评价 -->
,(select pe.evaluation_count from product_expand pe where pe.product_id=p.product_id and pe.is_delete='N') as
commentSum,p.onsale_time,g.discount_state,g.promote_rule_ids
from
product p,goods g,product_brand_goods pbg
where
p.product_id=g.product_id
and g.goods_id = pbg.goods_id
and p.is_delete='N' and
g.is_delete='N'
and pbg.is_delete = 'N'
and p.is_onsale='Y' and g.is_default='Y'
and g.goods_no not like 'AJ%'
and pbg.brand_id = #{brands}
) pro
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
pro.product_id=pi.product_id
</select>
mybatis 之 parameterType="Map"的更多相关文章
- Mybatis 中遍历map 参数中的 list 和 array 属性
原文:https://blog.csdn.net/liudongdong0909/article/details/51048835 问题在项目有中遇到批量删除操作时,需要根据两个属性去删除数据,其中一 ...
- mybatis之parameterType传递多个参数
当在查询的时候需要传入多个参数的时候该怎么办呢: 1,封装成一个Model对象,底层HashMap还是一个 User user=new User(); user.setUserName("z ...
- mybatis中parameterType可以写的别名
mybatis中parameterType可以写的别名 https://blog.csdn.net/sdzhangshulong/article/details/51749807 _byte byte ...
- 【mybatis】mybatis中 返回map集合
关于mybatis返回map集合的操作: 1.mapper.xml中写一个查询返回map的sql <select id="findMap" parameterType=&qu ...
- mybatis如何接受map类型的参数
Mybatis传入参数类型为Map mybatis更新sql语句: ? 1 2 3 4 5 6 7 8 9 <update id="publishT00_notice" ...
- mybatis如何遍历Map的key和value【增删改查】
转: mybatis如何遍历Map的key和value 2017年11月28日 10:07:57 Joker_Ye 阅读数:4158 1.sql.xml <?xml version=&quo ...
- MyBatis中的Map
接口 int addUserMap(Map<String, Object> map); Mapper.xml <!-- Map比较灵活 传递的值为Map的key,可以为任何(野路子, ...
- Mybatis(万能map)
mybatis(万能map) 我们使用对象作为参数有一个缺点: 我们要在mapper.xml文件和测试中要把所有的字段都写出来,那么,假如一个对象有100个字段,那我们要把这些字段都写出来吗? 所以这 ...
- mybatis 之resultType="Map"
Map map = new HashMap(); map.put("productTypeID", productTypeId); List<HashMap> prod ...
随机推荐
- Hive之分区(Partitions)和桶(Buckets)
转自:http://www.aahyhaa.com/archives/316 hive引入partition和bucket的概念,中文翻译分别为分区和桶(我觉的不是很合适,但是网上基本都是这么翻译,暂 ...
- Java虚拟机(JVM)体系结构概述及各种性能参数优化总结
转自:http://blog.csdn.net/zhongwen7710/article/details/39213377 第一部分:相关的概念 数据类型 Java虚拟机中,数据类型可以分为两类:基本 ...
- find & grep 命令 in linux(转)
Linux下面工作,有些命令能够大大提高效率.本文就向大家介绍find.grep命令,他哥俩可以算是必会的linux命令,我几乎每天都要用到他们.本文结构如下: -exec,find命令对匹配的文件执 ...
- 【CUDA学习】结构体指针复制
内核函数中要用data结构作用参数 typedef struct { int* value; int* num; } data; //host端 data* h_input; h_input=(dat ...
- SAP财务供应链与金库管理的联系与区别
SAP Treasure Module & Cash Fund , Risk Management 本文简要阐述一下什么是财务供应链管理(FSCM),什么是金库管理(Treasury Ma ...
- SpringMVC系列(十四)Spring MVC的运行流程
Spring MVC的运行流程图: 1.首先看能不能发送请求到Spring MVC的DispatcherServlet的url-pattern2.如果能发送请求,就看在Spring MVC中是否存在对 ...
- Java如何监视线程的状态?
在Java编程中,如何监视线程的状态? 以下示例演示如何通过扩展Thread类并使用currentThread.getName()方法来监视线程的状态. package com.yiibai; cla ...
- C++ namespace的用法
//namesp.h namespace pers{ const int LEN = 40; struct Person{ char fname[LEN]; ...
- php判断所在的客户端
//判断是否是手机 function is_mobile() { $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $is_pc = (strpos( ...
- JavaScript 编码小技巧
三元操作符 如果使用if...else语句,那么这是一个很好节省代码的方式. Longhand: const x = 20; let answer; if (x > 10) { answer = ...