Browse Source

乐迷,学生扩展声部,选择全部声部时,需要查询该学生所有扩展声部对应的曲子

zouxuan 8 months ago
parent
commit
442c4551e5

+ 25 - 0
mec-application/src/main/java/com/ym/mec/student/controller/SysMusicScoreController.java

@@ -1,20 +1,26 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.enums.ClientEnum;
 import com.ym.mec.biz.dal.enums.ClientTypeEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.dal.wrapper.MusicSheetWrapper;
+import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
 import com.ym.mec.biz.service.SysMusicScoreService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
 
 @RequestMapping("${app-config.url.student:}/sysMusicScore")
 @Api(tags = "曲库")
@@ -26,6 +32,8 @@ public class SysMusicScoreController extends BaseController {
 
     @Resource
     private SysUserService sysUserService;
+    @Resource
+    private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage2")
     public Object queryPage2(SysExamSongQueryInfo queryInfo) {
@@ -35,6 +43,23 @@ public class SysMusicScoreController extends BaseController {
         queryInfo.setType("COMMON");
         queryInfo.setClientFlag(true);
         queryInfo.setClientType(ClientTypeEnum.SMART_PRACTICE);
+        if(queryInfo.getSubjectId() == null && StringUtils.isNotEmpty(queryInfo.getCategoriesId())){
+            List<Subject> subjects = sysMusicScoreAccompanimentService.querySubjectIds(Integer.parseInt(queryInfo.getCategoriesId()));
+            if(CollectionUtils.isNotEmpty(subjects)){
+                StringBuffer subjectIds = new StringBuffer();
+                for (Subject subject : subjects) {
+                    if(subjectIds.length() > 0){
+                        subjectIds.append(",");
+                    }
+                    if (subject.getId() == 5){
+                        subjectIds.append("6");
+                    }else if(queryInfo.getSubjectId() == 122){
+                        subjectIds.append("122,121,113,23");
+                    }
+                }
+                queryInfo.setSubjectIds(subjectIds.toString());
+            }
+        }
         return succeed(sysMusicScoreService.queryMusicScorePageInfo(queryInfo));
     }
 

+ 9 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java

@@ -300,9 +300,16 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
     @Override
     public PageInfo<SysMusicScore> queryMusicScorePage(SysExamSongQueryInfo queryInfo) {
         //封装查询参数
-//        queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
         if(queryInfo.getSubjectId() != null){
-            queryInfo.setSubjectIds(queryInfo.getSubjectId().toString());
+            if(queryInfo.getSubjectId() == 5){
+                queryInfo.setSubjectId(null);
+                queryInfo.setSubjectIds("6");
+            }else if(queryInfo.getSubjectId() == 122){
+                queryInfo.setSubjectId(null);
+                queryInfo.setSubjectIds("122,121,113,23");
+            }else {
+                queryInfo.setSubjectIds(queryInfo.getSubjectId().toString());
+            }
         }
         this.initCategoryIds(queryInfo);