package com.chushang.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chushang.system.entity.po.SysPost;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @auther: zhao
 * @date: 2024/5/9 15:49
 */
public interface SysPostMapper extends BaseMapper<SysPost> {
    @Select("select p.post_id from sys_post p left join sys_user_post up on up.post_id = p.post_id " +
            "left join sys_user u on u.user_id = up.user_id where u.user_id = #{userId}")
    List<Long> selectPostListByUserId(@Param("userId") Long userId);

    @Select("select p.post_id, p.post_name, p.post_code from sys_post p left join sys_user_post up on up.post_id = p.post_id " +
            "left join sys_user u on u.user_id = up.user_id where u.username = #{username}")
    List<SysPost> selectPostsByUserName(String username);
}
