Browse Source

伴奏修改

zouxuan 3 years ago
parent
commit
88d5a48759

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/SysMusicScoreCategoriesMapper.xml

@@ -114,7 +114,7 @@
 		LEFT JOIN organization o ON FIND_IN_SET(o.id_,sm.organ_id_)
 		<where>
 			<if test="organId != null and organId != ''">
-				AND FIND_IN_SET(sm.organ_id_,#{organId})
+				AND INTE_ARRAY(sm.organ_id_,#{organId})
 			</if>
 			<if test="parentId != null">
 				AND sm.parent_id_ = #{parentId}
@@ -136,7 +136,7 @@
 		SELECT COUNT(sm.id_) FROM sys_music_score_categories sm
 		<where>
 			<if test="organId != null and organId != ''">
-				AND FIND_IN_SET(sm.organ_id_,#{organId})
+				AND INTE_ARRAY(sm.organ_id_,#{organId})
 			</if>
 			<if test="parentId != null">
 				AND sm.parent_id_ = #{parentId}

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml

@@ -117,6 +117,9 @@
     <sql id="queryPageSql">
 		<where>
 			ses.del_flag_ = 0
+			<if test="organId != null and organId != null">
+				AND INTE_ARRAY(ses.organ_id_,#{organId})
+			</if>
 			<if test="categoriesId != null">
 				AND FIND_IN_SET(ses.music_score_categories_id_,#{categoriesId})
 			</if>

+ 27 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysMusicScoreController.java

@@ -1,7 +1,11 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dao.SysMusicScoreCategoriesDao;
 import com.ym.mec.biz.dal.dto.MusicScoreDto;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreService;
@@ -9,10 +13,14 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
+import java.util.List;
+
 @RequestMapping("sysMusicScore")
 @Api(tags = "曲库")
 @RestController
@@ -22,6 +30,10 @@ public class SysMusicScoreController extends BaseController {
     private SysMusicScoreService sysMusicScoreService;
     @Autowired
     private SysMusicScoreCategoriesDao sysMusicScoreCategoriesDao;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "修改")
     @PostMapping("/update")
@@ -64,6 +76,21 @@ public class SysMusicScoreController extends BaseController {
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('sysMusicScore/queryPage')")
     public Object queryPage(SysExamSongQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+            return failed("用户所在分部异常");
+        }else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                return failed("非法请求");
+            }
+        }
         if(queryInfo.getCategoriesId() != null){
             String byCategoriesIds = sysMusicScoreCategoriesDao.findByCategoriesIds(queryInfo.getCategoriesId().toString());
             byCategoriesIds = sysMusicScoreCategoriesDao.findByCategoriesIds(byCategoriesIds);