bug
This commit is contained in:
@@ -257,8 +257,22 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindProductAndCourse(ShopProductCourseEntity shopProductCourseEntity) {
|
||||
public R bindProductAndCourse(ShopProductCourseEntity shopProductCourseEntity) {
|
||||
Integer integer = shopProductCourseDao.selectCount(new LambdaQueryWrapper<ShopProductCourseEntity>().eq(ShopProductCourseEntity::getProductId, shopProductCourseEntity.getProductId()).eq(ShopProductCourseEntity::getCourseId, shopProductCourseEntity.getCourseId()));
|
||||
if(integer>0){
|
||||
return R.error("不可重复绑定");
|
||||
}
|
||||
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectById(shopProductCourseEntity.getCatalogueId());
|
||||
shopProductCourseEntity.setCourseId(courseCatalogueEntity.getId());
|
||||
shopProductCourseDao.insert(shopProductCourseEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R unbindProductAndCourse(int productId, int catalogueId) {
|
||||
shopProductCourseDao.delete(new LambdaQueryWrapper<ShopProductCourseEntity>().eq(ShopProductCourseEntity::getProductId,productId).eq(ShopProductCourseEntity::getCatalogueId,catalogueId));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user