TienChin-课程管理-删除课程

2023-10-12 14:55:58 浏览数 (2)

CourseController.java

代码语言:javascript复制
@PreAuthorize("hasPermission('tienchin:course:remove')")
@Log(title = "课程管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{courseIds}")
AjaxResult remove(@PathVariable Object[] courseIds) {
    return toAjax(iCourseService.deleteCourseByIds(courseIds));
}

ICourseService.java

代码语言:javascript复制
/**
 * 根据id删除课程
 *
 * @param courseIds 课程id
 * @return 影响行数
 */
int deleteCourseByIds(Object[] courseIds);

CourseServiceImpl.java

代码语言:javascript复制
@Override
public int deleteCourseByIds(Object[] courseIds) {
    UpdateWrapper<Course> uw = new UpdateWrapper<>();

    uw.lambda()
            .set(Course::getDelFlag, "2")
            .in(Course::getCourseId, courseIds);

    return update(uw) ? 1 : 0;
}

0 人点赞