<?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.mcwl.resource.mapper.MallProductLikeMapper">
    <delete id="deleteByUserIdAndProductId">
        delete from mall_product_like where user_id = #{userId} and product_id = #{productId}
    </delete>


    <select id="selectByUserId" resultType="java.lang.Long">
        select product_id FROM mall_product_like WHERE user_id = #{userId}
    </select>

    <select id="selectByUserIdAndProductId" resultType="com.mcwl.resource.domain.MallProductLike">
        select id,user_id,product_id from mall_product_like where user_id = #{userId} and product_id = #{productId}
    </select>

    <select id="countLike" resultType="java.lang.Long">
        SELECT count(id)likeCount FROM mall_product_like where user_id = #{userId} ORDER BY(user_id);
    </select>
</mapper>
