package com.fjhx.mail.controller.enterprise;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.common.constant.SourceConstant;
import com.fjhx.mail.entity.enterprise.dto.EnterpriseDomainDto;
import com.fjhx.mail.entity.enterprise.dto.EnterpriseDomainSelectDto;
import com.fjhx.mail.entity.enterprise.vo.EnterpriseDomainVo;
import com.fjhx.mail.service.enterprise.EnterpriseDomainService;
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-04-06
 */
//@DS(SourceConstant.MAIL)
@RestController
@RequestMapping("/enterpriseDomain")
public class EnterpriseDomainController {

    @Autowired
    private EnterpriseDomainService enterpriseDomainService;

    /**
     * 企业邮箱域名分页
     */
    @PostMapping("/page")
    public Page<EnterpriseDomainVo> page(@RequestBody EnterpriseDomainSelectDto dto) {
        return enterpriseDomainService.getPage(dto);
    }

    /**
     * 企业邮箱域名明细
     */
    @PostMapping("/detail")
    public EnterpriseDomainVo detail(@RequestBody BaseSelectDto dto) {
        return enterpriseDomainService.detail(dto.getId());
    }

    /**
     * 企业邮箱域名新增
     */
    @PostMapping("/add")
    public void add(@Validated @RequestBody EnterpriseDomainDto enterpriseDomainDto) {
        enterpriseDomainService.add(enterpriseDomainDto);
    }

    /**
     * 企业邮箱域名编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody EnterpriseDomainDto enterpriseDomainDto) {
        enterpriseDomainService.edit(enterpriseDomainDto);
    }

    /**
     * 企业邮箱域名删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        enterpriseDomainService.delete(dto.getId());
    }

}
