| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.CoursePackageScheduling; |
| | | import com.dsh.course.model.QueryCoursePackageSchedulingList; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 获取课包排课列表 |
| | | * |
| | | * @param queryCoursePackageSchedulingList |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/queryCoursePackageSchedulingList") |
| | | public Page<Map<String, Object>> queryCoursePackageSchedulingList(@RequestBody QueryCoursePackageSchedulingList queryCoursePackageSchedulingList){ |
| | | public Page<Map<String, Object>> queryCoursePackageSchedulingList(@RequestBody QueryCoursePackageSchedulingList queryCoursePackageSchedulingList) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(queryCoursePackageSchedulingList.getLimit(), queryCoursePackageSchedulingList.getOffset(), |
| | | queryCoursePackageSchedulingList.getSort(), queryCoursePackageSchedulingList.getOrder()); |
| | | Page<Map<String, Object>> mapPage = page.setRecords(coursePackageSchedulingService.queryCoursePackageSchedulingList(page, queryCoursePackageSchedulingList)); |
| | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/queryCoursePackageSchedulingById") |
| | | public CoursePackageScheduling queryCoursePackageSchedulingById(@RequestBody Long id){ |
| | | public CoursePackageScheduling queryCoursePackageSchedulingById(@RequestBody Long id) { |
| | | return coursePackageSchedulingService.getById(id); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/queryCoursePackageSchedulingsById") |
| | | public List<CoursePackageScheduling> queryCoursePackageSchedulingsById(@RequestBody Long id) { |
| | | CoursePackageScheduling byId = coursePackageSchedulingService.getById(id); |
| | | Date date = new Date(); // 假设你有一个 Date 对象 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String formattedDate = sdf.format(byId.getClassDate()); |
| | | List<CoursePackageScheduling> list = coursePackageSchedulingService.list(new LambdaQueryWrapper<CoursePackageScheduling>().eq(CoursePackageScheduling::getCoursePackageId, byId.getCoursePackageId()).eq(CoursePackageScheduling::getClassDate, formattedDate)); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑数据 |
| | | * |
| | | * @param coursePackageScheduling |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/editCoursePackageScheduling") |
| | | public void editCoursePackageScheduling(@RequestBody CoursePackageScheduling coursePackageScheduling){ |
| | | coursePackageScheduling.setCoursePackageId(null); |
| | | coursePackageSchedulingService.updateById(coursePackageScheduling); |
| | | public void editCoursePackageScheduling(@RequestBody List<CoursePackageScheduling> coursePackageScheduling) { |
| | | // coursePackageScheduling.setCoursePackageId(null); |
| | | for (CoursePackageScheduling packageScheduling : coursePackageScheduling) { |
| | | packageScheduling.setCoursePackageId(null); |
| | | } |
| | | coursePackageSchedulingService.updateBatchById(coursePackageScheduling); |
| | | } |
| | | |
| | | /** |
| | | * 新增数据 |
| | | * |
| | | * @param coursePackageScheduling |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageScheduling/saveCoursePackageScheduling") |
| | | public void addCoursePackageScheduling(@RequestBody CoursePackageScheduling coursePackageScheduling){ |
| | | public void addCoursePackageScheduling(@RequestBody CoursePackageScheduling coursePackageScheduling) { |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | } |
| | | } |