Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

Joburgess 5 лет назад
Родитель
Сommit
c99b7858b7

+ 1 - 4
mec-biz/src/main/resources/config/mybatis/SchoolMapper.xml

@@ -138,10 +138,7 @@
     <select id="findVipSchoolByUserId" resultMap="School">
         SELECT * FROM school WHERE del_flag_ != 1
         <if test="organId != null">
-        AND (FIND_IN_SET(organ_id_,#{organId}) and user_id_ is NULL  or user_id_ = #{userId})
-        </if>
-        <if test="organId == null">
-        	or user_id_ = #{userId}
+        AND ((FIND_IN_SET(organ_id_,#{organId}) and user_id_ is NULL) or user_id_ = #{userId})
         </if>
     </select>
 </mapper>

+ 31 - 23
mec-web/src/main/java/com/ym/mec/web/controller/SchoolController.java

@@ -1,27 +1,32 @@
 package com.ym.mec.web.controller;
 
-import com.timevale.tgtext.text.pdf.PdfStructTreeController.returnType;
-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.entity.Employee;
-import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.page.SchoolQueryInfo;
-import com.ym.mec.biz.service.SchoolService;
-import com.ym.mec.common.controller.BaseController;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
 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 org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+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.TeacherDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.page.SchoolQueryInfo;
+import com.ym.mec.biz.service.SchoolService;
+import com.ym.mec.common.controller.BaseController;
 
 @RequestMapping("school")
 @Api(tags = "学校(教学点)服务")
@@ -32,6 +37,10 @@ public class SchoolController extends BaseController {
     private SchoolService schoolService;
     @Autowired
     private EmployeeDao employeeDao;
+    
+    @Autowired
+    private TeacherDao teacherDao;
+    
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
@@ -118,18 +127,17 @@ public class SchoolController extends BaseController {
     @ApiOperation(value = "获取教师vip课教学点")
     @GetMapping("/findVipSchoolByTeacher")
     public Object findVipSchoolByTeacher(@ApiParam(value = "教师编号", required = true) Integer userId){
-    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+    	SysUser sysUser = sysUserFeignService.queryUserById(userId);
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        String organidList = null;
-        if(!sysUser.getIsSuperAdmin()){
-            Employee employee = employeeDao.get(sysUser.getId());
-            if(employee == null){
-            	return failed("非法请求");
-            }
-            organidList = employee.getOrganIdList();
+        StringBuffer sb = new StringBuffer();
+        sb.append(sysUser.getOrganId());
+        Teacher teacher = teacherDao.get(userId);
+        if(teacher == null){
+        	return failed("老师信息不存在");
         }
-        return succeed(schoolService.findVipSchoolByTeacher(userId,organidList,null));
+        sb.append(",").append(teacher.getFlowOrganRange());
+        return succeed(schoolService.findVipSchoolByTeacher(userId,sb.toString(),null));
     }
 }