package com.xingxi.business.UserFollow.service.impl;

import com.xingxi.common.core.text.Convert;
import com.xingxi.common.utils.DateUtils;
import com.xingxi.business.UserFollow.domain.UserFollow;
import com.xingxi.business.UserFollow.mapper.UserFollowMapper;
import com.xingxi.business.UserFollow.service.IUserFollowService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户收藏Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class UserFollowServiceImpl implements IUserFollowService {
    @Resource
    private UserFollowMapper userFollowMapper;

    /**
     * 查询用户收藏
     *
     * @param userFollowId 用户收藏主键
     * @return 用户收藏
     */
    @Override
    public UserFollow selectUserFollowByUserFollowId(Long userFollowId) {
        return userFollowMapper.selectUserFollowByUserFollowId(userFollowId);
    }

    /**
     * 查询用户收藏列表
     *
     * @param userFollow 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<UserFollow> selectUserFollowList(UserFollow userFollow) {
        return userFollowMapper.selectUserFollowList(userFollow);
    }

    /**
     * 新增用户收藏
     *
     * @param userFollow 用户收藏
     * @return 结果
     */
    @Override
    public int insertUserFollow(UserFollow userFollow) {
        userFollow.setCreateTime(DateUtils.getNowDate());
        return userFollowMapper.insertUserFollow(userFollow);
    }

    /**
     * 新增用户收藏
     *
     * @param userFollowList 用户收藏
     * @return 结果
     */
    @Override
    public int batchInsertUserFollow(List<UserFollow> userFollowList) {
        return userFollowMapper.batchInsertUserFollow(userFollowList);
    }

    /**
     * 修改用户收藏
     *
     * @param userFollow 用户收藏
     * @return 结果
     */
    @Override
    public int updateUserFollow(UserFollow userFollow) {
        userFollow.setUpdateTime(DateUtils.getNowDate());
        return userFollowMapper.updateUserFollow(userFollow);
    }

    /**
     * 批量删除用户收藏
     *
     * @param userFollowIds 需要删除的用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteUserFollowByUserFollowIds(String userFollowIds) {
        return userFollowMapper.deleteUserFollowByUserFollowIds(Convert.toStrArray(userFollowIds));
    }

    /**
     * 删除用户收藏信息
     *
     * @param userFollowId 用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteUserFollowByUserFollowId(Long userFollowId) {
        return userFollowMapper.deleteUserFollowByUserFollowId(userFollowId);
    }

    /**
     * 逻辑删除用户收藏
     *
     * @param userFollowId 用户收藏主键
     * @return 结果
     */
    @Override
    public int logicDeleteUserFollowByUserFollowId(Long userFollowId) {
        return userFollowMapper.logicDeleteUserFollowByUserFollowId(userFollowId);
    }

    /**
     * 逻辑批量删除用户收藏
     *
     * @param userFollowIds 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeleteUserFollowByUserFollowIds(String[] userFollowIds) {
        return userFollowMapper.logicDeleteUserFollowByUserFollowIds(userFollowIds);
    }

    /**
     * 逻辑批量删除用户收藏
     *
     * @param userFollow 用户收藏
     * @return 结果
     */
    @Override
    public int logicDeleteUserFollowByCondition(UserFollow userFollow) {
        return userFollowMapper.logicDeleteUserFollowByCondition(userFollow);
    }
}
