<?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.microservices.zone.resource.mapper.AiResourceLikeMapper">

    <select id="selectByResourceAndUser" resultType="com.microservices.zone.resource.domain.AiResourceLike">
        select id, resource_id, user_id, create_time
        from ai_resource_like
        where resource_id = #{resourceId} and user_id = #{userId}
    </select>

    <insert id="insertLike" useGeneratedKeys="true" keyProperty="id">
        insert into ai_resource_like (resource_id, user_id, create_time)
        values (#{resourceId}, #{userId}, #{createTime})
    </insert>

    <delete id="deleteLike">
        delete from ai_resource_like
        where resource_id = #{resourceId} and user_id = #{userId}
    </delete>

</mapper>
