|
@@ -2,12 +2,16 @@ package com.management.platform.controller;
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.management.platform.entity.CourseInfo;
|
|
|
import com.management.platform.entity.User;
|
|
|
+import com.management.platform.entity.dto.CourseInfoDto;
|
|
|
import com.management.platform.service.CourseInfoService;
|
|
|
import com.management.platform.service.UserService;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -19,6 +23,7 @@ import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
@@ -88,5 +93,31 @@ public class CourseInfoController {
|
|
|
courseInfoService.removeById(id);
|
|
|
return msg;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ * @param courseInfoDto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/list")
|
|
|
+ public HttpRespMsg list(CourseInfoDto courseInfoDto) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ QueryWrapper<CourseInfo> wrapper = new QueryWrapper<>();
|
|
|
+ if(StringUtils.isNotEmpty(courseInfoDto.getCourseName())){
|
|
|
+ wrapper.like("course_name", courseInfoDto.getCourseName());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(courseInfoDto.getCourseName())){
|
|
|
+ wrapper.like("course_instructor", courseInfoDto.getCourseInstructor());
|
|
|
+ }
|
|
|
+ if(courseInfoDto.getCourseType()!=null){
|
|
|
+ wrapper.eq("course_type", courseInfoDto.getCourseType());
|
|
|
+ }
|
|
|
+ IPage<CourseInfo> page = courseInfoService.page(new Page<CourseInfo>(courseInfoDto.getPage(), courseInfoDto.getSize()), wrapper);
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("records", page.getRecords());
|
|
|
+ map.put("total", page.getTotal());
|
|
|
+ msg.setData(map);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|
|
|
|