package com.vote.system.controller;

import com.vctgo.common.core.web.domain.AjaxResult;
import com.vote.system.domain.VoteEventNewsCarousels;
import com.vote.system.service.VoteEventNewsCarouselsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @CreateTime: 2024/8/28 上午10:46
 * @Description:
 * @Email: f2965573933@163.com
 * @Author: FanJiaBao
 */
@RestController
@RequestMapping("/carousels")
public class VoteEventNewsCarouselsController {

    @Autowired
    private VoteEventNewsCarouselsService voteEventNewsCarouselsService;


    @GetMapping("/chartList")
    public AjaxResult chartList(VoteEventNewsCarousels voteEventNewsCarousels) {
        return AjaxResult.success(voteEventNewsCarouselsService.chartList(voteEventNewsCarousels));
    }

    @PostMapping("/save")
    public AjaxResult save(@RequestBody VoteEventNewsCarousels voteEventNewsCarousels) {
        return AjaxResult.success(voteEventNewsCarouselsService.saveCarousels(voteEventNewsCarousels));
    }

    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody VoteEventNewsCarousels voteEventNewsCarousels) {
        return AjaxResult.success(voteEventNewsCarouselsService.updateById(voteEventNewsCarousels));
    }

    @DeleteMapping("/{id}")
    public AjaxResult deleteById(@PathVariable("id") Long id) {
        return AjaxResult.success(voteEventNewsCarouselsService.removeById(id));
    }


}
