package com.fjhx.purchase.controller.purchase;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.purchase.entity.purchase.vo.PurchaseDetailVo;
import com.fjhx.purchase.entity.purchase.dto.PurchaseDetailSelectDto;
import com.fjhx.purchase.entity.purchase.dto.PurchaseDetailDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.purchase.service.purchase.PurchaseDetailService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 采购明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-06
 */
//@DS(SourceConstant.PURCHASE)
@RestController
@RequestMapping("/purchaseDetail")
public class PurchaseDetailController {

    @Autowired
    private PurchaseDetailService purchaseDetailService;

    /**
     * 采购明细分页
     */
    @PostMapping("/page")
    public Page<PurchaseDetailVo> page(@RequestBody PurchaseDetailSelectDto dto) {
        return purchaseDetailService.getPage(dto);
    }

    /**
     * 采购明细明细
     */
    @PostMapping("/detail")
    public PurchaseDetailVo detail(@RequestBody BaseSelectDto dto) {
        return purchaseDetailService.detail(dto.getId());
    }

    /**
     * 采购明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody PurchaseDetailDto purchaseDetailDto) {
        purchaseDetailService.add(purchaseDetailDto);
    }

    /**
     * 采购明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody PurchaseDetailDto purchaseDetailDto) {
        purchaseDetailService.edit(purchaseDetailDto);
    }

    /**
     * 采购明细删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        purchaseDetailService.delete(dto.getId());
    }

}
