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

import com.fjhx.sale.entity.quality.po.EhsdQualityMarkingDetail;
import com.fjhx.sale.mapper.quality.EhsdQualityMarkingDetailMapper;
import com.fjhx.sale.service.quality.EhsdQualityMarkingDetailService;
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.EhsdQualityMarkingDetailVo;
import com.fjhx.sale.entity.quality.dto.EhsdQualityMarkingDetailSelectDto;
import com.ruoyi.common.utils.wrapper.IWrapper;
import com.fjhx.sale.entity.quality.dto.EhsdQualityMarkingDetailDto;
import cn.hutool.core.bean.BeanUtil;


/**
 * <p>
 * 质检打标明细表 服务实现类
 * </p>
 *
 * @author 
 * @since 2023-05-25
 */
@Service
public class EhsdQualityMarkingDetailServiceImpl extends ServiceImpl<EhsdQualityMarkingDetailMapper, EhsdQualityMarkingDetail> implements EhsdQualityMarkingDetailService {

    @Override
    public Page<EhsdQualityMarkingDetailVo> getPage(EhsdQualityMarkingDetailSelectDto dto) {
        IWrapper<EhsdQualityMarkingDetail> wrapper = getWrapper();
        wrapper.orderByDesc("eqmd", EhsdQualityMarkingDetail::getId);
        Page<EhsdQualityMarkingDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
        return page;
    }

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

    @Override
    public void add(EhsdQualityMarkingDetailDto ehsdQualityMarkingDetailDto) {
        this.save(ehsdQualityMarkingDetailDto);
    }

    @Override
    public void edit(EhsdQualityMarkingDetailDto ehsdQualityMarkingDetailDto) {
        this.updateById(ehsdQualityMarkingDetailDto);
    }

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

}
