package org.jeecg.modules.oroqen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.oroqen.entity.OroqenCultureContent;

import java.util.List;

/**
 * @Description: 文化内容
 * @Author: jeecg-boot
 * @Date: 2025-01-08
 * @Version: V1.0
 */
public interface OroqenCultureContentMapper extends BaseMapper<OroqenCultureContent> {

    /**
     * 根据分类ID查询文化内容
     */
    List<OroqenCultureContent> selectByCategoryId(@Param("categoryId") String categoryId);

    /**
     * 查询推荐文化内容
     */
    List<OroqenCultureContent> selectRecommended();

    /**
     * 更新浏览次数
     */
    @Update("UPDATE oroqen_culture_content SET view_count = view_count + 1 WHERE id = #{id}")
    void updateViewCount(@Param("id") String id);

    /**
     * 更新点赞次数
     */
    @Update("UPDATE oroqen_culture_content SET like_count = like_count + #{count} WHERE id = #{id}")
    void updateLikeCount(@Param("id") String id, @Param("count") Integer count);

    /**
     * 更新收藏次数
     */
    @Update("UPDATE oroqen_culture_content SET favorite_count = favorite_count + #{count} WHERE id = #{id}")
    void updateFavoriteCount(@Param("id") String id, @Param("count") Integer count);
}