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 ...
随机推荐
- Axure RP Pro 7.0 注册码
用户名:aaa注册码:h624pifAqt7It5e8boKkML+Y4RjDX5xknP4k7QktJYQoxsvv7VUS7hBCv/2ef45P
- 3种启动tornado的方式
r"""A non-blocking, single-threaded HTTP server. 翻译: 一个非阻塞的单线程HTTP服务器 A server is def ...
- 利用函数或映射进行数据转换 (map)
先来看个数据 df = DataFrame({"food":["bacon", "pulled pork", "bacon&quo ...
- Solr系列五:solr搜索详解(solr搜索流程介绍、查询语法及解析器详解)
一.solr搜索流程介绍 1. 前面我们已经学习过Lucene搜索的流程,让我们再来回顾一下 流程说明: 首先获取用户输入的查询串,使用查询解析器QueryParser解析查询串生成查询对象Query ...
- php -- php模拟浏览器访问网址
目前我所了解到的在php后台中,用php模拟浏览器访问网址的方法有两种: 第一种:模拟GET请求:file_get_contents($url) 通过php内置的 file_get_contents ...
- Windows查看占用端口的进程及其对应的应用程序并关闭之
^_^ C:\Users\dsp> C:\Users\dsp>netstat -ano | findstr " TCP LISTENING TCP TIME_WAIT TCP T ...
- Mybatis中#和$区别(带脑图)
零.引言 使用 #{name} 的时候,MyBatis会进行预编译,防止SQL注入的问题(官方话) 用一个通俗一点的例子来解释,比如有如下MyBatis的SQL语句 21.#{}和${}的区别.png ...
- yii2 使用阿里大鱼短信
1.首先申请阿里账号 2.开通短信服务 3.短信签名 4.添加模板 以上4步是前期工作 -------------------------------------------------------- ...
- max导出模型插件
首先,需要做好如下的准备工作:1. 安装一个完整版本的3D MAX与Visual Stdio.我安装的是3D MAX 2012,最好是找一个完整的版本,因为完整的版本中有很多的学习资料与sdk供学习, ...
- 腾讯QQ积分CSRF导致积分任意挥霍(我的积分为什么少了)
触发点:http://jifen.qq.com/html5/index.html?ADTAG=JIFEN.MART.INDEX 随意兑换一个商品: 因为刚才我已经兑换过了,所以积分没有了.. 没关系, ...