cup il y a 3 ans
Parent
commit
588480a1b9

+ 6 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/CouponPkgMgrController.java

@@ -110,4 +110,10 @@ public class CouponPkgMgrController extends BaseApiController {
         return AjaxResult.error("操作失败");
     }
 
+    @PostMapping("/delete/{id}")
+    @ApiOperation("删除券包")
+    public AjaxResult delete(@PathVariable("id") Long id) {
+        couponPkgService.delete(id);
+        return AjaxResult.success();
+    }
 }

+ 8 - 0
mp-service/src/main/java/com/qs/mp/admin/service/ICouponPkgService.java

@@ -38,4 +38,12 @@ public interface ICouponPkgService extends IService<CouponPkg> {
      * @return
      */
     CouponPkgVO detail(Long id);
+
+    /**
+     * 删除券包
+     *
+     * @param id
+     * @return
+     */
+    boolean delete(Long id);
 }

+ 13 - 0
mp-service/src/main/java/com/qs/mp/admin/service/impl/CouponPkgServiceImpl.java

@@ -38,6 +38,19 @@ public class CouponPkgServiceImpl extends ServiceImpl<CouponPkgMapper, CouponPkg
     @Autowired
     private ICouponPkgItemService couponPkgItemService;
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delete(Long id) {
+
+        // 删除券包明细
+        couponPkgItemService.remove(new LambdaQueryWrapper<CouponPkgItem>().eq(CouponPkgItem::getCouponPkgId, id));
+
+        // 删除券包
+        this.removeById(id);
+
+        return true;
+    }
+
     @Override
     public CouponPkgVO detail(Long id) {
         CouponPkgVO couponPkgVO = new CouponPkgVO();