小bug 修复
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UserCourseBuyDao extends MPJBaseMapper<UserCourseBuyEntity> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("user_course_buy")
|
||||||
|
public class UserCourseBuyEntity {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
private Integer courseId;
|
||||||
|
|
||||||
|
private Integer catalogueId;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Integer days;
|
||||||
|
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,18 +18,10 @@ public class UserToCourseEntity {
|
|||||||
|
|
||||||
private Integer courseId;
|
private Integer courseId;
|
||||||
|
|
||||||
private Integer catalogueId;
|
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
private Integer days;
|
|
||||||
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
private Date startTime;
|
|
||||||
|
|
||||||
private Date endTime;
|
|
||||||
|
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CourseCatalogueChapterDao courseCatalogueChapterDao;
|
private CourseCatalogueChapterDao courseCatalogueChapterDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserToCourseDao userToCourseDao;
|
private UserCourseBuyDao userCourseBuyDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopProductCourseDao shopProductCourseDao;
|
private ShopProductCourseDao shopProductCourseDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -42,10 +42,10 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
|||||||
if(integer>0){
|
if(integer>0){
|
||||||
return R.error(502,"删除失败,请先清空章节");
|
return R.error(502,"删除失败,请先清空章节");
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<UserToCourseEntity> userToCourseEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserCourseBuyEntity> userCourseBuyEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
userToCourseEntityLambdaQueryWrapper.eq(UserToCourseEntity::getCatalogueId,id);
|
userCourseBuyEntityLambdaQueryWrapper.eq(UserCourseBuyEntity::getCatalogueId,id);
|
||||||
userToCourseEntityLambdaQueryWrapper.gt(UserToCourseEntity::getEndTime,new Date());
|
userCourseBuyEntityLambdaQueryWrapper.gt(UserCourseBuyEntity::getEndTime,new Date());
|
||||||
Integer integer1 = userToCourseDao.selectCount(userToCourseEntityLambdaQueryWrapper);
|
Integer integer1 = userCourseBuyDao.selectCount(userCourseBuyEntityLambdaQueryWrapper);
|
||||||
if(integer1>0){
|
if(integer1>0){
|
||||||
return R.error(502,"删除失败,有人已购买此课程");
|
return R.error(502,"删除失败,有人已购买此课程");
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
|||||||
@Override
|
@Override
|
||||||
public void addCourseCatalogue(CourseCatalogueEntity courseCatalogue) {
|
public void addCourseCatalogue(CourseCatalogueEntity courseCatalogue) {
|
||||||
this.save(courseCatalogue);
|
this.save(courseCatalogue);
|
||||||
if(courseCatalogue.getNeedCreate()==1){
|
if(courseCatalogue.getNeedCreate()!=null&&courseCatalogue.getNeedCreate()==1){
|
||||||
this.createProduct(courseCatalogue);
|
this.createProduct(courseCatalogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R delCourse(int id) {
|
public R delCourse(int id) {
|
||||||
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectOne(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, id));
|
Integer integer = courseCatalogueDao.selectCount(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, id));
|
||||||
if (courseCatalogueEntity!=null){
|
if (integer>0){
|
||||||
return R.error(501,"请先删除目录后再删除!");
|
return R.error(501,"请先删除目录后再删除!");
|
||||||
}
|
}
|
||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ public class CourseSociologyServiceImpl extends ServiceImpl<CourseSociologyDao,
|
|||||||
@Override
|
@Override
|
||||||
public R delCourseSociology(int id) {
|
public R delCourseSociology(int id) {
|
||||||
//查看下一级是否存在
|
//查看下一级是否存在
|
||||||
CourseSociologyEntity one = this.getOne(new LambdaQueryWrapper<CourseSociologyEntity>().eq(CourseSociologyEntity::getPid, id));
|
int count = this.count(new LambdaQueryWrapper<CourseSociologyEntity>().eq(CourseSociologyEntity::getPid, id));
|
||||||
if(one!=null){
|
if(count>0){
|
||||||
return R.error(501,"删除失败,请先删除子项目后再尝试");
|
return R.error(501,"删除失败,请先删除子项目后再尝试");
|
||||||
}
|
}
|
||||||
//查看绑定关系是否存在
|
//查看绑定关系是否存在
|
||||||
CourseToSociologyEntity courseToSociologyEntity = courseToSociologyDao.selectOne(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, id));
|
Integer integer = courseToSociologyDao.selectCount(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, id));
|
||||||
if(courseToSociologyEntity!=null){
|
if(integer>0){
|
||||||
return R.error(502,"删除失败,请先解绑课程与国学标签的绑定关系");
|
return R.error(502,"删除失败,请先解绑课程与国学标签的绑定关系");
|
||||||
}
|
}
|
||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user