package com.fjhx.service.working.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.utils.WrapperUtil;
import com.fjhx.entity.working.WorkingRouteProcedure;
import com.fjhx.params.working.WorkingRouteProcedureVo;
import com.fjhx.mapper.working.WorkingRouteProcedureMapper;
import com.fjhx.service.working.WorkingRouteProcedureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 工艺路线工序关联表 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-07-14
 */
@Service
public class WorkingRouteProcedureServiceImpl extends ServiceImpl<WorkingRouteProcedureMapper, WorkingRouteProcedure> implements WorkingRouteProcedureService {

    @Override
    public Page<WorkingRouteProcedure> getPage(Map<String, String> condition) {

        QueryWrapper<WorkingRouteProcedure> wrapper = Wrappers.query();

        WrapperUtil.init(condition, wrapper)
                .createTimeDesc();

        Page<WorkingRouteProcedure> page = page(condition, wrapper);
        return page;
    }

    @Override
    public void add(WorkingRouteProcedureVo workingRouteProcedureVo) {
        save(workingRouteProcedureVo);
    }

    @Override
    public void edit(WorkingRouteProcedureVo workingRouteProcedureVo) {
        updateById(workingRouteProcedureVo);
    }

    @Override
    public void delete(WorkingRouteProcedureVo workingRouteProcedureVo) {
        removeById(workingRouteProcedureVo.getId());
    }

}
