package com.yida.data.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.user.EduCourse;
import com.yida.data.user.mapper.EduCourseMapper;
import com.yida.data.user.service.EduCourseService;

import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Service
public class EduCourseServiceImpl extends ServiceImpl<EduCourseMapper, EduCourse> implements EduCourseService {

    private static final List<String> COURSE_BASE_LIST = Arrays.asList(
            "语文", "数学", "英语", "物理", "化学", "生物", "政治", "历史", "地理"
    );

    @Override
    public void initCourse(Long schoolId, CurrentUser currentUser) {
        List<EduCourse> courseList = new ArrayList<>();
        for (String courseName : COURSE_BASE_LIST) {
            EduCourse course = new EduCourse();
            course.setCourseName(courseName);
            course.setSchoolId(schoolId);
            course.setCreateId(currentUser.getUserId());
            courseList.add(course);
        }
        saveBatch(courseList);
    }
}
