package com.srs.comprehensive.service.impl;

import com.srs.common.annotation.DataSource;
import com.srs.common.enums.DataSourceType;
import com.srs.comprehensive.domain.Dto.SelectClass;
import com.srs.comprehensive.mapper.SyncDataMapper;
import com.srs.comprehensive.service.SyncDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service
public class SyncDataServiceImpl implements SyncDataService {
    @Autowired
    private SyncDataMapper syncDataMapper;
    @Override
    public List<Map> getEmployEEInfoList(String zgh) {
        return syncDataMapper.getEmployEEInfoList(zgh);
    }
    @Override
    public List<Map> getSpecialtyInfoList(String zydm) {
        return syncDataMapper.getSpecialtyInfoList(zydm);
    }
    @Override
    public  List<Map> getSpecialtyALLInfo(){
        return syncDataMapper.getSpecialtyALLInfo();
    }
    @Override
    public  List<Map> getClassInfoList(SelectClass selectClass){
        return  syncDataMapper.getClassInfoList(selectClass);
    }
    //统计学生数量
    @Override
    public int getStudentInfoNumber(String gradeCode) {
        return syncDataMapper.selectNumber(gradeCode);
    }
    @Override
    public List<Map> getStudentInfoList(Integer pageNum,Integer pageSize,String stuNo,String gradeCode) {
        // 1. 参数校验：页码/条数不能为空，且≥1
        if (pageNum == null || pageNum < 1) {
            pageNum = 1;
        }
        if (pageSize == null || pageSize < 1) {
            pageSize = 10; // 默认每页10条
        }
        int offset = (pageNum - 1) * pageSize;
        return syncDataMapper.getStudentInfoList(offset,pageSize,stuNo,gradeCode);
    }
}
