package com.xinyilu.system.service.sysuserclassrelation.impl;

import com.xinyilu.common.utils.DateUtils;
import com.xinyilu.system.domain.sysuserclassrelation.SysUserClassRelation;
import com.xinyilu.system.mapper.sysuserclassrelation.SysUserClassRelationMapper;
import com.xinyilu.system.service.sysuserclassrelation.ISysUserClassRelationService;
import org.springframework.stereotype.Service;

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

/**
 * 用户所属班级关系Service业务层处理
 *
 * @author xinyilu
 * @date 2023-07-31
 */
@Service
public class SysUserClassRelationServiceImpl implements ISysUserClassRelationService {
    @Resource
    private SysUserClassRelationMapper sysUserClassRelationMapper;

    /**
     * 查询用户所属班级关系
     *
     * @param id 用户所属班级关系主键
     * @return 用户所属班级关系
     */
    @Override
    public SysUserClassRelation selectSysUserClassRelationById(Long id) {
        return sysUserClassRelationMapper.selectSysUserClassRelationById(id);
    }

    /**
     * 查询用户所属班级关系列表
     *
     * @param sysUserClassRelation 用户所属班级关系
     * @return 用户所属班级关系
     */
    @Override
    public List<SysUserClassRelation> selectSysUserClassRelationList(SysUserClassRelation sysUserClassRelation) {
        return sysUserClassRelationMapper.selectSysUserClassRelationList(sysUserClassRelation);
    }

    /**
     * 新增用户所属班级关系
     *
     * @param sysUserClassRelation 用户所属班级关系
     * @return 结果
     */
    @Override
    public int insertSysUserClassRelation(SysUserClassRelation sysUserClassRelation) {
        sysUserClassRelation.setCreateTime(DateUtils.getNowDate());
        return sysUserClassRelationMapper.insertSysUserClassRelation(sysUserClassRelation);
    }

    /**
     * 修改用户所属班级关系
     *
     * @param sysUserClassRelation 用户所属班级关系
     * @return 结果
     */
    @Override
    public int updateSysUserClassRelation(SysUserClassRelation sysUserClassRelation) {
        sysUserClassRelation.setUpdateTime(DateUtils.getNowDate());
        return sysUserClassRelationMapper.updateSysUserClassRelation(sysUserClassRelation);
    }

    /**
     * 批量删除用户所属班级关系
     *
     * @param ids 需要删除的用户所属班级关系主键
     * @return 结果
     */
    @Override
    public int deleteSysUserClassRelationByIds(Long[] ids) {
        return sysUserClassRelationMapper.deleteSysUserClassRelationByIds(ids);
    }

    /**
     * 删除用户所属班级关系信息
     *
     * @param id 用户所属班级关系主键
     * @return 结果
     */
    @Override
    public int deleteSysUserClassRelationById(Long id) {
        return sysUserClassRelationMapper.deleteSysUserClassRelationById(id);
    }
}
