Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

YuanPan 8 vuotta sitten
vanhempi
commit
650bded9c6

+ 9 - 0
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/CourseApi.java

@@ -155,4 +155,13 @@ public class CourseApi {
         courseService.enableCourse(courseIds,false);
         return new ResponseEntity(HttpStatus.OK);
     }
+
+    @ApiOperation(value="启用课程",notes="启用")
+    @PutMapping("/enable/{ids}")
+    public ResponseEntity enableCourse(@PathVariable String ids){
+        List<Long> courseIds = Stream.of(ids.split(",")).map(s->Long.parseLong(s.trim()))
+                .collect(Collectors.toList());
+        courseService.enableCourse(courseIds,true);
+        return new ResponseEntity(HttpStatus.OK);
+    }
 }

+ 3 - 1
core-api/src/main/java/cn/com/qmth/examcloud/service/core/service/UserService.java

@@ -308,7 +308,9 @@ public class UserService {
 		User old = userRepo.findByRootOrgIdAndLoginName(rootOrgId,loginName);
 		if(old!=null){
 			throw new RuntimeException("用户名已存在");
-		}
+		}else if("admin".equalsIgnoreCase(loginName)){
+		    throw new RuntimeException("不能创建admin用户");
+        }
 	}
 
 	public User update(Long id, User user) {