实验班级添加课程查询

master
pd 4 years ago
parent fcc34b7f50
commit bd0ff253da
  1. 24
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 4
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  3. 10
      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.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -51,16 +52,21 @@ public class ExperimentalClassController {
* @return
*/
@GetMapping("/queryExperimentalClass")
Response queryExperimentalClass(@RequestParam Integer schoolId) {
Response queryExperimentalClass(@RequestParam Integer schoolId,@RequestParam Integer courseId) {
Response resp = new Response();
HashMap<String, Object> ret=classService.queryExperimentalClass(schoolId);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
if(StringUtils.isEmpty(schoolId)){
resp.setStatus(300);
resp.setErrmessage("学校信息为空");
}else{
HashMap<String, Object> ret=classService.queryExperimentalClass(schoolId,courseId);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}

@ -31,9 +31,9 @@ public interface ExperimentalClassMapper {
@Select({"<script>",
"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> "})
List<ExperimentalClass> queryExperimentalClass(Integer schoolId);
List<ExperimentalClass> queryExperimentalClass(Integer schoolId,Integer courseId);
//查询实验班级学生专业
@Select({"<script>",

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

Loading…
Cancel
Save