Ver Fonte

Merge remote-tracking branch 'origin/master'

Joburgess há 5 anos atrás
pai
commit
b34bf02721

+ 30 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectController.java

@@ -0,0 +1,30 @@
+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.entity.ExamSong;
+import com.keao.edu.user.entity.Subject;
+import com.keao.edu.user.service.ExamSubjectService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("examSubject")
+@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) {
+        return succeed(examSubjectService.getExamSubjects(ExamId));
+    }
+}

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

@@ -2,21 +2,29 @@ package com.keao.edu.user.dao;
 
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.entity.ExamSubject;
+import com.keao.edu.user.entity.Subject;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 public interface ExamSubjectDao extends BaseDAO<Long, ExamSubject> {
 
-    int batchInsert(@Param("examSubjects")List<ExamSubject> examSubjects);
+    int batchInsert(@Param("examSubjects") List<ExamSubject> examSubjects);
 
     /**
+     * @param examId: 考级项目编号
+     * @return java.util.List<com.keao.edu.user.entity.ExamSubject>
      * @describe 获取考级项目关联的声部
      * @author Joburgess
      * @date 2020.06.19
-     * @param examId: 考级项目编号
-     * @return java.util.List<com.keao.edu.user.entity.ExamSubject>
      */
     List<ExamSubject> getWithTenant(@Param("examId") Integer examId);
-	
+
+    /**
+     * 根据考级项目编号获取相关专业
+     *
+     * @param examId 考级项目编号
+     * @return
+     */
+    List<Subject> getSubjectWithExamId(@Param("examId") Integer examId);
 }

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

@@ -3,7 +3,17 @@ package com.keao.edu.user.service;
 
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.entity.ExamSubject;
+import com.keao.edu.user.entity.Subject;
+
+import java.util.List;
 
 public interface ExamSubjectService extends BaseService<Long, ExamSubject> {
 
+
+    /**
+     * 根据考试项目id获取考试专业列表
+     * @param ExamId
+     * @return
+     */
+    List<Subject> getExamSubjects(Integer ExamId);
 }

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

@@ -4,10 +4,13 @@ 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.entity.ExamSubject;
+import com.keao.edu.user.entity.Subject;
 import com.keao.edu.user.service.ExamSubjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class ExamSubjectServiceImpl extends BaseServiceImpl<Long, ExamSubject> implements ExamSubjectService {
 	
@@ -18,5 +21,9 @@ public class ExamSubjectServiceImpl extends BaseServiceImpl<Long, ExamSubject> i
 	public BaseDAO<Long, ExamSubject> getDAO() {
 		return examSubjectDao;
 	}
-	
+
+    @Override
+    public List<Subject> getExamSubjects(Integer ExamId) {
+		return examSubjectDao.getSubjectWithExamId(ExamId);
+    }
 }

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

@@ -76,4 +76,9 @@
 	<select id="getWithTenant" resultMap="ExamSubject">
 		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
+		LEFT JOIN subject s on es.subject_id_ = s.id_ WHERE examination_basic_id_ = #{examId}
+	</select>
 </mapper>