package com.fjhx.sale.controller.sample;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import com.fjhx.sale.entity.sample.dto.SampleProjectDto;
import com.fjhx.sale.entity.sample.dto.SampleProjectSelectDto;
import com.fjhx.sale.entity.sample.vo.SampleProjectVo;
import com.fjhx.sale.service.sample.SampleProjectService;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 样品单-收费项目 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-05-05
 */
@RestController
@RequestMapping("/sampleProject")
public class SampleProjectController {

    @Autowired
    private SampleProjectService sampleProjectService;

    /**
     * 样品单-收费项目分页
     */
    @PostMapping("/page")
    public Page<SampleProjectVo> page(@RequestBody SampleProjectSelectDto dto) {
        return sampleProjectService.getPage(dto);
    }

    /**
     * 样品单-收费项目明细
     */
    @PostMapping("/detail")
    public SampleProjectVo detail(@RequestBody BaseSelectDto dto) {
        return sampleProjectService.detail(dto.getId());
    }

    /**
     * 样品单-收费项目新增
     */
    @PostMapping("/add")
    public void add(@RequestBody SampleProjectDto sampleProjectDto) {
        sampleProjectService.add(sampleProjectDto);
    }

    /**
     * 样品单-收费项目编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody SampleProjectDto sampleProjectDto) {
        sampleProjectService.edit(sampleProjectDto);
    }

    /**
     * 样品单-收费项目删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        sampleProjectService.delete(dto.getId());
    }

}
