Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

Joburgess 5 vuotta sitten
vanhempi
commit
a88064b265

+ 6 - 5
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectController.java

@@ -2,6 +2,7 @@ package com.keao.edu.user.controller;
 
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
+import com.keao.edu.user.dto.ExamSubjectDto;
 import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.entity.Subject;
 import com.keao.edu.user.service.ExamSubjectService;
@@ -15,16 +16,16 @@ import java.util.List;
 
 @RestController
 @RequestMapping("examSubject")
-@Api(tags = "考级内容服务")
+@Api(tags = "考级项目考级专业服务")
 public class ExamSubjectController extends BaseController {
 
     @Autowired
     private ExamSubjectService examSubjectService;
 
-    @ApiOperation("查询曲库详情")
-    @ApiImplicitParam(name = "id", value = "机构ID", required = true, dataType = "Integer", paramType = "path")
-    @GetMapping(value = "/query")
-    public HttpResponseResult<List<Subject>> query(Integer ExamId) {
+    @ApiOperation("获取考试项目专业")
+    @ApiImplicitParam(name = "ExamId", value = "考试项目id", required = true, dataType = "Integer")
+    @GetMapping(value = "/getExamSubjects")
+    public HttpResponseResult<List<ExamSubjectDto>> getExamSubjects(Integer ExamId) {
         return succeed(examSubjectService.getExamSubjects(ExamId));
     }
 }

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectSongController.java

@@ -5,10 +5,13 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.entity.ExamSubjectSong;
 import com.keao.edu.user.page.ExamSubjectSongQueryInfo;
 import com.keao.edu.user.service.ExamSubjectSongService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -47,4 +50,13 @@ public class ExamSubjectSongController extends BaseController {
         return succeed();
     }
 
+
+    @ApiOperation("获取考级专业相应级别的曲目")
+    @ApiImplicitParams({@ApiImplicitParam(name = "examSubjectId", value = "考试项目专业id", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "level", value = "级别", required = true, dataType = "Integer") })
+    @GetMapping(value = "/getExamSubjectSong")
+    public HttpResponseResult<List<ExamSong>> getExamSubjectSong(Long examSubjectId,Integer level) {
+        return succeed(examSubjectSongService.getExamSubjectSong(examSubjectId,level));
+    }
+
 }

+ 11 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSongDao.java

@@ -2,8 +2,18 @@ package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.entity.ExamSong;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ExamSongDao extends BaseDAO<Integer, ExamSong> {
 
-	
+    /**
+     * 获取考试曲目
+     *
+     * @param ids
+     * @return
+     */
+    List<ExamSong> getExamSongs(@Param("ids") String ids);
+
 }

+ 4 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSubjectDao.java

@@ -1,6 +1,7 @@
 package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.dto.ExamSubjectDto;
 import com.keao.edu.user.entity.ExamSubject;
 import com.keao.edu.user.entity.Subject;
 import org.apache.ibatis.annotations.Param;
@@ -26,5 +27,7 @@ public interface ExamSubjectDao extends BaseDAO<Long, ExamSubject> {
      * @param examId 考级项目编号
      * @return
      */
-    List<Subject> getSubjectWithExamId(@Param("examId") Integer examId);
+    List<ExamSubjectDto> getSubjectWithExamId(@Param("examId") Integer examId);
+
+
 }

+ 13 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSubjectSongDao.java

@@ -1,6 +1,7 @@
 package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.entity.ExamSubjectSong;
 import org.apache.ibatis.annotations.Param;
 
@@ -11,12 +12,21 @@ public interface ExamSubjectSongDao extends BaseDAO<Long, ExamSubjectSong> {
     int batchInsert(@Param("examSubjectSongs") List<ExamSubjectSong> examSubjectSongs);
 
     /**
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.entity.ExamSubjectSong>
      * @describe 获取考级项目下的专业设置
      * @author Joburgess
      * @date 2020.06.22
-     * @param examId:
-     * @return java.util.List<com.keao.edu.user.entity.ExamSubjectSong>
      */
     List<ExamSubjectSong> findByExam(@Param("examId") Integer examId);
-	
+
+
+    /**
+     * 获取考试对应科目对应级别的曲目
+     * @param examSubjectId
+     * @param level
+     * @return
+     */
+    ExamSubjectSong getExamSubjectSong(@Param("examSubjectId") Long examSubjectId, @Param("level") Integer level);
+
 }

+ 16 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/ExamSubjectDto.java

@@ -0,0 +1,16 @@
+package com.keao.edu.user.dto;
+
+import com.keao.edu.user.entity.Subject;
+
+public class ExamSubjectDto extends Subject {
+
+    private Long examSubjectId;
+
+    public Long getExamSubjectId() {
+        return examSubjectId;
+    }
+
+    public void setExamSubjectId(Long examSubjectId) {
+        this.examSubjectId = examSubjectId;
+    }
+}

+ 2 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamSubjectService.java

@@ -2,6 +2,7 @@ package com.keao.edu.user.service;
 
 
 import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.dto.ExamSubjectDto;
 import com.keao.edu.user.entity.ExamSubject;
 import com.keao.edu.user.entity.Subject;
 
@@ -15,5 +16,5 @@ public interface ExamSubjectService extends BaseService<Long, ExamSubject> {
      * @param ExamId
      * @return
      */
-    List<Subject> getExamSubjects(Integer ExamId);
+    List<ExamSubjectDto> getExamSubjects(Integer ExamId);
 }

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamSubjectSongService.java

@@ -1,6 +1,7 @@
 package com.keao.edu.user.service;
 
 import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.entity.ExamSubjectSong;
 
 import java.util.List;
@@ -16,4 +17,13 @@ public interface ExamSubjectSongService extends BaseService<Long, ExamSubjectSon
      */
     void addExamSubjects(List<ExamSubjectSong> examSubjectSongs);
 
+
+    /**
+     * 获取考试对应科目对应级别的曲目
+     * @param examSubjectId
+     * @param level
+     * @return
+     */
+    List<ExamSong> getExamSubjectSong(Long examSubjectId,Integer level);
+
 }

+ 1 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -71,6 +71,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
 		examCertification.setLevel(examRegistration.getLevel());
 		examCertification.setExamStartTime(examinationBasic.getExpectExamStartTime());
 		examCertification.setExamEndTime(examinationBasic.getExpectExamEndTime());
+		examCertification.setTenantId(examRegistration.getTenantId());
 		examCertificationDao.insert(examCertification);
 		return examRegistration;
     }

+ 2 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSubjectServiceImpl.java

@@ -3,6 +3,7 @@ package com.keao.edu.user.service.impl;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.user.dao.ExamSubjectDao;
+import com.keao.edu.user.dto.ExamSubjectDto;
 import com.keao.edu.user.entity.ExamSubject;
 import com.keao.edu.user.entity.Subject;
 import com.keao.edu.user.service.ExamSubjectService;
@@ -23,7 +24,7 @@ public class ExamSubjectServiceImpl extends BaseServiceImpl<Long, ExamSubject> i
 	}
 
     @Override
-    public List<Subject> getExamSubjects(Integer ExamId) {
+    public List<ExamSubjectDto> getExamSubjects(Integer ExamId) {
 		return examSubjectDao.getSubjectWithExamId(ExamId);
     }
 }

+ 22 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSubjectSongServiceImpl.java

@@ -6,9 +6,11 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.common.tenant.TenantContextHolder;
+import com.keao.edu.user.dao.ExamSongDao;
 import com.keao.edu.user.dao.ExamSubjectDao;
 import com.keao.edu.user.dao.ExamSubjectSongDao;
 import com.keao.edu.user.dao.ExaminationBasicDao;
+import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.entity.ExamSubject;
 import com.keao.edu.user.entity.ExamSubjectSong;
 import com.keao.edu.user.entity.ExaminationBasic;
@@ -32,6 +34,8 @@ public class ExamSubjectSongServiceImpl extends BaseServiceImpl<Long, ExamSubjec
 	private ExamSubjectSongDao examSubjectSongDao;
 	@Autowired
 	private ExamSubjectDao examSubjectDao;
+	@Autowired
+	private ExamSongDao examSongDao;
 
 	@Override
 	public BaseDAO<Long, ExamSubjectSong> getDAO() {
@@ -97,4 +101,22 @@ public class ExamSubjectSongServiceImpl extends BaseServiceImpl<Long, ExamSubjec
 			examSubjectDao.batchInsert(newExamSubjects);
 		}
 	}
+
+    @Override
+    public List<ExamSong> getExamSubjectSong(Long examSubjectId, Integer level) {
+		List<ExamSong> examSongs = new ArrayList<>();
+		ExamSubjectSong examSubjectSong = examSubjectSongDao.getExamSubjectSong(examSubjectId, level);
+		if(examSubjectSong == null){
+			return examSongs;
+		}
+		List<ExamSong> practiceSong = examSongDao.getExamSongs(examSubjectSong.getPracticeSongIdList());
+		if(practiceSong != null){
+			examSongs.addAll(practiceSong);
+		}
+		List<ExamSong> performSong = examSongDao.getExamSongs(examSubjectSong.getPerformSongIdList());
+		if(performSong != null){
+			examSongs.addAll(performSong);
+		}
+		return examSongs;
+	}
 }

+ 3 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml

@@ -103,4 +103,7 @@
 		SELECT COUNT(*) FROM exam_song
 		<include refid="queryCondition"/>
 	</select>
+    <select id="getExamSongs" resultMap="ExamSong">
+		SELECT * FROM exam_song WHERE FIND_IN_SET(id_,#{ids})
+	</select>
 </mapper>

+ 5 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSubjectMapper.xml

@@ -77,8 +77,11 @@
 		SELECT * FROM exam_subject WHERE examination_basic_id_=#{examId}
 	</select>
 
-	<select id="getSubjectWithExamId" resultMap="com.keao.edu.user.dao.SubjectDao.Subject">
-		SELECT s.* FROM exam_subject es
+	<resultMap id="ExamSubjectDto" type="com.keao.edu.user.dto.ExamSubjectDto" extends="com.keao.edu.user.dao.SubjectDao.Subject" >
+		<result column="exam_subject_id_" property="examSubjectId" />
+	</resultMap>
+	<select id="getSubjectWithExamId" resultMap="ExamSubjectDto">
+		SELECT es.id_ exam_subject_id_ ,s.* FROM exam_subject es
 		LEFT JOIN subject s on es.subject_id_ = s.id_ WHERE examination_basic_id_ = #{examId}
 	</select>
 </mapper>

+ 3 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSubjectSongMapper.xml

@@ -130,4 +130,7 @@
 	<select id="findByExam" resultMap="ExamSubjectSong">
 		SELECT * FROM exam_subject_song WHERE examination_basic_id_=#{examId}
 	</select>
+    <select id="getExamSubjectSong" resultType="com.keao.edu.user.entity.ExamSubjectSong">
+		SELECT * FROM exam_subject_song WHERE exam_subject_id_ = #{examSubjectId} AND level_ = #{level}
+	</select>
 </mapper>