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.AlumniClub;
import com.template.model.pojo.AlumniImage;
import com.template.mapper.AlumniImageMapper;
import com.template.model.result.PageUtils;
import com.template.model.vo.ImageApplyPageVo;
import com.template.model.vo.ImageMobilePageVo;
import com.template.model.vo.ImageMyPageVo;
import com.template.model.vo.ImagePageVo;
import com.template.services.AlumniImageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ceshi
 * @since 2024-11-25
 */
@Service
public class AlumniImageServiceImpl extends ServiceImpl<AlumniImageMapper, AlumniImage> implements AlumniImageService {

    @Autowired
    private AlumniImageMapper alumniImageMapper;

    @Override
    public int insertAlumniImage(AlumniImage au) {
        int result = alumniImageMapper.insert(au);
        return au.getId();
    }

    @Override
    public int updateAlumniImage(AlumniImage au) {
        int result = alumniImageMapper.updateById(au);
        return result;
    }

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

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


    @Override
    public PageUtils<ImagePageVo> imagePageDatas(int currentPage, int pageCount, String userName, String orgName, Integer collegeId, Integer periodId, Integer majorId, Integer classId) {
        Page<ImagePageVo> page = new Page<>(currentPage, pageCount);
        IPage<ImagePageVo> result = alumniImageMapper.imagePageDatas(page, userName, orgName, collegeId, periodId, majorId, classId);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<ImageApplyPageVo> imageApplyPageDatas(int currentPage, int pageCount,Integer userId, String userName, String orgName, Integer collegeId, Integer periodId, Integer majorId, Integer classId, Integer isPass, String startTime, String endTime) {
        Page<ImageApplyPageVo> page = new Page<>(currentPage, pageCount);
        IPage<ImageApplyPageVo> result = alumniImageMapper.imageApplyPageDatas(page,userId, userName, orgName, collegeId, periodId, majorId, classId, isPass, startTime, endTime);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<ImageMobilePageVo> imageMobilePageDatas(int currentPage, int pageCount, String keyword, Integer categoryId) {
        Page<ImageMobilePageVo> page = new Page<>(currentPage, pageCount);
        IPage<ImageMobilePageVo> result = alumniImageMapper.imageMobilePageDatas(page, keyword, categoryId);
        return new PageUtils(result);
    }

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

    @Override
    public PageUtils<ImageMyPageVo> imageMyApplyPageDatas(int currentPage, int pageCount, Integer userId, String name) {
        Page<ImageMyPageVo> page = new Page<>(currentPage, pageCount);
        IPage<ImageMyPageVo> result = alumniImageMapper.imageMyApplyPageDatas(page, userId, name);
        return new PageUtils(result);
    }

    @Override
    public PageUtils<ImageMyPageVo> imageApproveApplyPageDatas(int currentPage, int pageCount, Integer userId, String name) {
        Page<ImageMyPageVo> page = new Page<>(currentPage, pageCount);
        IPage<ImageMyPageVo> result = alumniImageMapper.imageApproveApplyPageDatas(page, userId, name);
        return new PageUtils(result);
    }


}
