package com.template.services.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.template.model.pojo.AlumniActivity;
import com.template.mapper.AlumniActivityMapper;
import com.template.model.pojo.AlumniCategoryImage;
import com.template.model.result.PageUtils;
import com.template.model.vo.AlumniActivityApplyPageVo;
import com.template.model.vo.AlumniActivityPageVo;
import com.template.model.vo.AlumniMyActivityPageVo;
import com.template.services.AlumniActivityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ceshi
 * @since 2024-11-27
 */
@Service
public class AlumniActivityServiceImpl extends ServiceImpl<AlumniActivityMapper, AlumniActivity> implements AlumniActivityService {

    @Autowired
    private AlumniActivityMapper alumniActivityMapper;

    @Override
    public int insertAlumniActivity(AlumniActivity au) {
        int result = alumniActivityMapper.insert(au);
        return result;
    }

    @Override
    public int updateAlumniActivity(AlumniActivity au) {
        int result = alumniActivityMapper.updateById(au);
        return result;
    }

    @Override
    public AlumniActivity queryDataById(Integer id) {
        AlumniActivity result = alumniActivityMapper.selectById(id);
        return result;
    }

    @Override
    public int deleteDataById(Integer id) {
        int result = alumniActivityMapper.deleteById(id);
        return result;
    }

    @Override
    public PageUtils<AlumniActivityPageVo> queryActivityPages(int currentPage, int pageCount, String userName, Integer collegeId, Integer periodId, Integer majorId, Integer classId, String orgName, String theme, String stateStr, String createStartTime, String createEndTime, String startTime, String endTime, String signsTime, String signeTime) {
        Page<AlumniActivityPageVo> page = new Page<>(currentPage, pageCount);
        IPage<AlumniActivityPageVo> result = alumniActivityMapper.queryActivityPages(page, userName, collegeId, periodId, majorId, classId, orgName, theme, stateStr, createStartTime, createEndTime, startTime, endTime, signsTime, signeTime);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<AlumniActivityApplyPageVo> queryActivityApplyPages(int currentPage, int pageCount, Integer userId, String userName, Integer collegeId, Integer periodId, Integer majorId, Integer classId, String orgName, String theme, Integer isPass, String createStartTime, String createEndTime, String startTime, String endTime, String signsTime, String signeTime) {
        Page<AlumniActivityApplyPageVo> page = new Page<>(currentPage, pageCount);
        IPage<AlumniActivityApplyPageVo> result = alumniActivityMapper.queryActivityApplyPages(page, userId, userName, collegeId, periodId, majorId, classId, orgName, theme, isPass, createStartTime, createEndTime, startTime, endTime, signsTime, signeTime);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<AlumniMyActivityPageVo> queryMyActivityPages(int currentPage, int pageCount, Integer userId, Integer isPass) {
        Page<AlumniMyActivityPageVo> page = new Page<>(currentPage, pageCount);
        IPage<AlumniMyActivityPageVo> result = alumniActivityMapper.queryMyActivityPages(page, userId, isPass);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<AlumniMyActivityPageVo> queryMyActivityApplyPages(int currentPage, int pageCount, Integer userId, String keyword) {
        Page<AlumniMyActivityPageVo> page = new Page<>(currentPage, pageCount);
        IPage<AlumniMyActivityPageVo> result = alumniActivityMapper.queryMyActivityApplyPages(page, userId, keyword);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<AlumniMyActivityPageVo> queryApproveActivityApplyPages(int currentPage, int pageCount, Integer userId, String userName) {
        Page<AlumniMyActivityPageVo> page = new Page<>(currentPage, pageCount);
        IPage<AlumniMyActivityPageVo> result = alumniActivityMapper.queryApproveActivityApplyPages(page, userId, userName);
        return new PageUtils(result);
    }
}
