bug
This commit is contained in:
@@ -185,10 +185,12 @@ public class ShopProductController {
|
||||
|
||||
@RequestMapping("/bindProductAndCourse")
|
||||
public R bindProductAndCourse(@RequestBody ShopProductCourseEntity shopProductCourseEntity){
|
||||
shopProductService.bindProductAndCourse(shopProductCourseEntity);
|
||||
return null;
|
||||
return shopProductService.bindProductAndCourse(shopProductCourseEntity);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/unbindProductAndCourse")
|
||||
public R unbindProductAndCourse(@RequestBody Map<String,Integer> map){
|
||||
return shopProductService.unbindProductAndCourse(map.get("productId"),map.get("catalogueId"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,5 +53,7 @@ public interface ShopProductService extends IService<ShopProduct> {
|
||||
|
||||
Map<String, Object> getCanBindProductAndCourse(ParamTo param);
|
||||
|
||||
void bindProductAndCourse(ShopProductCourseEntity shopProductCourseEntity);
|
||||
R bindProductAndCourse(ShopProductCourseEntity shopProductCourseEntity);
|
||||
|
||||
R unbindProductAndCourse(int productId,int catalogueId);
|
||||
}
|
||||
|
||||
@@ -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