package com.fjhx.mail.controller.my;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mail.entity.my.dto.MyFolderMessageDto;
import com.fjhx.mail.entity.my.dto.MyFolderMessageSelectDto;
import com.fjhx.mail.entity.my.vo.MessageVo;
import com.fjhx.mail.service.my.MyFolderMessageService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;


/**
 * <p>
 * 我的文件夹关联邮件 前端控制器
 * </p>
 *
 * @author
 * @since 2023-05-29
 */
@RestController
@RequestMapping("/myFolderMessage")
public class MyFolderMessageController {

    @Autowired
    private MyFolderMessageService myFolderMessageService;

    /**
     * 我的文件夹关联邮件分页
     */
    @PostMapping("/page")
    public Page<MessageVo> page(@Validated @RequestBody MyFolderMessageSelectDto dto) {
        return myFolderMessageService.getPage(dto);
    }

    /**
     * 我的文件夹关联邮件添加
     */
    @PostMapping("/add")
    public void add(@Validated @RequestBody MyFolderMessageDto dto) {
        myFolderMessageService.add(dto);
    }

    /**
     * 我的文件夹关联邮件删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        myFolderMessageService.delete(dto.getId());
    }

}
