<?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.xhkjedu.sstudy.mapper.resource.ResourceCollectMapper">
    <!--资源取消收藏-->
    <delete id="cancelCollect">
        delete from t_resource_collect where resourceid=#{collect.resourceid} and userid=#{collect.userid}
    </delete>
    <!--获取资源是否收藏列表-->
    <select id="listCollect" resultType="java.lang.String">
        select c.resourceid
        from t_resource_collect c where c.userid=#{userid} and c.resourceid in
        <foreach item="resourceid" collection="resourceids" open="(" separator="," close=")">
            #{resourceid}
        </foreach>
    </select>
    <!--获取资源是否收藏-->
    <select id="isCollected" resultType="java.lang.Integer">
        select count(*) from t_resource_collect c where c.userid=#{userid} and c.resourceid=#{resourceid}
    </select>
</mapper>
