<?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.ModelImageLikeMapper">

    <resultMap type="modelImageLike" id="ModelImageLikeResult">
        <id property="id" column="id"/>
        <result property="userId" column="user_id"/>
        <result property="modelImageId" column="model_image_id"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
        <result property="remark" column="remark"/>
    </resultMap>


    <sql id="selectModelImageLikeVo">
        select id,
               user_id,
               model_image_id,
               create_by,
               create_time,
               update_by,
               update_time,
               del_flag,
               remark
        from model_image_like
    </sql>
    <update id="updateDelFlagById">
        update model_image_like
        set del_flag = #{delFlag}
        where user_id = #{userId} and model_image_id = #{modelImageId}
    </update>

    <select id="getLikeImage" resultMap="ModelImageLikeResult">
        <include refid="selectModelImageLikeVo"/>
        where user_id = #{userId}
        and model_image_id = #{imageId}
    </select>
</mapper>
