package yangtz.cs.liu.wechat.controller.schoolGrade;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.MpLoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.framework.util.UserInfoUtil;
import com.ruoyi.framework.web.service.TokenService;
import lombok.Data;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import yangtz.cs.liu.campus.domain.schoolgrade.SchoolGrade;
import yangtz.cs.liu.campus.domain.student.SchoolStudent;
import yangtz.cs.liu.campus.service.schoolgrade.ISchoolGradeService;
import yangtz.cs.liu.campus.service.student.ISchoolStudentService;
import yangtz.cs.liu.campus.service.teacher.ISchoolTeacherService;
import yangtz.cs.liu.wechat.vo.schoolGrade.SchoolGradeVo;

import java.text.SimpleDateFormat;
import java.util.List;

import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotNull;
import static com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank;
import static com.ruoyi.framework.datasource.DynamicDataSourceContextHolder.log;

/**
 * 班级查看
 */
@RestController
@RequestMapping("/wx/schoolGrade")
public class WxSchoolGradeController extends BaseController {

    @Autowired
    private ISchoolGradeService schoolGradeService;

    @Autowired
    private UserInfoUtil userInfoUtil;

    @Autowired
    private ISchoolStudentService schoolStudentService;

    @Autowired
    private ISchoolTeacherService schoolTeacherService;


//    /**
//     * 家长查看班级信息
//     *
//     * @return
//     */
//    @GetMapping("/getUserGradeByParent")
//    public AjaxResult getUserGradeByParent(Long studentId) {
//        SchoolGrade grade = schoolGradeService.getUserGradeByParent(studentId);
//        return AjaxResult.success(grade);
//    }
//
//    /**
//     * 家长查看该班级同学
//     *
//     * @return
//     */
//    @GetMapping("/getMemberByParent")
//    public TableDataInfo getMemberByParent(Long studentId) {
//        startPage();
//        List<SchoolStudent> studentList = schoolStudentService.getMemberByParent(studentId);
//        return getDataTable(studentList);
//    }
//
//
//    /**
//     * 老师查看班级信息
//     *
//     * @return
//     */
//    @GetMapping("/getUserGradeByTeacher")
//    public AjaxResult getUserGradeByTeacher() {
//        Long teacherId = userInfoUtil.getTeacherId();
//        List<SchoolGradeVo> schoolGradeVoList = schoolGradeService.getUserGradeByTeacher(teacherId);
//        return AjaxResult.success(schoolGradeVoList);
//    }
//
//    @GetMapping("/getGradeById/{gradeId}")
//    public AjaxResult getGradeById(@PathVariable("gradeId") Long gradeId) {
//        return AjaxResult.success(schoolGradeService.getById(gradeId));
//    }
//
////    /**
////     * 老师查看学生详细列表
////     *
////     * @return
////     */
////    @GetMapping("/getMemberByTeacher")
////    public TableDataInfo getMemberByTeacher() {
////        startPage();
////        List<SchoolStudent> schoolStudentList = schoolStudentService.getMemberByTeacher(userInfoUtil.getTeacherId());
////        return getDataTable(schoolStudentList);
////    }
//
//    /**
//     * 老师根据班级id查看学生
//     *
//     * @param gradeId
//     * @return
//     */
//    @GetMapping("/getMemberByGradeId/{gradeId}")
//    public TableDataInfo getMemberByGradeId(@PathVariable("gradeId") Long gradeId, SchoolStudent student) {
//        startPage();
//        LambdaQueryWrapper<SchoolStudent> lqw = new LambdaQueryWrapper<>();
//        lqw
//                //.eq(SchoolStudent::getGradeId, gradeId)
//                .eq(SchoolStudent::getClassId, gradeId)
//                .like(isNotBlank(student.getStudentName()), SchoolStudent::getStudentName, student.getStudentName())
//        ;
//        List<SchoolStudent> list = schoolStudentService.list(lqw);
//        return getDataTable(list);
//    }
//
//    /**
//     * 老师修改（班级口号）
//     *
//     * @param schoolGrade
//     * @return
//     */
//    @PutMapping("/edit")
//    public AjaxResult edit(@RequestBody SchoolGrade schoolGrade) {
//        return toAjax(schoolGradeService.updateById(schoolGrade));
//    }
//
//
////    /**
////     * 教职工通过学生id查询学生基本信息
////     *
////     * @param studentId
////     * @return
////     */
////    @GetMapping("/studentInfo")
////    public AjaxResult studentInfo(Long studentId) {
////        return AjaxResult.success(schoolStudentService.getStudentInfo(studentId));
////    }


}
