<select id="queryGoodsByGoodsNoPcweb" parameterType="List" resultMap="simpleProductExtLucene">
        select g.goods_no,
            wp.PRODUCT_ID, p.product_name, p.drug_treatment, p.drug_prescription_type,
            p.product_least_order || '' as "product_least_order", p.order_limit_amount || '' as "order_limit_amount",
            wg.goods_id, g.goods_name,
            g.market_price || '' as "market_price",
            g.sale_amount, g.click_amount, nvl(g.available_stock,) || '' as "available_stock",
            pc.pro_catalog_id || '' as "pro_catalog_id", pi.pro_image_url, tag.tag_id || '' as "tag_id",
            tag.tag_icon_url,
            <![CDATA[
                (case when exists (
                        select 1
                            from ec_promote_rule_goods_new npg
                            right join ec_promote_rule_new np on npg.promote_rule_id = np.promote_rule_id
                        where npg.goods_id = wg.goods_id
                            and np.promote_client = 'wap'
                            and np.is_enable = 'Y'
                            and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between np.begin_time and np.end_time
                    )
                 then 'Y' else 'N' end) as MOBILE_SPECIAL,
            ]]>
            pc.full_index,
            to_number(case
                when wg.discount_state = 'enable'
                     <!-- and wg.member_ranks = '0'  -->
                     and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between wg.begin_time and wg.end_time
                     and wg.discount_price is not null 

                then
                    wg.discount_price
                when g.discount_state = 'enable'
                     <!-- and g.member_ranks = '0'  -->
                     and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between g.begin_time and g.end_time
                     and g.discount_price is not null 

                then
                    g.discount_price
                else
                    g.ec_price
            end) || ' ' as ec_price,
            (case
                when wg.discount_state = 'enable'
                    and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between wg.begin_time
                    and wg.end_time
                then
                    wg.promote_phrase
                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, pc.pro_catalog_name, wp.product_keyword, wp.PRODUCT_CHN_NO,
            pb.product_brand_name, nvl(wp.product_order,) product_order
        from product wp
            left join product p on p.product_id = wp.product_id and p.is_delete = 'N'
            left join goods wg on wp.product_id = wg.product_id and wg.is_delete = 'N' and wg.is_default = 'Y'
            left join goods g on g.goods_id = wg.goods_id and g.is_delete = 'N' and g.is_default = 'Y'
            left join product_catalog pc on pc.pro_catalog_id = wp.pro_catalog_id and pc.is_delete = 'N'
            left join product_brand pb on pb.product_brand_id = wp.product_brand_id and pb.is_delete = 'N'
            left join (
                        select min(pt.tag_id) as tag_id,
                            min(ptd.goods_id) as goods_id,
                            min(pt.tag_icon_url) as tag_icon_url
                        from product_tag_def ptd, product_tag pt
                        where ptd.tag_id = pt.tag_id
                            and pt.is_delete = 'N'
                            and pt.tag_type = 'icon'
                        group by ptd.goods_id
                    ) tag on tag.goods_id = wg.goods_id
            left join (
                        select pig.product_id as product_id,
                            min(pig.image_order),
                            min(pig.pro_image_url) as
                            pro_image_url
                        from wap_product_img pig
                        where pig.image_type = 'small'
                        group by pig.product_id) pi on wp.product_id = pi.product_id
        where wp.is_delete = 'N'
            and p.is_onsale = 'Y'
            and wg.is_delete = 'N'
            and wg.is_default = 'Y'
            and wp.pro_catalog_id is not null
            and wp.product_code NOT like 'AJ%'
            and g.goods_no in
            <foreach collection="list" item="listItem" index="index"
                open="(" separator="," close=")" >
                #{listItem,jdbcType=VARCHAR}
            </foreach>
    </select>
<select id="queryGoodsByGoodsNoMobile" parameterType="List" resultMap="simpleProductExtLucene">
        select g.goods_no,
            wp.PRODUCT_ID, p.product_name, p.drug_treatment, p.drug_prescription_type,
            p.product_least_order || '' as "product_least_order", p.order_limit_amount || '' as "order_limit_amount",
            wg.goods_id, g.goods_name,
            g.market_price || '' as "market_price",
            g.sale_amount, g.click_amount, nvl(g.available_stock,) || '' as "available_stock",
            pc.pro_catalog_id || '' as "pro_catalog_id", pi.pro_image_url, tag.tag_id || '' as "tag_id",
            tag.tag_icon_url,
            <![CDATA[
                (case when exists (
                        select 1
                            from ec_promote_rule_goods_new npg
                            right join ec_promote_rule_new np on npg.promote_rule_id = np.promote_rule_id
                        where npg.goods_id = wg.goods_id
                            and np.promote_client = 'wap'
                            and np.is_enable = 'Y'
                            and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between np.begin_time and np.end_time
                    )
                 then 'Y' else 'N' end) as MOBILE_SPECIAL,
            ]]>
            pc.full_index,
            to_number(case
                when wg.discount_state = 'enable'
                     <!-- and wg.member_ranks = '0'  -->
                     and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between wg.begin_time and wg.end_time
                     and wg.discount_price is not null 

                then
                    wg.discount_price
                when g.discount_state = 'enable'
                     <!-- and g.member_ranks = '0'  -->
                     and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between g.begin_time and g.end_time
                     and g.discount_price is not null 

                then
                    g.discount_price
                else
                    g.ec_price
            end) || ' ' as ec_price,
            (case
                when wg.discount_state = 'enable'
                    and to_char(sysdate, 'yyyy-mm-dd hh24:mi:dd') between wg.begin_time
                    and wg.end_time
                then
                    wg.promote_phrase
                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, pc.pro_catalog_name, wp.product_keyword, wp.PRODUCT_CHN_NO,
            pb.product_brand_name, nvl(wp.product_order,) product_order
        from wap_product wp
            left join product p on p.product_id = wp.product_id and p.is_delete = 'N'
            left join wap_goods wg on wp.product_id = wg.product_id and wg.is_delete = 'N' and wg.is_default = 'Y'
            left join goods g on g.goods_id = wg.goods_id and g.is_delete = 'N' and g.is_default = 'Y'
            left join product_catalog pc on pc.pro_catalog_id = wp.pro_catalog_id and pc.is_delete = 'N'
            left join product_brand pb on pb.product_brand_id = wp.product_brand_id and pb.is_delete = 'N'
            left join (
                        select min(pt.tag_id) as tag_id,
                            min(ptd.goods_id) as goods_id,
                            min(pt.tag_icon_url) as tag_icon_url
                        from product_tag_def ptd, product_tag pt
                        where ptd.tag_id = pt.tag_id
                            and pt.is_delete = 'N'
                            and pt.tag_type = 'icon'
                        group by ptd.goods_id
                    ) tag on tag.goods_id = wg.goods_id
            left join (
                        select pig.product_id as product_id,
                            min(pig.image_order),
                            min(pig.pro_image_url) as
                            pro_image_url
                        from wap_product_img pig
                        where pig.image_type = 'small'
                        group by pig.product_id) pi on wp.product_id = pi.product_id
        where wp.is_delete = 'N'
            and p.is_onsale = 'Y'
            and wg.is_delete = 'N'
            and wg.is_default = 'Y'
            and wp.pro_catalog_id is not null
            and wp.product_code NOT like 'AJ%'
            and g.goods_no in
            <foreach collection="list" item="listItem" index="index"
                open="(" separator="," close=")" >
                #{listItem,jdbcType=VARCHAR}
            </foreach>
    </select>

    public List<Map<String, Object>> queryGoodsByGoodsNoPcweb(List<String> goodsNos);
public ServiceMessage<List<Map<String, Object>>> queryGoodsListByGoodsNoList(List<String> goodsNoList, SiteType siteType) {
        try {
            if (goodsNoList == null || goodsNoList.size() < 1) {
                return super.returnParamsError("接收到的goodsNoList(" + goodsNoList + ")为空");
            } else if (goodsNoList.get(0) == null || "".equals(goodsNoList.get(0).trim())) {
                return super.returnParamsError("接收到的goodsNoList(" + goodsNoList.get(0) + ")元素为空");
            } else if (siteType == null) {
                return super.returnParamsError("接收到的SiteType(" + siteType + ")元素为空");
            }
            List<Map<String, Object>> goodsList = null;
            if (SiteType.PCWEB.equals(siteType)) {
                goodsList = goodsMapper.queryGoodsByGoodsNoPcweb(goodsNoList);
            } else if (SiteType.MOBILE.equals(siteType)) {
                goodsList = goodsMapper.queryGoodsByGoodsNoMobile(goodsNoList);
            }
            return super.returnCorrectResult(goodsList);
        } catch (Throwable e) {
            return super.returnException(e);
        }
    }

mybatis 之 parameterType="List" 2的更多相关文章

  1. mybatis中parameterType可以写的别名

    mybatis中parameterType可以写的别名 https://blog.csdn.net/sdzhangshulong/article/details/51749807 _byte byte ...

  2. mybatis的parameterType使用map实现真正的sql随意写

    在dao层给map赋值 纠正一下应该把dd作为传入而不是sbiId; sqlMap中的parameterType="java.util.Map", 就 OK package com ...

  3. 【JAVA - SSM】之MyBatis的ParameterType的使用

    在MyBatis的Mapper.xml文件中,参数的表示方法有两种:一种是使用 "#{XXX}" 的方式表示的,另一种是使用 "${XXX}" 的方式表示的.今 ...

  4. MyBatis mapper parameterType

    1.   传入简单类型 JAVA代码: public User get(Long id) { return (User) getSqlSession().selectOne("com.liu ...

  5. Mybatis中parameterType、resultMap、statementType等等配置详解(标签中基本配置详解)

    一.(转自:https://blog.csdn.net/majinggogogo/article/details/72123185) 映射文件是以<mapper>作为根节点,在根节点中支持 ...

  6. mybatis之parameterType传递多个参数

    当在查询的时候需要传入多个参数的时候该怎么办呢: 1,封装成一个Model对象,底层HashMap还是一个 User user=new User(); user.setUserName("z ...

  7. MyBatis的parameterType传入参数类型

    在mybatis映射接口的配置中,有select,insert,update,delete等元素都提到了parameterType的用法,parameterType为输入参数,在配置的时候,配置相应的 ...

  8. 【JavaEE】之MyBatis的ParameterType的使用

    在MyBatis的Mapper.xml文件中,参数的表示方法有两种:一种是使用 “#{XXX}” 的方式表示的,另一种是使用 “${XXX}” 的方式表示的.今天来介绍以下这两种方式的不同之处. 1. ...

  9. Mybatis的parameterType传入多个参数

    如果查询的条件有多个的时候,mybatis有三种传入方式: 1.通过注解传入 例如: public interface Mapper(){ public User login(@Param(" ...

  10. mybatis 之 parameterType="String" resultType="java.util.HashMap">

    public ServiceMessage<Map<String, String>> getGoodsStockNo( List<Map<String, Strin ...

随机推荐

  1. mysql小题趣事

    题一 答案: case when +条件 +then 显示什么 +else+显示另外什么+end

  2. 第三百六十三节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)的mget和bulk批量操作

    第三百六十三节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)的mget和bulk批量操作 注意:前面讲到的各种操作都是一次http请求操作一条数据,如果想 ...

  3. Android开发之旅(二)服务生命周期和广播接收者生命周期

    引言 应用程序组件有一个生命周期——一开始Android实例化他们响应意图,直到结束实例被销毁.在这期间,他们有时候处于激活状态,有时候处于非激活状态:对于活动,对用户有时候可见,有时候不可见.组件生 ...

  4. MyBatis SqlSessionDaoSupport实例

    在前面的章节中,我们已经讲到了基本的 mybatis 操作,但都是基于 mapper 隐射操作的,在 mybatis3 中这个 mapper 接口貌似充当了以前在ibatis 2中的 DAO 层的作用 ...

  5. C#自定义事件 范例:监视变量变化

    很多时候我们需要程序具有一种功能,就是当满足某一条件时触发某个动作,使用C#的事件机制就可以达到这个目的下面的例子是一个很好的演示,这段代码实现了对一个变量的监视,一旦变量发生改变,就触发动作 定义事 ...

  6. 详细的Log4j使用教程

    日志是应用软件中不可缺少的部分,Apache的开源项目log4j是一个功能强大的日志组件,提供方便的日志记录.在apache网站:jakarta.apache.org/log4j 可以免费下载到Log ...

  7. LintCode #1 A + B 问题

    分析:以3 + 5为例 3的二进制为 1 1,5的二进制为 1 0 1,可以这样做:1先给这两个数加起来不考虑进位,这样得到的结果为 1 1 0,会发现与^得到的结果相同,与是先给两个数 做^运算:2 ...

  8. Lambda动态排序

    private static IList<T> IListOrderBy<T>(IList<T> list, string propertyName) where ...

  9. List转DataTable(反射) ; 将泛型集合类转换成DataTable ; 将集合类转换成DataTable

    public class ConvertX { #region 将集合类转换成DataTable /// <summary> /// 将集合类转换成DataTable /// </s ...

  10. Java设计模式之五大创建型模式(附实例和详解)

    一.概况 总体来说设计模式分为三大类: (1)创建型模式,共五种:工厂方法模式.抽象工厂模式.单例模式.建造者模式.原型模式. (2)结构型模式,共七种:适配器模式.装饰器模式.代理模式.外观模式.桥 ...