package com.fjhx.mail.controller.my;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mail.entity.my.dto.MyTagMessageAddBathDto;
import com.fjhx.mail.entity.my.dto.MyTagMessageDto;
import com.fjhx.mail.entity.my.dto.MyTagMessageSelectDto;
import com.fjhx.mail.entity.my.po.MyTagMessage;
import com.fjhx.mail.entity.my.vo.MessageVo;
import com.fjhx.mail.service.my.MyTagMessageService;
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("/myTagMessage")
public class MyTagMessageController {

    @Autowired
    private MyTagMessageService myTagMessageService;

    /**
     * 我的标签关联邮件分页
     */
    @PostMapping("/page")
    public Page<MessageVo> page(@Validated @RequestBody MyTagMessageSelectDto dto) {
        return myTagMessageService.getPage(dto);
    }

    /**
     * 我的标签关联邮件新增
     */
    @PostMapping("/add")
    public void add(@Validated @RequestBody MyTagMessageDto myTagMessageDto) {
        myTagMessageService.add(myTagMessageDto);
    }

    /**
     * 我的标签关联邮件批量新增
     */
    @PostMapping("/addBath")
    public void addBath(@Validated @RequestBody MyTagMessageAddBathDto dto) {
        myTagMessageService.addBath(dto);
    }

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

    /**
     * 我的标签关联邮件删除
     */
    @PostMapping("/deleteTag")
    public void deleteTag(@RequestBody MyTagMessage myTagMessage) {
        myTagMessageService.deleteTag(myTagMessage);
    }

}
