<?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="cn.reghao.tnb.content.app.vod.db.mapper.FavlistMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert into favlist
        (`id`,`deleted`,`create_time`,`update_time`,`favlist_id`,`favlist_name`,`content_type`,`create_by`)
        values 
        (#{id},#{deleted},#{createTime},#{updateTime},#{favlistId},#{favlistName},#{contentType},#{createBy})
    </insert>

    <select id="findByContentType" resultType="cn.reghao.tnb.content.app.vod.model.po.Favlist">
        select *
        from favlist
        where content_type=#{contentType} and create_by=#{userId}
        order by id asc
        limit 1
    </select>

    <select id="findByFavlistId" resultType="cn.reghao.tnb.content.app.vod.model.po.Favlist">
        select *
        from favlist
        where favlist_id=#{favlistId}
    </select>
    <select id="findByCreateBy" resultType="cn.reghao.tnb.content.app.vod.model.po.Favlist">
        select *
        from favlist
        where content_type=#{contentType} and create_by=#{userId}
    </select>
</mapper>
