package com.fjhx.common.controller.documentary;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.common.entity.documentary.vo.DocumentaryVo;
import com.fjhx.common.entity.documentary.dto.DocumentarySelectDto;
import com.fjhx.common.entity.documentary.dto.DocumentaryDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.common.service.documentary.DocumentaryService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 跟单配置 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-19
 */
@RestController
@RequestMapping("/documentary")
public class DocumentaryController {

    @Autowired
    private DocumentaryService documentaryService;

    /**
     * 跟单配置分页
     */
    @PostMapping("/page")
    public Page<DocumentaryVo> page(@RequestBody DocumentarySelectDto dto) {
        return documentaryService.getPage(dto);
    }

    /**
     * 跟单配置明细
     */
    @PostMapping("/detail")
    public DocumentaryVo detail(@RequestBody BaseSelectDto dto) {
        return documentaryService.detail(dto.getId());
    }

    /**
     * 跟单配置新增
     */
    @PostMapping("/add")
    public void add(@RequestBody DocumentaryDto documentaryDto) {
        documentaryService.add(documentaryDto);
    }

    /**
     * 跟单配置编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody DocumentaryDto documentaryDto) {
        documentaryService.edit(documentaryDto);
    }

    /**
     * 跟单配置删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        documentaryService.delete(dto.getId());
    }

}
