12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.caimei.www.mapper.ShoppingDao">
- <select id="getHeadCarts" resultType="com.caimei.www.pojo.order.CartItem">
- select
- p.productID as id,
- p.`name` as `name`,
- p.mainImage as image,
- p.price1 as price,
- p.unit as unit,
- c.productCount as number
- from cm_cart c
- left join product p on c.productID=p.productID
- where p.validFlag='2'
- and c.userID = #{userId}
- and p.price1TextFlag != '1'
- and p.stock != '0'
- and p.stock <![CDATA[ >= ]]> c.productCount
- </select>
- <select id="getCartSuppliers" resultType="com.caimei.www.pojo.order.CartSupplier">
- select
- s.shopID as id,
- s.name,
- s.logo
- from cm_cart c
- left join product p on c.productID = p.productID
- left join shop s on p.shopID = s.shopID
- where c.userID = #{userId}
- group by s.shopID
- order by MAX(c.addTime) desc
- </select>
- <select id="getShoppingCartBySupplierId" resultType="com.caimei.www.pojo.order.CartItem">
- select
- c.cm_cartID as id,
- p.productID as productId,
- p.`name` as `name`,
- p.mainImage as image,
- p.price1 as price,
- p.unit as unit,
- p.step as step,
- p.minBuyNumber as min,
- p.price1TextFlag as priceFlag,
- p.ladderPriceFlag as ladderFlag,
- p.validFlag as validFlag,
- p.stock as stock,
- c.productCount as number
- from product p
- left join cm_cart c on c.productID = p.productID
- where p.shopID = #{supplierId} and c.userID = #{userId}
- order by c.addTime desc
- </select>
- <select id="getActivityPriceByProductId" resultType="com.caimei.www.pojo.order.ActivityPrice">
- select ca.id,
- cpa.productId,
- cpa.actPrice as price,
- ca.startTime as beginTime,
- ca.endTime as endTime
- from cm_product_activity cpa
- left join cm_activity ca on cpa.activityId = ca.id
- where cpa.productId = #{productId}
- and ca.startTime <![CDATA[ <= ]]> NOW()
- and NOW() <![CDATA[ <= ]]> ca.endTime
- and cpa.delFlag = 0
- </select>
- <select id="getladderPricesByProductId" resultType="com.caimei.www.pojo.order.LadderPrice">
- select
- id, productId, ladderNum, buyNum, buyPrice
- from product_ladder_price
- where productId = #{productId} and userType = 3 and delFlag = 0
- order by ladderNum asc
- </select>
- <select id="getRepurchasePrice" resultType="java.lang.Double">
- select
- r.currentPrice
- from repeat_purchase_price r
- left join product p on p.productID = r.productId
- where r.productId = #{productId} and userId = #{userId}
- and ((p.costCheckFlag=1 and r.currentPrice <![CDATA[ >= ]]> p.costPrice) or p.costCheckFlag=0)
- and r.delFlag = 0
- </select>
- </mapper>
|