package com.fjhx.common.controller.corporation;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.common.entity.corporation.dto.CorporationDto;
import com.fjhx.common.entity.corporation.dto.CorporationSelectDto;
import com.fjhx.common.entity.corporation.vo.CorporationVo;
import com.fjhx.common.service.corporation.CorporationService;
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;


/**
 * <p>
 * 多公司配置 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-10
 */
@RestController
@RequestMapping("/corporation")
public class CorporationController {

    @Autowired
    private CorporationService corporationService;

    /**
     * 多公司配置分页
     */
    @PostMapping("/page")
    public Page<CorporationVo> page(@RequestBody CorporationSelectDto dto) {
        return corporationService.getPage(dto);
    }

    /**
     * 多公司配置明细
     */
    @PostMapping("/detail")
    public CorporationVo detail(@RequestBody BaseSelectDto dto) {
        return corporationService.detail(dto.getId());
    }

    /**
     * 多公司配置新增
     */
    @PostMapping("/add")
    public void add(@RequestBody CorporationDto corporationDto) {
        corporationService.add(corporationDto);
    }

    /**
     * 多公司配置编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody CorporationDto corporationDto) {
        corporationService.edit(corporationDto);
    }

    /**
     * 多公司配置删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        corporationService.delete(dto.getId());
    }

}
