package com.dsh.course.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.course.entity.CoursePackageOrderStudent; import com.dsh.course.model.DeductionClassHourList; import com.dsh.course.service.ICoursePackageOrderStudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author zhibing.pu * @Date 2024/2/22 15:27 */ @RestController @RequestMapping("/coursePackageOrderStudent") public class CoursePackageOrderStudentController { @Autowired private ICoursePackageOrderStudentService coursePackageOrderStudentService; /** * 根据学院id获取剩余有效课时数据 * @param studentId * @return */ @ResponseBody @PostMapping("/getCoursePackageOrderStudent") public List getCoursePackageOrderStudent(@RequestBody Integer studentId){ return coursePackageOrderStudentService.list(new QueryWrapper() .eq("studentId", studentId).eq("status", 1).eq("state", 1) .gt("laveClassHours", 0).last(" and useTime > now()")); } /** * 扣减学员课时 * @param deductionClassHourList * @return */ @ResponseBody @PostMapping("/deductionClassHour") public boolean deductionClassHour(@RequestBody DeductionClassHourList deductionClassHourList){ return coursePackageOrderStudentService.deductionClassHour(deductionClassHourList); } }