package com.fjhx.victoriatourist.controller.blessing;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.blessing.dto.BlessingInfoDto;
import com.fjhx.victoriatourist.entity.blessing.dto.BlessingInfoSelectDto;
import com.fjhx.victoriatourist.entity.blessing.vo.BlessingInfoVo;
import com.fjhx.victoriatourist.service.blessing.BlessingInfoService;
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-10
 */
@RestController
@RequestMapping("/blessingInfo")
public class BlessingInfoController {

    @Autowired
    private BlessingInfoService blessingInfoService;

    /**
     * 祝福留言信息列表
     */
    @PostMapping("/list")
    public List<BlessingInfoVo> list(@RequestBody BlessingInfoSelectDto dto) {
        return blessingInfoService.getList(dto);
    }

    /**
     * 祝福留言信息分页
     */
    @PostMapping("/page")
    public Page<BlessingInfoVo> page(@RequestBody BlessingInfoSelectDto dto) {
        return blessingInfoService.getPage(dto);
    }

    /**
     * 祝福留言信息明细
     */
    @PostMapping("/detail")
    public BlessingInfoVo detail(@RequestBody BaseSelectDto dto) {
        return blessingInfoService.detail(dto.getId());
    }

    /**
     * 祝福留言信息新增
     */
    @PostMapping("/add")
    public void add(@RequestBody BlessingInfoDto blessingInfoDto) {
        blessingInfoService.add(blessingInfoDto);
    }

    /**
     * 祝福留言信息编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody BlessingInfoDto blessingInfoDto) {
        blessingInfoService.edit(blessingInfoDto);
    }

    /**
     * 祝福留言信息删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        blessingInfoService.delete(dto.getId());
    }

}
