package com.ruoyi.hezhi.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.hezhi.domain.TbMemberSubjectWrong;
import com.ruoyi.hezhi.mapper.TbMemberSubjectWrongMapper;
import com.ruoyi.hezhi.service.ITbMemberSubjectWrongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 我的错题Service业务层处理
 *
 * @author ruoyi
 * @date 2024-11-07
 */
@Service
public class TbMemberSubjectWrongServiceImpl implements ITbMemberSubjectWrongService
{
    @Autowired
    private TbMemberSubjectWrongMapper tbMemberSubjectWrongMapper;

    /**
     * 查询我的错题
     *
     * @param memberSubjectWrongId 我的错题主键
     * @return 我的错题
     */
    @Override
    public TbMemberSubjectWrong selectTbMemberSubjectWrongByMemberSubjectWrongId(Long memberSubjectWrongId)
    {
        return tbMemberSubjectWrongMapper.selectTbMemberSubjectWrongByMemberSubjectWrongId(memberSubjectWrongId);
    }

    /**
     * 查询我的错题列表
     *
     * @param tbMemberSubjectWrong 我的错题
     * @return 我的错题
     */
    @Override
    public List<TbMemberSubjectWrong> selectTbMemberSubjectWrongList(TbMemberSubjectWrong tbMemberSubjectWrong)
    {
        return tbMemberSubjectWrongMapper.selectTbMemberSubjectWrongList(tbMemberSubjectWrong);
    }

    /**
     * 新增我的错题
     *
     * @param tbMemberSubjectWrong 我的错题
     * @return 结果
     */
    @Override
    public int insertTbMemberSubjectWrong(TbMemberSubjectWrong tbMemberSubjectWrong)
    {
        tbMemberSubjectWrong.setCreateTime(DateUtils.getNowDate());
        return tbMemberSubjectWrongMapper.insertTbMemberSubjectWrong(tbMemberSubjectWrong);
    }

    /**
     * 修改我的错题
     *
     * @param tbMemberSubjectWrong 我的错题
     * @return 结果
     */
    @Override
    public int updateTbMemberSubjectWrong(TbMemberSubjectWrong tbMemberSubjectWrong)
    {
        tbMemberSubjectWrong.setUpdateTime(DateUtils.getNowDate());
        return tbMemberSubjectWrongMapper.updateTbMemberSubjectWrong(tbMemberSubjectWrong);
    }

    /**
     * 批量删除我的错题
     *
     * @param memberSubjectWrongIds 需要删除的我的错题主键
     * @return 结果
     */
    @Override
    public int deleteTbMemberSubjectWrongByMemberSubjectWrongIds(Long[] memberSubjectWrongIds)
    {
        return tbMemberSubjectWrongMapper.deleteTbMemberSubjectWrongByMemberSubjectWrongIds(memberSubjectWrongIds);
    }

    /**
     * 删除我的错题信息
     *
     * @param memberSubjectWrongId 我的错题主键
     * @return 结果
     */
    @Override
    public int deleteTbMemberSubjectWrongByMemberSubjectWrongId(Long memberSubjectWrongId)
    {
        return tbMemberSubjectWrongMapper.deleteTbMemberSubjectWrongByMemberSubjectWrongId(memberSubjectWrongId);
    }

    /**
     * 错题数量
     *
     * @param params 参数
     * @return 结果
     */
    @Override
    public int countByParams(Map<String, Object> params) {
        return tbMemberSubjectWrongMapper.countByParams(params);
    }
}
