From e93aad02d2dd2a6e624e81ea0adb3611a8fc43e5 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 26 十二月 2024 17:16:19 +0800 Subject: [PATCH] 合并代码 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 41 insertions(+), 5 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java index 7ee1c06..9a5e192 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java @@ -4,17 +4,16 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.RedPackegeSet; +import com.ruoyi.other.dto.RedPackegeSetDto; import com.ruoyi.other.service.RedPackegeSetService; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * <p> @@ -43,5 +42,42 @@ } } + + /** + * 获取红包配置 + */ + @ApiOperation(value = "获取红包配置", tags = {"管理后台-活动管理-签到红包"}) + @GetMapping("/getRedPackegeSet") + public R<RedPackegeSetDto> getRedPackegeSet(){ + List<RedPackegeSet> redPackegeSetList = redPackegeSetService.list(); + RedPackegeSetDto redPackegeSetDto = new RedPackegeSetDto(); + redPackegeSetDto.setRedPackegeSets(redPackegeSetList); + return R.ok(redPackegeSetDto); + } + + + /** + * 添加红包配置 + */ + @ApiOperation(value = "添加红包配置", tags = {"管理后台-活动管理-签到红包"}) + @PostMapping("/addRedPackegeSet") + @Transactional(rollbackFor = Exception.class) + public R<Void> addRedPackegeSet(@RequestBody RedPackegeSetDto redPackegeSets){ + redPackegeSetService.remove(null); + List<RedPackegeSet> redPackegeSetList = redPackegeSets.getRedPackegeSets(); + redPackegeSetService.saveBatch(redPackegeSetList); + return R.ok(); + } + + /** + * 删除红包配置 + */ + @ApiOperation(value = "删除红包配置", tags = {"管理后台-活动管理-签到红包"}) + @GetMapping("/delRedPackegeSet") + public R<Void> delRedPackegeSet(){ + redPackegeSetService.removeById(1); + return R.ok(); + } + } -- Gitblit v1.7.1