package com.ruoyi.mall.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.mall.domain.Vo.OfflineServicesRegisterVo;
import com.ruoyi.mall.mapper.OfflineServicesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.OfflineServicesRegisterMapper;
import com.ruoyi.mall.domain.OfflineServicesRegister;
import com.ruoyi.mall.service.IOfflineServicesRegisterService;

import javax.annotation.Resource;

/**
 * 报名管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-16
 */
@Service
public class OfflineServicesRegisterServiceImpl implements IOfflineServicesRegisterService 
{
    @Resource
    private OfflineServicesRegisterMapper offlineServicesRegisterMapper;


    /**
     * 查询报名管理
     * 
     * @param registerId 报名管理主键
     * @return 报名管理
     */
    @Override
    public OfflineServicesRegister selectOfflineServicesRegisterByRegisterId(Long registerId)
    {
        return offlineServicesRegisterMapper.selectOfflineServicesRegisterByRegisterId(registerId);
    }

    /**
     * 查询报名管理列表
     * 
     * @param offlineServicesRegister 报名管理
     * @return 报名管理
     */
    @Override
    public List<OfflineServicesRegister> selectOfflineServicesRegisterList(OfflineServicesRegister offlineServicesRegister)
    {
        return offlineServicesRegisterMapper.selectOfflineServicesRegisterList(offlineServicesRegister);
    }

    /**
     *查询已报名Vo列表(包含活动名、用户名)
     * 后台+xcx
     *
     * @param offlineServicesRegister 报名管理
     * @return 报名管理Vo集合
     */
    @Override
    public List<OfflineServicesRegisterVo> selectVoList(OfflineServicesRegister offlineServicesRegister) {
        return offlineServicesRegisterMapper.selectVoList(offlineServicesRegister);
    }

    /**
     * 新增报名管理
     * 
     * @param offlineServicesRegister 报名管理
     * @return 结果
     */
    @Override
    public int insertOfflineServicesRegister(OfflineServicesRegister offlineServicesRegister)
    {   // 获取登陆用户
//        LoginUser loginUser = SecurityUtils.getLoginUser();
//        offlineServicesRegister.setCreateBy(loginUser.getUsername());
        offlineServicesRegister.setCreateTime(DateUtils.getNowDate());
        return offlineServicesRegisterMapper.insertOfflineServicesRegister(offlineServicesRegister);
    }

    /**
     * 修改报名管理
     * 
     * @param offlineServicesRegister 报名管理
     * @return 结果
     */
    @Override
    public int updateOfflineServicesRegister(OfflineServicesRegister offlineServicesRegister)
    {// 获取登陆用户
//        LoginUser loginUser = SecurityUtils.getLoginUser();
//        offlineServicesRegister.setUpdateBy(loginUser.getUsername());
        offlineServicesRegister.setUpdateTime(DateUtils.getNowDate());
        return offlineServicesRegisterMapper.updateOfflineServicesRegister(offlineServicesRegister);
    }

    /**
     * 批量删除报名管理 没有用
     * 
     * @param registerIds 需要删除的报名管理主键
     * @return 结果
     */
    @Override
    public int deleteOfflineServicesRegisterByRegisterIds(Long[] registerIds)
    {
        return offlineServicesRegisterMapper.deleteOfflineServicesRegisterByRegisterIds(registerIds);
    }

    /**
     * 删除报名管理信息 没有用
     *
     * @param registerId 报名管理主键
     * @return 结果
     */
    @Override
    public int deleteOfflineServicesRegisterByRegisterId(Long registerId)
    {
        return offlineServicesRegisterMapper.deleteOfflineServicesRegisterByRegisterId(registerId);
    }
}
