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 ...
随机推荐
- Homebrew替换源
https://www.zhihu.com/question/31360766/answer/74155248 以及 https://www.zhihu.com/question/31360766
- e831. 从JTabbedPane中删除一个卡片
// To create a tabbed pane, see e828 创建JTabbedPane // Remove the last tab pane.remove(pane.getTabCou ...
- C#或者.NET下的强制垃圾回收办法
转载 2011年03月16日 17:21:00 标签: c# / .net / button / object / stream / class 8185 今天来谈谈C#的GC,也就是垃圾回收机制,非 ...
- Eclipse的实用插件
Decompiler PyDev ShellEd AnyEdit SonarLint PropertiesEditor System and Desktop Search 其它实用插件等工作中用到了再 ...
- 命令查询职责分离模式(Command Query Responsibility Segregation,CQRS)
浅谈命令查询职责分离(CQRS)模式 CQRS架构简介 对CQRS的一次批判性思考
- Radix-64编码简介
本文介绍Radix-64编码,PGP和S/MIME均使用了Radix-64编码技术,rfc4880的Chap 6有关于Radix-64的详细描述. Radix-64编码基于Base64编码技术,由两部 ...
- 某软件大赛C#版考题整理——【编程题】
三.编程题(4小题共40.0分)程序及结果写入对应文框内 1. 孪生素数查找程序. 所谓孪生素数指的是间隔为2 的相邻素数,就像孪生兄弟.最小的孪生素数是(3, 5),在100 以内的孪生素数还有 ( ...
- 共享锁(S锁)和排它锁(X锁)
释义 共享锁:(读取)操作创建的锁.其他用户可以并发读取数据,但任何事物都不能获取数据上的排它锁,直到已释放所有共享锁. 共享锁(S锁)又称为读锁,若事务T对数据对象A加上S锁,则事务T只能读A:其他 ...
- 6.查找单链表中的倒数第k个结点
普通思路:先将整个链表从头到尾遍历一次,计算出链表的长度size,得到链表的长度之后,就好办了,直接输出第(size-k)个节点就可以了(注意链表为空,k 为0,k为1,k大于链表中节点个数时的情况) ...
- Docker命令之 run
docker run :创建一个新的容器并运行一个命令 语法 docker run [OPTIONS] IMAGE [COMMAND] [ARG...] OPTIONS说明: -a stdin: 指定 ...