|  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.controller.BaseController; | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.QueryRequest; | 
|---|
|  |  |  | import cc.mrbird.febs.vip.entity.MallVipBenefits; | 
|---|
|  |  |  | import cc.mrbird.febs.vip.service.IMallVipBenefitsService; | 
|---|
|  |  |  | import lombok.RequiredArgsConstructor; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PathVariable; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public FebsResponse getById(@PathVariable("id") Long id) { | 
|---|
|  |  |  | return new FebsResponse().success().data(mallVipBenefitsService.findVipBenefitsById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/addOrEditBenefits") | 
|---|
|  |  |  | public FebsResponse addOrEditBenefits(@RequestBody MallVipBenefits mallVipBenefits) { | 
|---|
|  |  |  | if (mallVipBenefits.getId() == null) { | 
|---|
|  |  |  | this.mallVipBenefitsService.addVipBenefits(mallVipBenefits); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.mallVipBenefitsService.editVipBenefits(mallVipBenefits); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new FebsResponse().success(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("/delBenefits/{id}") | 
|---|
|  |  |  | public FebsResponse delBenefits(@PathVariable("id") Long id) { | 
|---|
|  |  |  | this.mallVipBenefitsService.delVipBenefits(id); | 
|---|
|  |  |  | return new FebsResponse().success(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("/findAllBenefits") | 
|---|
|  |  |  | public FebsResponse findAllBenefits() { | 
|---|
|  |  |  | return new FebsResponse().success().data(mallVipBenefitsService.list()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|