zouxuan 4 years ago
parent
commit
2493a0293f

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ClassGroupQueryInfo.java

@@ -22,9 +22,20 @@ public class ClassGroupQueryInfo extends QueryInfo {
     
     @ApiModelProperty(value = "班级名称", required = false)
     private String name;
+
+    @ApiModelProperty(value = "分部", required = false)
+    private String organIdList;
     
     private Integer delFlag;
 
+	public String getOrganIdList() {
+		return organIdList;
+	}
+
+	public void setOrganIdList(String organIdList) {
+		this.organIdList = organIdList;
+	}
+
 	public Integer getId() {
 		return id;
 	}

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

@@ -1410,6 +1410,9 @@
             <if test="type != null">
                 AND type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
+            <if test="organIdList != null and organIdList != ''">
+                AND FIND_IN_SET(mg.organ_id_,#{organIdList})
+            </if>
             <if test="search != null and search != ''">
                 AND (mg.name_ LIKE CONCAT('%',#{search},'%') OR cg.music_group_id_ LIKE CONCAT('%',#{search},'%'))
             </if>

+ 22 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -1,6 +1,8 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -8,6 +10,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -50,6 +53,8 @@ public class ClassGroupController extends BaseController {
     private ClassGroupTeacherMapperService classGroupTeacherMapperService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "分页查询班级列表")
     @GetMapping("/queryPage")
@@ -284,6 +289,23 @@ public class ClassGroupController extends BaseController {
     @GetMapping("/queryClassGroupPage")
     @PreAuthorize("@pcs.hasPermissions('classGroup/queryClassGroupPage')")
     public HttpResponseResult queryClassGroupPage(ClassGroupQueryInfo queryInfo) throws Exception {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+                queryInfo.setOrganIdList(employee.getOrganIdList());
+            }else if(org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())){
+                return failed("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))){
+                    return failed("非法请求");
+                }
+            }
+        }
         return succeed(classGroupService.queryClassGroupPage(queryInfo));
     }