<?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.web.work.mapper.FavoriteMapper">

    <select id="selectList" resultType="com.ruoyi.web.work.domain.Favorite">
        SELECT
            f.*,
            p.type,
            p.title,
            p.address,
            p.salary
        FROM
            tb_favorite f
                LEFT JOIN tb_position p ON p.id = f.position_id
        WHERE
            f.user_id =#{userId}
          AND p.state =0
          AND p.audit =1
        ORDER BY
            f.id DESC
    </select>

    <select id="check" resultType="com.ruoyi.web.work.domain.Favorite">
        SELECT * FROM tb_favorite WHERE user_id=#{userId} AND position_id=#{positionId}
    </select>

</mapper>