package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysUserLikeMapper;
import com.ruoyi.system.domain.SysUserLike;
import com.ruoyi.system.service.ISysUserLikeService;

/**
 * 用户点赞Service业务层处理
 * 
 * @author haotian
 * @date 2024-12-02
 */
@Service
public class SysUserLikeServiceImpl implements ISysUserLikeService 
{
    @Autowired
    private SysUserLikeMapper sysUserLikeMapper;

    /**
     * 查询用户点赞
     * 
     * @param id 用户点赞主键
     * @return 用户点赞
     */
    @Override
    public SysUserLike selectSysUserLikeById(Long id)
    {
        return sysUserLikeMapper.selectSysUserLikeById(id);
    }

    /**
     * 查询用户点赞列表
     * 
     * @param sysUserLike 用户点赞
     * @return 用户点赞
     */
    @Override
    public List<SysUserLike> selectSysUserLikeList(SysUserLike sysUserLike)
    {
        return sysUserLikeMapper.selectSysUserLikeList(sysUserLike);
    }

    /**
     * 新增用户点赞
     * 
     * @param sysUserLike 用户点赞
     * @return 结果
     */
    @Override
    public int insertSysUserLike(SysUserLike sysUserLike)
    {
        sysUserLike.setCreateTime(DateUtils.getNowDate());
        return sysUserLikeMapper.insertSysUserLike(sysUserLike);
    }

    /**
     * 修改用户点赞
     * 
     * @param sysUserLike 用户点赞
     * @return 结果
     */
    @Override
    public int updateSysUserLike(SysUserLike sysUserLike)
    {
        sysUserLike.setUpdateTime(DateUtils.getNowDate());
        return sysUserLikeMapper.updateSysUserLike(sysUserLike);
    }

    /**
     * 批量删除用户点赞
     * 
     * @param ids 需要删除的用户点赞主键
     * @return 结果
     */
    @Override
    public int deleteSysUserLikeByIds(Long[] ids)
    {
        return sysUserLikeMapper.deleteSysUserLikeByIds(ids);
    }

    /**
     * 删除用户点赞信息
     * 
     * @param id 用户点赞主键
     * @return 结果
     */
    @Override
    public int deleteSysUserLikeById(Long id)
    {
        return sysUserLikeMapper.deleteSysUserLikeById(id);
    }

    @Override
    public List<SysUserLike> selectSysUserLikeByUserIdAndTargetId(Long userId) {
    	return sysUserLikeMapper.selectSysUserLikeByUserIdAndTargetId(userId);
    }
}
