package com.fjhx.victoriatourist.controller.quality;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.quality.dto.QualityInfoDto;
import com.fjhx.victoriatourist.entity.quality.dto.QualityInfoSelectDto;
import com.fjhx.victoriatourist.entity.quality.vo.QualityInfoVo;
import com.fjhx.victoriatourist.service.quality.QualityInfoService;
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;

import java.util.List;


/**
 * <p>
 * 质检 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-26
 */
@RestController
@RequestMapping("/qualityInfo")
public class QualityInfoController {

    @Autowired
    private QualityInfoService qualityInfoService;

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

    /**
     * 质检分页
     */
    @PostMapping("/page1")
    public Page<QualityInfoVo> page1(@RequestBody QualityInfoSelectDto dto) {
        return qualityInfoService.getPage1(dto);
    }

    /**
     * 获取质检列表
     */
    @PostMapping("/getList")
    List<QualityInfoVo> getList(@RequestBody QualityInfoSelectDto dto){
        return qualityInfoService.getList(dto);
    }

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

    /**
     * 质检新增
     */
    @PostMapping("/add")
    public void add(@RequestBody QualityInfoDto qualityInfoDto) {
        qualityInfoService.add(qualityInfoDto);
    }

    /**
     * 质检编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody QualityInfoDto qualityInfoDto) {
        qualityInfoService.edit(qualityInfoDto);
    }

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

    /**
     * 获取质检记录
     */
    @PostMapping("/getQualityRecord")
    List<QualityInfoVo> getQualityRecord(@RequestBody QualityInfoDto dto){
        return qualityInfoService.getQualityRecordByPurchaseId(dto);
    }

}
