package com.fjhx.mail.controller.signature;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mail.entity.signature.vo.MailSignatureVo;
import com.fjhx.mail.entity.signature.dto.MailSignatureSelectDto;
import com.fjhx.mail.entity.signature.dto.MailMailSignatureDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.mail.service.signature.MailSignatureService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 签名 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-08-24
 */
@RestController
@RequestMapping("/mailSignature")
public class MailSignatureController {

    @Autowired
    private MailSignatureService mailSignatureService;

    /**
     * 签名分页
     */
    @PostMapping("/page")
    public Page<MailSignatureVo> page(@RequestBody MailSignatureSelectDto dto) {
        return mailSignatureService.getPage(dto);
    }

    /**
     * 签名明细
     */
    @PostMapping("/detail")
    public MailSignatureVo detail(@RequestBody BaseSelectDto dto) {
        return mailSignatureService.detail(dto.getId());
    }

    /**
     * 签名新增
     */
    @PostMapping("/add")
    public void add(@RequestBody MailMailSignatureDto mailSignatureDto) {
        mailSignatureService.add(mailSignatureDto);
    }

    /**
     * 签名编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody MailMailSignatureDto mailSignatureDto) {
        mailSignatureService.edit(mailSignatureDto);
    }

    /**
     * 签名删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        mailSignatureService.delete(dto.getId());
    }

    /**
     * 获取模板名称列表
     */
    @GetMapping("/getTemplateList")
    public List<String> getTemplateList(){
        return mailSignatureService.getTemplateList();
    }

}
