package com.base.biz.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.base.biz.model.entity.SatelliteAppendix;
import com.base.orbit.utils.IdGenerator;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.UUID;

/**
 * @author yc
 * @date 2023-02-24
 */
public interface SatelliteAppendixMapper extends BaseMapper<SatelliteAppendix> {

    default void save(SatelliteAppendix obj) {
        obj.setId(IdGenerator.getStrId());
        this.insert(obj);
    }

    default void update(SatelliteAppendix obj) {
        this.updateById(obj);
    }

    default void removeById(String id) {
        this.deleteById(id);
    }

    default List<SatelliteAppendix> getList(List<String> satelliteCode) {
        QueryWrapper<SatelliteAppendix> queryWrapper = new QueryWrapper<>();
        if (!CollectionUtils.isEmpty(satelliteCode)){
            queryWrapper.in("satellite_code",satelliteCode);
        }
        return this.selectList(new QueryWrapper<>());
    }

}
