mybatis 之resultType="HashMap" parameterType="list"

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis 之resultType="HashMap" parameterType="list"相关的知识,希望对你有一定的参考价值。

     <!-- 查询商品仓库信息 -->
    <select id="loadGoodsStock" resultType="HashMap" parameterType="list">
        select  g.goods_id,
                g.stock_id,
                s.STOCK_NO,
                s.STOCK_NAME,
                g.goods_seller
        from 
        goods g , stock s
        where g.STOCK_ID = s.STOCK_ID and
         g.goods_id  in  
         <foreach collection="list" item="listItem" index="index" open="("
            separator="," close=")">
            #{listItem}
        </foreach>
    </select>

 

    public List<Map<String, Object>> loadGoodsStock(List<Long> goodsIds);
    public ServiceMessage<List<Map<String, Object>>> queryGoodsStockInfo(List<Long> goodsIds) {
        try {
            if (goodsIds == null || goodsIds.size() < 1) {
                return super.returnParamsError("查询仓库信息参数为空goodsIds");
            }
            List<Map<String, Object>> goodsList = goodsMapper.loadGoodsStock(goodsIds);
            return super.returnCorrectResult(goodsList);
        } catch (Throwable e) {
            return super.returnException(e);
        }
    }

 

    <resultMap id="simpleProductExtLucene" type="HashMap">
        <result column="goods_no" property="goodsNo" />
        <result column="pro_catalog_id" property="proCatalogId" />
        <result column="pro_catalog_name" property="proCatalogName" />
        <result column="PROMOTE_PHRASE" property="promotePhrase"
            javaType="String" />
        <result column="EC_PRICE" property="ecPrice" javaType="String" />
        <result column="MARKET_PRICE" property="marketPrice" javaType="decimal" />
        <result column="PRO_IMAGE_URL" property="proImageUrl" javaType="String" />
        <result column="TAG_ICON_URL" property="tagIconUrl" javaType="String" />
        <result column="DRUG_PRESCRIPTION_TYPE" property="drugPrescriptionType"
            javaType="String" />
        <result column="PRODUCT_LEAST_ORDER" property="productLeastOrder"
            javaType="decimal" />
        <result column="ORDER_LIMIT_AMOUNT" property="orderLimitAmount"
            javaType="decimal" />
        <result column="AVAILABLE_STOCK" property="availableStock"
            javaType="decimal" />
        <result column="PRODUCT_ID" property="productId" />
        <result column="GOODS_ID" property="goodsId" />
        <result column="GOODS_NAME" property="goodsName" />
        <result column="SALE_AMOUNT" property="saleAmount" />
        <result column="CLICK_AMOUNT" property="clickAmount" />
        <result column="GOODS_NAME" property="productName" />
        <result column="PRODUCT_CHN_NO" property="productChnNo" />
        <result column="MOBILE_SPECIAL" property="mobileSpecial" />
        <result column="DRUG_TREATMENT" property="drugTreatment"
            javaType="String" />
        <result column="product_keyword" property="productKeyword" />
        <result column="product_brand_name" property="productBrandName" />
        <result column="product_order" property="productOrder" />
        <result column="FULL_INDEX" property="fullIndex"/>
    </resultMap>
    

 

以上是关于mybatis 之resultType="HashMap" parameterType="list"的主要内容,如果未能解决你的问题,请参考以下文章

mybatis 之resultType="HashMap" parameterType="list"

mybatis resultType="map"查询不到值

MyBatis学习总结_13_Mybatis查询之resultMap和resultType区别

mybatis 之parameterType="Long"

Mybatis映射中的resultType和resultMap之代码详解

MyBatis映射文件 之 resultType 自动映射