added: 学员,我的课程

This commit is contained in:
none 2023-03-20 12:01:55 +08:00
parent dfce2fc477
commit f57e27783b
22 changed files with 108 additions and 62 deletions

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class PlayEduBContext {
public class PlayEduBCtx {
private static final java.lang.ThreadLocal<LinkedHashMap<String, Object>> THREAD_LOCAL = new java.lang.ThreadLocal<>();
@ -15,7 +15,7 @@ public class PlayEduBContext {
public final static String KEY_ADMIN_PER = "admin_per";
public final static String KEY_CONFIG = "config";
public PlayEduBContext() {
public PlayEduBCtx() {
}
private static void put(String key, Object val) {

View File

@ -8,13 +8,13 @@ import java.util.LinkedHashMap;
* @Author 杭州白书科技有限公司
* @create 2023/3/13 09:24
*/
public class PlayEduFContext {
public class PlayEduFCtx {
private static final java.lang.ThreadLocal<LinkedHashMap<String, Object>> THREAD_LOCAL = new java.lang.ThreadLocal<>();
private static final String KEY_USER_ID = "user_id";
private static final String KEY_USER = "user";
public PlayEduFContext() {
public PlayEduFCtx() {
}
private static void put(String key, Object val) {

View File

@ -2,7 +2,7 @@ package xyz.playedu.api.bus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BackendConstant;
import xyz.playedu.api.domain.AdminRole;
import xyz.playedu.api.service.AdminPermissionService;
@ -10,7 +10,6 @@ import xyz.playedu.api.service.AdminRoleService;
import xyz.playedu.api.service.AdminUserService;
import xyz.playedu.api.util.PrivacyUtil;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -55,7 +54,7 @@ public class BackendBus {
}
public static String valueHidden(String permissionSlug, String type, String value) {
HashMap<String, Boolean> permissions = PlayEduBContext.getAdminPer();
HashMap<String, Boolean> permissions = PlayEduBCtx.getAdminPer();
if (permissions.get(permissionSlug) != null) {
return value;
}
@ -76,7 +75,7 @@ public class BackendBus {
if (superRole == null) {
return false;
}
List<Integer> roleIds = adminUserService.getRoleIdsByUserId(PlayEduBContext.getAdminUserID());
List<Integer> roleIds = adminUserService.getRoleIdsByUserId(PlayEduBCtx.getAdminUserID());
if (roleIds.size() == 0) {
return false;
}

View File

@ -12,6 +12,7 @@ public class FrontendConstant {
public final static List<String> UN_AUTH_URI_WHITELIST = new ArrayList<>() {{
add("/api/v1/system/config");
add("/api/v1/system/image-captcha");
add("/api/v1/auth/login/password");
}};
}

View File

@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.domain.CourseChapter;
import xyz.playedu.api.event.CourseChapterDestroyEvent;
@ -16,8 +16,6 @@ import xyz.playedu.api.service.CourseChapterService;
import xyz.playedu.api.service.CourseHourService;
import xyz.playedu.api.types.JsonResponse;
import java.util.Date;
/**
* @Author 杭州白书科技有限公司
* @create 2023/2/26 17:28
@ -65,7 +63,7 @@ public class CourseChapterController {
return JsonResponse.error("当前章节下面存在课时无法删除");
}
chapterService.removeById(chapter.getId());
ctx.publishEvent(new CourseChapterDestroyEvent(this, PlayEduBContext.getAdminUserID(), chapter.getCourseId(), chapter.getId()));
ctx.publishEvent(new CourseChapterDestroyEvent(this, PlayEduBCtx.getAdminUserID(), chapter.getCourseId(), chapter.getId()));
return JsonResponse.success();
}

View File

@ -7,7 +7,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.domain.*;
import xyz.playedu.api.event.CourseDestroyEvent;
@ -185,7 +185,7 @@ public class CourseController {
@DeleteMapping("/{id}")
public JsonResponse destroy(@PathVariable(name = "id") Integer id) {
courseService.removeById(id);
ctx.publishEvent(new CourseDestroyEvent(this, PlayEduBContext.getAdminUserID(), id));
ctx.publishEvent(new CourseDestroyEvent(this, PlayEduBCtx.getAdminUserID(), id));
return JsonResponse.success();
}

View File

@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.constant.BackendConstant;
import xyz.playedu.api.domain.CourseChapter;
@ -75,7 +75,7 @@ public class CourseHourController {
chapterService.findOrFail(chapterId, courseId);
CourseHour courseHour = hourService.create(courseId, chapterId, req.getSort(), req.getTitle(), type, req.getRid(), req.getDuration());
ctx.publishEvent(new CourseHourCreatedEvent(this, PlayEduBContext.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
ctx.publishEvent(new CourseHourCreatedEvent(this, PlayEduBCtx.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
return JsonResponse.success();
}
@ -103,7 +103,7 @@ public class CourseHourController {
public JsonResponse destroy(@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "id") Integer id) throws NotFoundException {
CourseHour courseHour = hourService.findOrFail(id, courseId);
hourService.removeById(courseHour.getId());
ctx.publishEvent(new CourseHourDestroyEvent(this, PlayEduBContext.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
ctx.publishEvent(new CourseHourDestroyEvent(this, PlayEduBCtx.getAdminUserID(), courseHour.getCourseId(), courseHour.getChapterId(), courseHour.getId()));
return JsonResponse.success();
}

View File

@ -5,10 +5,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.domain.Department;
import xyz.playedu.api.domain.User;
import xyz.playedu.api.event.DepartmentDestroyEvent;
import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.middleware.BackendPermissionMiddleware;
@ -19,7 +18,6 @@ import xyz.playedu.api.service.UserService;
import xyz.playedu.api.types.JsonResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author 杭州白书科技有限公司
@ -119,7 +117,7 @@ public class DepartmentController {
public JsonResponse destroy(@PathVariable Integer id) throws NotFoundException {
Department department = departmentService.findOrFail(id);
departmentService.deleteById(department.getId());
ctx.publishEvent(new DepartmentDestroyEvent(this, PlayEduBContext.getAdminUserID(), department.getId()));
ctx.publishEvent(new DepartmentDestroyEvent(this, PlayEduBCtx.getAdminUserID(), department.getId()));
return JsonResponse.success();
}

View File

@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.bus.BackendBus;
import xyz.playedu.api.constant.SystemConstant;
import xyz.playedu.api.domain.AdminUser;
@ -21,7 +21,6 @@ import xyz.playedu.api.util.HelperUtil;
import xyz.playedu.api.util.IpUtil;
import xyz.playedu.api.util.RequestUtil;
import java.util.Date;
import java.util.HashMap;
@RestController
@ -75,7 +74,7 @@ public class LoginController {
@GetMapping("/detail")
public JsonResponse detail() {
AdminUser user = PlayEduBContext.getAdminUser();
AdminUser user = PlayEduBCtx.getAdminUser();
HashMap<String, Boolean> permissions = backendBus.adminUserPermissions(user.getId());
HashMap<String, Object> data = new HashMap<>();
@ -87,7 +86,7 @@ public class LoginController {
@PutMapping("/password")
public JsonResponse changePassword(@RequestBody @Validated PasswordChangeRequest req) {
AdminUser user = PlayEduBContext.getAdminUser();
AdminUser user = PlayEduBCtx.getAdminUser();
String password = HelperUtil.MD5(req.getOldPassword() + user.getSalt());
if (!password.equals(user.getPassword())) {
return JsonResponse.error("原密码不正确");

View File

@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.constant.BackendConstant;
import xyz.playedu.api.domain.Resource;
@ -124,7 +124,7 @@ public class ResourceCategoryController {
public JsonResponse destroy(@PathVariable Integer id) throws NotFoundException {
ResourceCategory category = categoryService.findOrFail(id);
categoryService.deleteById(category.getId());
ctx.publishEvent(new ResourceCategoryDestroyEvent(this, PlayEduBContext.getAdminUserID(), category.getId()));
ctx.publishEvent(new ResourceCategoryDestroyEvent(this, PlayEduBCtx.getAdminUserID(), category.getId()));
return JsonResponse.success();
}

View File

@ -4,7 +4,7 @@ import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.bus.BackendBus;
import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.constant.BackendConstant;
@ -70,7 +70,7 @@ public class ResourceController {
filter.setName(name);
if (!backendBus.isSuperAdmin()) {// 非超管只能读取它自己上传的资源
filter.setAdminId(PlayEduBContext.getAdminUserID());
filter.setAdminId(PlayEduBCtx.getAdminUserID());
}
PaginationResult<Resource> result = resourceService.paginate(page, size, filter);

View File

@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.service.ImageCaptchaService;
import xyz.playedu.api.types.ImageCaptchaResult;
import xyz.playedu.api.types.JsonResponse;
@ -33,7 +33,7 @@ public class SystemController {
@GetMapping("/config")
public JsonResponse config() {
Map<String, String> data = PlayEduBContext.getConfig();
Map<String, String> data = PlayEduBCtx.getConfig();
return JsonResponse.data(data);
}

View File

@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.constant.BackendConstant;
import xyz.playedu.api.domain.Resource;
import xyz.playedu.api.exception.ServiceException;
@ -40,7 +40,7 @@ public class UploadController {
@PostMapping("/minio")
public JsonResponse uploadMinio(@RequestParam HashMap<String, Object> params, MultipartFile file) throws ServiceException {
String categoryIds = MapUtils.getString(params, "category_ids");
Resource res = uploadService.storeMinio(PlayEduBContext.getAdminUserID(), file, categoryIds);
Resource res = uploadService.storeMinio(PlayEduBCtx.getAdminUserID(), file, categoryIds);
return JsonResponse.data(res);
}
@ -92,7 +92,7 @@ public class UploadController {
// 视频素材保存
Resource videoResource = resourceService.create(
PlayEduBContext.getAdminUserID(),
PlayEduBCtx.getAdminUserID(),
req.getCategoryIds(),
type,
req.getOriginalFilename(),
@ -104,7 +104,7 @@ public class UploadController {
url
);
// 视频封面素材保存
Resource posterResource = uploadService.storeBase64Image(PlayEduBContext.getAdminUserID(), req.getPoster(), null);
Resource posterResource = uploadService.storeBase64Image(PlayEduBCtx.getAdminUserID(), req.getPoster(), null);
// 视频的封面素材改为[隐藏 && 属于视频的子素材]
resourceService.changeParentId(posterResource.getId(), videoResource.getId());
// 视频信息

View File

@ -21,7 +21,6 @@ import xyz.playedu.api.util.HelperUtil;
import xyz.playedu.api.util.IpUtil;
import xyz.playedu.api.util.RequestUtil;
import java.util.Date;
import java.util.HashMap;
/**
@ -53,10 +52,13 @@ public class LoginController {
User user = userService.find(email);
if (user == null) {
return JsonResponse.error("邮箱未注册");
return JsonResponse.error("邮箱或密码错误");
}
if (!HelperUtil.MD5(req.getPassword() + user.getSalt()).equals(user.getPassword())) {
return JsonResponse.error("密码错误");
return JsonResponse.error("邮箱或密码错误");
}
if (user.getIsLock() == 1) {
return JsonResponse.error("当前学员已锁定无法登录");
}
JwtToken token = jwtService.generate(user.getId(), RequestUtil.url(), SystemConstant.JWT_PRV_USER);

View File

@ -3,15 +3,18 @@ package xyz.playedu.api.controller.frontend;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.PlayEduFContext;
import xyz.playedu.api.PlayEduFCtx;
import xyz.playedu.api.domain.Course;
import xyz.playedu.api.domain.Department;
import xyz.playedu.api.domain.User;
import xyz.playedu.api.exception.ServiceException;
import xyz.playedu.api.request.frontend.ChangePasswordRequest;
import xyz.playedu.api.service.CourseService;
import xyz.playedu.api.service.DepartmentService;
import xyz.playedu.api.service.UserService;
import xyz.playedu.api.types.JsonResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -29,9 +32,12 @@ public class UserController {
@Autowired
private DepartmentService departmentService;
@Autowired
private CourseService courseService;
@GetMapping("/detail")
public JsonResponse detail() {
User user = PlayEduFContext.getUser();
User user = PlayEduFCtx.getUser();
List<Department> departments = departmentService.listByIds(userService.getDepIdsByUserId(user.getId()));
HashMap<String, Object> data = new HashMap<>();
@ -43,9 +49,28 @@ public class UserController {
@PutMapping("/password")
public JsonResponse changePassword(@RequestBody @Validated ChangePasswordRequest req) throws ServiceException {
userService.passwordChange(PlayEduFContext.getUser(), req.getOldPassword(), req.getNewPassword());
userService.passwordChange(PlayEduFCtx.getUser(), req.getOldPassword(), req.getNewPassword());
return JsonResponse.success();
}
@GetMapping("/courses")
public JsonResponse courses() {
// 公开课
List<Course> openCourses = courseService.openCoursesAndShow(200);
// 部门课
List<Course> depCourses = new ArrayList<>();
List<Integer> userJoinDepIds = userService.getDepIdsByUserId(PlayEduFCtx.getUserId());
if (userJoinDepIds != null && userJoinDepIds.size() > 0) {
depCourses = courseService.depCoursesAndShow(userJoinDepIds);
}
HashMap<String, Object> data = new HashMap<>();
data.put("open", openCourses);
data.put("department", depCourses);
return JsonResponse.data(data);
}
}

View File

@ -9,11 +9,11 @@ import xyz.playedu.api.types.paginate.CoursePaginateFiler;
import java.util.List;
/**
* @author tengteng
* @description 针对表courses的数据库操作Mapper
* @createDate 2023-02-24 14:48:38
* @Entity xyz.playedu.api.domain.Course
*/
* @author tengteng
* @description 针对表courses的数据库操作Mapper
* @createDate 2023-02-24 14:48:38
* @Entity xyz.playedu.api.domain.Course
*/
@Mapper
public interface CourseMapper extends BaseMapper<Course> {
@ -23,6 +23,8 @@ public interface CourseMapper extends BaseMapper<Course> {
Long paginateCount(CoursePaginateFiler filer);
List<Course> openCoursesAndShow(Integer limit);
}

View File

@ -6,7 +6,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.bus.AppBus;
import xyz.playedu.api.bus.BackendBus;
import xyz.playedu.api.constant.SystemConstant;
@ -49,7 +49,7 @@ public class AdminMiddleware implements HandlerInterceptor {
// 读取全局配置
Map<String, String> systemConfig = configService.keyValues();
PlayEduBContext.setConfig(systemConfig);
PlayEduBCtx.setConfig(systemConfig);
if (BackendBus.inUnAuthWhitelist(request.getRequestURI())) {
return HandlerInterceptor.super.preHandle(request, response, handler);
@ -71,9 +71,9 @@ public class AdminMiddleware implements HandlerInterceptor {
return responseTransform(response, 403, "当前管理员禁止登录");
}
PlayEduBContext.setAdminUserId(payload.getSub());
PlayEduBContext.setAdminUser(adminUser);
PlayEduBContext.setAdminPer(backendBus.adminUserPermissions(adminUser.getId()));
PlayEduBCtx.setAdminUserId(payload.getSub());
PlayEduBCtx.setAdminUser(adminUser);
PlayEduBCtx.setAdminPer(backendBus.adminUserPermissions(adminUser.getId()));
return HandlerInterceptor.super.preHandle(request, response, handler);
} catch (Exception e) {
@ -93,7 +93,7 @@ public class AdminMiddleware implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
PlayEduBContext.remove();
PlayEduBCtx.remove();
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

View File

@ -6,7 +6,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import xyz.playedu.api.PlayEduFContext;
import xyz.playedu.api.PlayEduFCtx;
import xyz.playedu.api.constant.FrontendConstant;
import xyz.playedu.api.constant.SystemConstant;
import xyz.playedu.api.domain.User;
@ -18,7 +18,6 @@ import xyz.playedu.api.util.HelperUtil;
import xyz.playedu.api.util.RequestUtil;
import java.io.IOException;
import java.util.Arrays;
/**
* @Author 杭州白书科技有限公司
@ -50,21 +49,22 @@ public class FrontMiddleware implements HandlerInterceptor {
}
try {
JWTPayload payload = jwtService.parse(token, SystemConstant.JWT_PRV_ADMIN_USER);
JWTPayload payload = jwtService.parse(token, SystemConstant.JWT_PRV_USER);
User user = userService.find(payload.getSub());
if (user == null) {
return responseTransform(response, 404, "管理员不存在");
return responseTransform(response, 404, "请重新登录");
}
if (user.getIsLock() == 1) {
return responseTransform(response, 403, "当前学员已锁定");
return responseTransform(response, 403, "当前学员已锁定无法登录");
}
PlayEduFContext.setUserId(user.getId());
PlayEduFContext.setUser(user);
PlayEduFCtx.setUserId(user.getId());
PlayEduFCtx.setUser(user);
return HandlerInterceptor.super.preHandle(request, response, handler);
} catch (Exception e) {
log.error(e.getMessage());
return responseTransform(response, 401, "请重新登录");
}
}
@ -78,7 +78,7 @@ public class FrontMiddleware implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
PlayEduFContext.remove();
PlayEduFCtx.remove();
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

View File

@ -8,7 +8,7 @@ import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.playedu.api.PlayEduBContext;
import xyz.playedu.api.PlayEduBCtx;
import xyz.playedu.api.bus.BackendBus;
import xyz.playedu.api.middleware.BackendPermissionMiddleware;
import xyz.playedu.api.types.JsonResponse;
@ -35,7 +35,7 @@ public class BackendPermissionMiddlewareImpl {
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
BackendPermissionMiddleware middleware = signature.getMethod().getAnnotation(BackendPermissionMiddleware.class);
Integer adminUserId = PlayEduBContext.getAdminUserID();
Integer adminUserId = PlayEduBCtx.getAdminUserID();
HashMap<String, Boolean> permissions = backendBus.adminUserPermissions(adminUserId);
if (permissions.get(middleware.slug()) == null) {
return JsonResponse.error("权限不足", 403);

View File

@ -47,4 +47,8 @@ public interface CourseService extends IService<Course> {
Map<Integer, Integer> getCategoryCount();
Integer total();
List<Course> openCoursesAndShow(Integer limit);
List<Course> depCoursesAndShow(List<Integer> depIds);
}

View File

@ -174,6 +174,16 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
public Integer total() {
return Math.toIntExact(count());
}
@Override
public List<Course> openCoursesAndShow(Integer limit) {
return getBaseMapper().openCoursesAndShow(limit);
}
@Override
public List<Course> depCoursesAndShow(List<Integer> depIds) {
return list(query().getWrapper().in("id", courseDepartmentService.getCourseIdsByDepIds(depIds)).eq("is_show", 1));
}
}

View File

@ -166,4 +166,12 @@
</if>
</where>
</select>
<select id="openCoursesAndShow" resultType="xyz.playedu.api.domain.Course">
SELECT `courses`.*
FROM `courses`
LEFT JOIN `course_department` ON `course_department`.`course_id` = `courses`.`id`
WHERE `course_department`.`course_id` IS NULL
AND `courses`.`is_show` = 1
LIMIT #{limit}
</select>
</mapper>