puzhibing
2023-11-25 53e7558400dcacecdce70e39ebfe1727740f9296
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package com.dsh.course.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsh.course.entity.CoursePackageStudent;
import com.dsh.course.model.QueryCoursePackageStudent;
import com.dsh.course.model.QueryCoursePackageStudentList;
import com.dsh.course.service.CoursePackageStudentService;
import com.dsh.course.util.PageFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
import java.util.Map;
 
/**
 * @author zhibing.pu
 * @Date 2023/8/11 17:39
 */
@RestController
@RequestMapping("")
public class CoursePackageStudentController {
 
    @Autowired
    private CoursePackageStudentService coursePackageStudentService;
 
 
    /**
     * 根据排课id获取预约数据
     *
     * @param queryCoursePackageStudentList
     * @return
     */
    @ResponseBody
    @PostMapping("/coursePackageStudent/queryCoursePackageStudentList")
    public Page<Map<String, Object>> queryCoursePackageStudentList(@RequestBody QueryCoursePackageStudentList queryCoursePackageStudentList) {
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(queryCoursePackageStudentList.getLimit(), queryCoursePackageStudentList.getOffset(),
                queryCoursePackageStudentList.getSort(), queryCoursePackageStudentList.getOrder());
        Page<Map<String, Object>> mapPage = page.setRecords(coursePackageStudentService.queryCoursePackageStudentList(page, queryCoursePackageStudentList));
        return mapPage;
    }
 
 
    /**
     * 根据id获取数据
     *
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/coursePackageStudent/queryCoursePackageStudentById")
    public CoursePackageStudent queryCoursePackageStudentById(@RequestBody Long id) {
        return coursePackageStudentService.getById(id);
    }
 
 
    /**
     * 修改数据
     *
     * @param coursePackageStudent
     */
    @ResponseBody
    @PostMapping("/coursePackageStudent/editCoursePackageStudent")
    public void editCoursePackageStudent(@RequestBody CoursePackageStudent coursePackageStudent) {
        coursePackageStudentService.updateById(coursePackageStudent);
    }
 
 
    /**
     * 根据排课id获取预约数据
     *
     * @param coursePackageSchedulingId
     * @return
     */
    @ResponseBody
    @PostMapping("/coursePackageStudent/queryByCoursePackageSchedulingId")
    public List<CoursePackageStudent> queryByCoursePackageSchedulingId(@RequestBody List<Long> coursePackageSchedulingId) {
        return coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().in("coursePackageSchedulingId", coursePackageSchedulingId));
    }
 
 
    /**
     * 获取上课记录数据
     *
     * @param queryCoursePackageStudent
     * @return
     */
    @ResponseBody
    @PostMapping("/coursePackageStudent/queryCoursePackageStudent")
    public List<CoursePackageStudent> queryCoursePackageStudent(@RequestBody QueryCoursePackageStudent queryCoursePackageStudent) {
        QueryWrapper<CoursePackageStudent> wrapper = new QueryWrapper<>();
        if (null != queryCoursePackageStudent.getAppUserId()) {
            wrapper.eq("appUserId", queryCoursePackageStudent.getAppUserId());
        }
        if (null != queryCoursePackageStudent.getStudentId()) {
            wrapper.eq("studentId", queryCoursePackageStudent.getStudentId());
        }
        if (null != queryCoursePackageStudent.getCoursePackageId()) {
            wrapper.eq("coursePackageId", queryCoursePackageStudent.getCoursePackageId());
        }
        if (null != queryCoursePackageStudent.getCoursePackagePaymentId()) {
            wrapper.eq("coursePackagePaymentId", queryCoursePackageStudent.getCoursePackagePaymentId());
        }
        if (null != queryCoursePackageStudent.getCoursePackageSchedulingId()) {
            wrapper.eq("coursePackageSchedulingId", queryCoursePackageStudent.getCoursePackageSchedulingId());
        }
        if (null != queryCoursePackageStudent.getSignInOrNot()) {
            wrapper.eq("signInOrNot", queryCoursePackageStudent.getSignInOrNot());
        }
        if (null != queryCoursePackageStudent.getReservationStatus()) {
            wrapper.eq("reservationStatus", queryCoursePackageStudent.getReservationStatus());
        }
        return coursePackageStudentService.list(wrapper);
    }
 
 
    /**
     * 添加学员上课数据
     *
     * @param coursePackageStudent
     */
    @ResponseBody
    @PostMapping("/coursePackageStudent/addCoursePackageStudent")
    public void addCoursePackageStudent(@RequestBody CoursePackageStudent coursePackageStudent) {
        coursePackageStudentService.save(coursePackageStudent);
    }
}