package com.gyee.frame.service.impl.ticket;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.frame.model.ticket.Wosafemeasure;
import com.gyee.frame.mapper.ticket.WosafemeasureMapper;
import com.gyee.frame.service.ticket.WosafemeasureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenmh
 * @since 2020-06-08
 */
@Transactional
@Service
public class WosafemeasureServiceImpl extends ServiceImpl<WosafemeasureMapper, Wosafemeasure> implements WosafemeasureService {

    @Override
    public List<Wosafemeasure> getListSafeMeasure(String wonum, String type) {
        QueryWrapper<Wosafemeasure> wrapper = new QueryWrapper<>();
        wrapper.eq("WONUM", wonum);
        if (type != null)
            wrapper.eq("TYPE", type);

        List<Wosafemeasure> list = baseMapper.selectList(wrapper);

        return list;
    }

    @Override
    public Integer deleteSafeMeasure(List<Double> list) {
        int result = baseMapper.deleteBatchIds(list);
        return result;
    }

    @Override
    public int selectMaxId() {
        return baseMapper.selectMaxId();
    }
}
