package com.njcn.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.system.mapper.EleEvtParmMapper;
import com.njcn.system.pojo.param.EleEvtParam;
import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.system.service.IEleEvtParmService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 事件拓展表 服务实现类
 * </p>
 *
 * @author xuyang
 * @since 2023-07-31
 */
@Service
public class EleEvtParmServiceImpl extends ServiceImpl<EleEvtParmMapper, EleEvtParm> implements IEleEvtParmService {

    @Override
    public void add(EleEvtParam eleEvtParam) {
        EleEvtParm eleEvtParm = new EleEvtParm();
        BeanUtils.copyProperties(eleEvtParam,eleEvtParm);
        this.save(eleEvtParm);
    }

    @Override
    public void delete(String id) {
        LambdaQueryWrapper<EleEvtParm> deleteWrapper = new LambdaQueryWrapper<>();
        deleteWrapper.eq(EleEvtParm::getPid,id);
        this.baseMapper.delete(deleteWrapper);
    }

    @Override
    public List<EleEvtParm> queryByPid(String pid) {
        return this.lambdaQuery().eq(EleEvtParm::getPid,pid).list();
    }
}
