mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-07-23 17:49:34 +08:00
新增学习记录删除api
This commit is contained in:
parent
fdb4c9ad73
commit
488c7c5c02
@ -162,6 +162,15 @@ public class AdminPermissionCheck implements ApplicationRunner {
|
|||||||
setSlug(BPermissionConstant.USER_LEARN);
|
setSlug(BPermissionConstant.USER_LEARN);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
new AdminPermission() {
|
||||||
|
{
|
||||||
|
setSort(50);
|
||||||
|
setName("学习-删除");
|
||||||
|
setSlug(
|
||||||
|
BPermissionConstant
|
||||||
|
.USER_LEARN_DESTROY);
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
// 线上课
|
// 线上课
|
||||||
put(
|
put(
|
||||||
|
@ -42,6 +42,7 @@ public class BPermissionConstant {
|
|||||||
public static final String USER_UPDATE = "user-update";
|
public static final String USER_UPDATE = "user-update";
|
||||||
public static final String USER_DESTROY = "user-destroy";
|
public static final String USER_DESTROY = "user-destroy";
|
||||||
public static final String USER_LEARN = "user-learn";
|
public static final String USER_LEARN = "user-learn";
|
||||||
|
public static final String USER_LEARN_DESTROY = "user-learn-destroy";
|
||||||
|
|
||||||
public static final String COURSE = "course";
|
public static final String COURSE = "course";
|
||||||
public static final String COURSE_USER = "course-user";
|
public static final String COURSE_USER = "course-user";
|
||||||
|
@ -505,4 +505,25 @@ public class UserController {
|
|||||||
|
|
||||||
return JsonResponse.data(data);
|
return JsonResponse.data(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BackendPermissionMiddleware(slug = BPermissionConstant.USER_LEARN_DESTROY)
|
||||||
|
@DeleteMapping("/{id}/learn-course/{courseId}")
|
||||||
|
@SneakyThrows
|
||||||
|
public JsonResponse destroyUserCourse(
|
||||||
|
@PathVariable(name = "id") Integer id,
|
||||||
|
@PathVariable(name = "courseId") Integer courseId) {
|
||||||
|
userCourseRecordService.destroy(id, courseId);
|
||||||
|
return JsonResponse.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@BackendPermissionMiddleware(slug = BPermissionConstant.USER_LEARN_DESTROY)
|
||||||
|
@DeleteMapping("/{id}/learn-course/{courseId}/hour/{hourId}")
|
||||||
|
@SneakyThrows
|
||||||
|
public JsonResponse destroyUserHour(
|
||||||
|
@PathVariable(name = "id") Integer id,
|
||||||
|
@PathVariable(name = "courseId") Integer courseId,
|
||||||
|
@PathVariable(name = "hourId") Integer hourId) {
|
||||||
|
userCourseHourRecordService.remove(id, courseId, hourId);
|
||||||
|
return JsonResponse.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ public interface UserCourseHourRecordService extends IService<UserCourseHourReco
|
|||||||
|
|
||||||
void remove(Integer userId, Integer courseId);
|
void remove(Integer userId, Integer courseId);
|
||||||
|
|
||||||
|
void remove(Integer userId, Integer courseId, Integer hourId);
|
||||||
|
|
||||||
List<UserCourseHourRecordCountMapper> getUserCourseHourCount(
|
List<UserCourseHourRecordCountMapper> getUserCourseHourCount(
|
||||||
Integer userId, List<Integer> courseIds, Integer isFinished);
|
Integer userId, List<Integer> courseIds, Integer isFinished);
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ public interface UserCourseRecordService extends IService<UserCourseRecord> {
|
|||||||
|
|
||||||
void destroy(Integer courseId, List<Integer> ids);
|
void destroy(Integer courseId, List<Integer> ids);
|
||||||
|
|
||||||
|
void destroy(Integer userId, Integer courseId);
|
||||||
|
|
||||||
void removeByCourseId(Integer courseId);
|
void removeByCourseId(Integer courseId);
|
||||||
|
|
||||||
List<UserCourseRecord> chunks(List<Integer> ids, List<String> fields);
|
List<UserCourseRecord> chunks(List<Integer> ids, List<String> fields);
|
||||||
|
@ -153,4 +153,13 @@ public class UserCourseHourRecordServiceImpl
|
|||||||
|
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Integer userId, Integer courseId, Integer hourId) {
|
||||||
|
remove(
|
||||||
|
query().getWrapper()
|
||||||
|
.eq("user_id", userId)
|
||||||
|
.eq("course_id", courseId)
|
||||||
|
.eq("hour_id", hourId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,4 +132,9 @@ public class UserCourseRecordServiceImpl
|
|||||||
public List<UserCourseRecord> chunks(List<Integer> ids, List<String> fields) {
|
public List<UserCourseRecord> chunks(List<Integer> ids, List<String> fields) {
|
||||||
return list(query().getWrapper().in("id", ids).select(fields));
|
return list(query().getWrapper().in("id", ids).select(fields));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy(Integer userId, Integer courseId) {
|
||||||
|
remove(query().getWrapper().in("user_id", userId).eq("course_id", courseId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user