feat:十二分制-奖惩规则
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.common.InsertGroup;
|
||||
import com.cool.store.common.UpdateGroup;
|
||||
import com.cool.store.request.tp.TpPenaltyRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRewardRuleUpdateRequest;
|
||||
import com.cool.store.request.tp.TpRuleQueryRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.tp.TpRuleService;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleDetailVO;
|
||||
import com.cool.store.vo.tp.TpPenaltyRuleListVO;
|
||||
import com.cool.store.vo.tp.TpRewardRuleDetailVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 十二分制-奖惩规则 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/11/4
|
||||
*/
|
||||
@Api(tags = "十二分制-奖惩规则")
|
||||
@RestController
|
||||
@RequestMapping("/pc/tp/rule")
|
||||
@RequiredArgsConstructor
|
||||
public class TpRuleController {
|
||||
private final TpRuleService tpRuleService;
|
||||
|
||||
@ApiOperation("新增惩处规则")
|
||||
@PostMapping("/insertPenalty")
|
||||
public ResponseResult<Boolean> insertPenaltyRule(@RequestBody @Validated(InsertGroup.class) TpPenaltyRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.insertPenaltyRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("修改惩处规则")
|
||||
@PostMapping("/updatePenalty")
|
||||
public ResponseResult<Boolean> updatePenaltyRule(@RequestBody @Validated(UpdateGroup.class) TpPenaltyRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.updatePenaltyRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("惩处规则详情")
|
||||
@GetMapping("/penaltyDetail")
|
||||
@ApiImplicitParam(name = "ruleId", value = "规则id", required = true, dataType = "Long", paramType = "query")
|
||||
public ResponseResult<TpPenaltyRuleDetailVO> penaltyRuleDetail(@NotNull(message = "规则id不能为空") Long ruleId) {
|
||||
return ResponseResult.success(tpRuleService.penaltyRuleDetail(ruleId));
|
||||
}
|
||||
|
||||
@ApiOperation("惩处规则分页查询")
|
||||
@GetMapping("/penaltyPage")
|
||||
public ResponseResult<PageInfo<TpPenaltyRuleListVO>> penaltyRulePage(TpRuleQueryRequest request) {
|
||||
return ResponseResult.success(tpRuleService.penaltyRulePage(request));
|
||||
}
|
||||
|
||||
@ApiOperation("新增加分规则")
|
||||
@PostMapping("/insertReward")
|
||||
public ResponseResult<Boolean> insertRewardRule(@RequestBody @Validated(InsertGroup.class) TpRewardRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.insertRewardRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("修改加分规则")
|
||||
@PostMapping("/updateReward")
|
||||
public ResponseResult<Boolean> updateRewardRule(@RequestBody @Validated(UpdateGroup.class) TpRewardRuleUpdateRequest request) {
|
||||
return ResponseResult.success(tpRuleService.updateRewardRule(request));
|
||||
}
|
||||
|
||||
@ApiOperation("加分规则详情")
|
||||
@GetMapping("/rewardDetail")
|
||||
@ApiImplicitParam(name = "ruleId", value = "规则id", required = true, dataType = "Long", paramType = "query")
|
||||
public ResponseResult<TpRewardRuleDetailVO> rewardRuleDetail(@NotNull(message = "规则id不能为空") Long ruleId) {
|
||||
return ResponseResult.success(tpRuleService.rewardRuleDetail(ruleId));
|
||||
}
|
||||
|
||||
@ApiOperation("加分规则分页查询")
|
||||
@GetMapping("/rewardPage")
|
||||
public ResponseResult<PageInfo<TpRewardRuleDetailVO>> rewardRulePage(TpRuleQueryRequest request) {
|
||||
return ResponseResult.success(tpRuleService.rewardRulePage(request));
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除规则")
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Boolean> deleteRuleByIds(@RequestBody List<Long> ruleIds) {
|
||||
return ResponseResult.success(tpRuleService.deleteRuleByIds(ruleIds));
|
||||
}
|
||||
|
||||
@ApiOperation("启用规则")
|
||||
@PostMapping("/enable")
|
||||
public ResponseResult<Boolean> enableRuleByIds(@RequestBody List<Long> ruleIds) {
|
||||
return ResponseResult.success(tpRuleService.enableRuleByIds(ruleIds, 1));
|
||||
}
|
||||
|
||||
@ApiOperation("禁用规则")
|
||||
@PostMapping("/disable")
|
||||
public ResponseResult<Boolean> disableRuleByIds(@RequestBody List<Long> ruleIds) {
|
||||
return ResponseResult.success(tpRuleService.enableRuleByIds(ruleIds, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user