package com.cyksj.mapper.mini;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyksj.model.entity.Article;
import com.cyksj.model.views.ArticleDetailView;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/*
 *项目名: netflix
 *文件名: ArticleMapper
 *创建者: JavaZou
 *创建时间:2023/6/27 13:49
 */
public interface ArticleMapper extends BaseMapper<Article> {

	ArticleDetailView getArticleDetailById(Long articleId);

	Article getArticleDetail(Long articleId);

	@Update("update article set dz_num = dz_num + #{offset}  where id = #{articleId} and dz_num = #{dzNum}")
	Integer updateDzNum(@Param("articleId") Long articleId, @Param("dzNum") Integer dzNum, @Param("offset") Integer offset);

	@Update("update article set col_num = col_num + #{offset}  where id = #{articleId} and col_num = #{colNum}")
	Integer updateColNum(@Param("articleId") Long articleId, @Param("colNum") Integer colNum, @Param("offset") Integer offset);

	@Select("select id from article")
	List<Long> selectAll();
}
