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.QualityVo;
import com.fjhx.purchase.entity.quality.dto.QualitySelectDto;
import com.fjhx.purchase.entity.quality.dto.QualityDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.purchase.service.quality.QualityService;
import org.springframework.beans.factory.annotation.Autowired;


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

    @Autowired
    private QualityService qualityService;

    /**
     * 质检分页
     */
    @PostMapping("/page")
    public Page<QualityVo> page(@RequestBody QualitySelectDto dto) {
        return qualityService.getPage(dto);
    }

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

    /**
     * 质检新增
     */
    @PostMapping("/add")
    public void add(@RequestBody QualityDto qualityDto) {
        qualityService.add(qualityDto);
    }

    /**
     * 质检编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody QualityDto qualityDto) {
        qualityService.edit(qualityDto);
    }

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

}
