package com.fjhx.victoriatourist.controller.blessing;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.blessing.dto.BlessingCoverDto;
import com.fjhx.victoriatourist.entity.blessing.dto.BlessingCoverSelectDto;
import com.fjhx.victoriatourist.entity.blessing.vo.BlessingCoverVo;
import com.fjhx.victoriatourist.service.blessing.BlessingCoverService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 祝福封面 前端控制器
 * </p>
 *
 * @author lqh
 * @since 2023-12-09
 */
@RestController
@RequestMapping("/blessingCover")
public class BlessingCoverController {

    @Autowired
    private BlessingCoverService blessingCoverService;

    /**
     * 祝福封面列表
     */
    @PostMapping("/list")
    public List<BlessingCoverVo> list(@RequestBody BlessingCoverSelectDto dto) {
        return blessingCoverService.getList(dto);
    }

    /**
     * 祝福封面分页
     */
    @PostMapping("/page")
    public Page<BlessingCoverVo> page(@RequestBody BlessingCoverSelectDto dto) {
        return blessingCoverService.getPage(dto);
    }

    /**
     * 祝福封面明细
     */
    @PostMapping("/detail")
    public BlessingCoverVo detail(@RequestBody BaseSelectDto dto) {
        return blessingCoverService.detail(dto.getId());
    }

    /**
     * 祝福封面新增
     */
    @PostMapping("/add")
    public void add(@RequestBody BlessingCoverDto blessingCoverDto) {
        blessingCoverService.add(blessingCoverDto);
    }

    /**
     * 祝福封面编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody BlessingCoverDto blessingCoverDto) {
        blessingCoverService.edit(blessingCoverDto);
    }

    /**
     * 祝福封面删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        blessingCoverService.delete(dto.getId());
    }

}
