package com.fjhx.sale.service.quality.impl;

import com.fjhx.sale.entity.quality.po.EhsdQualitySiteTest;
import com.fjhx.sale.mapper.quality.EhsdQualitySiteTestMapper;
import com.fjhx.sale.service.quality.EhsdQualitySiteTestService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.quality.vo.EhsdQualitySiteTestVo;
import com.fjhx.sale.entity.quality.dto.EhsdQualitySiteTestSelectDto;
import com.ruoyi.common.utils.wrapper.IWrapper;
import com.fjhx.sale.entity.quality.dto.EhsdQualitySiteTestDto;
import cn.hutool.core.bean.BeanUtil;


/**
 * <p>
 * 质检工艺表 服务实现类
 * </p>
 *
 * @author 
 * @since 2023-05-22
 */
@Service
public class EhsdQualitySiteTestServiceImpl extends ServiceImpl<EhsdQualitySiteTestMapper, EhsdQualitySiteTest> implements EhsdQualitySiteTestService {

    @Override
    public Page<EhsdQualitySiteTestVo> getPage(EhsdQualitySiteTestSelectDto dto) {
        IWrapper<EhsdQualitySiteTest> wrapper = getWrapper();
        wrapper.orderByDesc("eqst", EhsdQualitySiteTest::getId);
        Page<EhsdQualitySiteTestVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
        return page;
    }

    @Override
    public EhsdQualitySiteTestVo detail(Long id) {
        EhsdQualitySiteTest EhsdQualitySiteTest = this.getById(id);
        EhsdQualitySiteTestVo result = BeanUtil.toBean(EhsdQualitySiteTest, EhsdQualitySiteTestVo.class);
        return result;
    }

    @Override
    public void add(EhsdQualitySiteTestDto ehsdQualitySiteTestDto) {
        this.save(ehsdQualitySiteTestDto);
    }

    @Override
    public void edit(EhsdQualitySiteTestDto ehsdQualitySiteTestDto) {
        this.updateById(ehsdQualitySiteTestDto);
    }

    @Override
    public void delete(Long id) {
        this.removeById(id);
    }

}
