|
@@ -140,8 +140,8 @@ public class CourseController extends ControllerSupport {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "查询课程")
|
|
@ApiOperation(value = "查询课程")
|
|
- @GetMapping("queryByNameLike")
|
|
|
|
- public List<CourseEntity> queryByNameLike(@RequestParam(required = false) String name,
|
|
|
|
|
|
+ @GetMapping("query")
|
|
|
|
+ public List<CourseEntity> query(@RequestParam(required = false) String name,
|
|
@RequestParam(required = false) String code,
|
|
@RequestParam(required = false) String code,
|
|
@RequestParam(required = false) String level,
|
|
@RequestParam(required = false) String level,
|
|
@RequestParam(required = false) Boolean enable,
|
|
@RequestParam(required = false) Boolean enable,
|
|
@@ -150,7 +150,7 @@ public class CourseController extends ControllerSupport {
|
|
User accessUser = getAccessUser();
|
|
User accessUser = getAccessUser();
|
|
Long rootOrgId = accessUser.getRootOrgId();
|
|
Long rootOrgId = accessUser.getRootOrgId();
|
|
// 过载保护
|
|
// 过载保护
|
|
- int total = courseRepo.countByRootOrgIdAndNameLike(rootOrgId, name);
|
|
|
|
|
|
+ int total = courseRepo.countByRootOrgIdAndNameLike(rootOrgId, toSqlSearchPattern(name));
|
|
if (total > 1000) {
|
|
if (total > 1000) {
|
|
List<CourseEntity> list = Lists.newArrayList();
|
|
List<CourseEntity> list = Lists.newArrayList();
|
|
return list;
|
|
return list;
|
|
@@ -179,7 +179,7 @@ public class CourseController extends ControllerSupport {
|
|
.subquery(CourseSpeciatlyRelationEntity.class);
|
|
.subquery(CourseSpeciatlyRelationEntity.class);
|
|
Root<CourseSpeciatlyRelationEntity> subRoot = subquery
|
|
Root<CourseSpeciatlyRelationEntity> subRoot = subquery
|
|
.from(CourseSpeciatlyRelationEntity.class);
|
|
.from(CourseSpeciatlyRelationEntity.class);
|
|
- subquery.select(subRoot);
|
|
|
|
|
|
+ subquery.select(subRoot.get("courseId"));
|
|
Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
|
|
Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
|
|
Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
|
|
Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
|
|
subquery.where(cb.and(p1, p2));
|
|
subquery.where(cb.and(p1, p2));
|