实验班级添加课程查询

master
pd 4 years ago
parent fcc34b7f50
commit bd0ff253da
  1. 10
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 4
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  3. 8
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -51,9 +52,13 @@ public class ExperimentalClassController {
* @return * @return
*/ */
@GetMapping("/queryExperimentalClass") @GetMapping("/queryExperimentalClass")
Response queryExperimentalClass(@RequestParam Integer schoolId) { Response queryExperimentalClass(@RequestParam Integer schoolId,@RequestParam Integer courseId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret=classService.queryExperimentalClass(schoolId); if(StringUtils.isEmpty(schoolId)){
resp.setStatus(300);
resp.setErrmessage("学校信息为空");
}else{
HashMap<String, Object> ret=classService.queryExperimentalClass(schoolId,courseId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -62,6 +67,7 @@ public class ExperimentalClassController {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
}
return resp; return resp;
} }

@ -31,9 +31,9 @@ public interface ExperimentalClassMapper {
@Select({"<script>", @Select({"<script>",
"SELECT experimentalClassId,experimentalClassName,classSize,creationTime,founder,courseId,userId,schoolId " "SELECT experimentalClassId,experimentalClassName,classSize,creationTime,founder,courseId,userId,schoolId "
+ "from experimental_class_ning where isdel = 0 and schoolId = #{schoolId}", + "from experimental_class_ning where isdel = 0 and schoolId = #{schoolId} and courseId=#{courseId}",
"</script> "}) "</script> "})
List<ExperimentalClass> queryExperimentalClass(Integer schoolId); List<ExperimentalClass> queryExperimentalClass(Integer schoolId,Integer courseId);
//查询实验班级学生专业 //查询实验班级学生专业
@Select({"<script>", @Select({"<script>",

@ -16,6 +16,7 @@ import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.mapper.ExperimentalClassMapper; import com.yipin.liuwanr.mapper.ExperimentalClassMapper;
import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper; import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper;
import com.yipin.liuwanr.vo.ExperimentalClassVo; import com.yipin.liuwanr.vo.ExperimentalClassVo;
import org.springframework.util.StringUtils;
@Service @Service
public class ExperimentalClassService { public class ExperimentalClassService {
@ -97,12 +98,13 @@ public class ExperimentalClassService {
return resp; return resp;
} }
public HashMap<String, Object> queryExperimentalClass(Integer schoolId) { public HashMap<String, Object> queryExperimentalClass(Integer schoolId,Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId)); if(!StringUtils.isEmpty(courseId)){
List<ExperimentalClass> a = experimentalClassMapper.queryExperimentalClass(schoolId); resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId,courseId));
resp.put("retcode", 200); resp.put("retcode", 200);
}
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);

Loading…
Cancel
Save