package com.fjhx.purchase.controller.quality;

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.quality.vo.QualityDetailVo;
import com.fjhx.purchase.entity.quality.dto.QualityDetailSelectDto;
import com.fjhx.purchase.entity.quality.dto.QualityDetailDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.purchase.service.quality.QualityDetailService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 质检明细单 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-11
 */
//@DS(SourceConstant.PURCHASE)
@RestController
@RequestMapping("/qualityDetail")
public class QualityDetailController {

    @Autowired
    private QualityDetailService qualityDetailService;

    /**
     * 质检明细单分页
     */
    @PostMapping("/page")
    public Page<QualityDetailVo> page(@RequestBody QualityDetailSelectDto dto) {
        return qualityDetailService.getPage(dto);
    }

    /**
     * 质检明细单明细
     */
    @PostMapping("/detail")
    public QualityDetailVo detail(@RequestBody BaseSelectDto dto) {
        return qualityDetailService.detail(dto.getId());
    }

    /**
     * 质检明细单新增
     */
    @PostMapping("/add")
    public void add(@RequestBody QualityDetailDto qualityDetailDto) {
        qualityDetailService.add(qualityDetailDto);
    }

    /**
     * 质检明细单编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody QualityDetailDto qualityDetailDto) {
        qualityDetailService.edit(qualityDetailDto);
    }

    /**
     * 质检明细单删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        qualityDetailService.delete(dto.getId());
    }

}
