<?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.ShoppingCartDao">
    <select id="getHeadCarts" resultType="com.caimei.www.pojo.base.ShoppingCart">
		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>

</mapper>
