<?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.ruoyi.mall.mapper.UserFavoriteMapper">

    <select id="getFavoriteList" resultType="com.ruoyi.mall.domain.Product">
        select  a.id,
                a.pic,
                a.name,
                a.is_course,
                a.course_id,
                a.price,
                a.unit,
                c.store_name
        from mall_product a,mall_user_favorite b,yj_store c
        WHERE a.id=b.product_id
          and a.store_id=c.dept_id and a.publish_status=1
          and b.user_id=#{userId}
        <if test="storeId != null and storeId !='' ">
            and a.store_id=#{storeId}
        </if>
    </select>
</mapper>
