package cn.stylefeng.guns.modular.cm.plcInteractiveData.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.cm.plcInteractiveData.entity.PlcInteractiveData; import cn.stylefeng.guns.modular.cm.plcInteractiveData.mapper.PlcInteractiveDataMapper; import cn.stylefeng.guns.modular.cm.plcInteractiveData.model.params.PlcInteractiveDataParam; import cn.stylefeng.guns.modular.cm.plcInteractiveData.model.result.PlcInteractiveDataResult; import cn.stylefeng.guns.modular.cm.plcInteractiveData.service.PlcInteractiveDataService; import cn.stylefeng.roses.core.util.ToolUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import java.io.Serializable; import java.util.List; /** *

* plc交互数据 服务实现类 *

* * @author ruimin * @since 2023-10-25 */ @Service public class PlcInteractiveDataServiceImpl extends ServiceImpl implements PlcInteractiveDataService { @Override public void add(PlcInteractiveDataParam param){ PlcInteractiveData entity = getEntity(param); this.save(entity); } @Override public void delete(PlcInteractiveDataParam param){ this.removeById(getKey(param)); } @Override public void update(PlcInteractiveDataParam param){ PlcInteractiveData oldEntity = getOldEntity(param); PlcInteractiveData newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public PlcInteractiveDataResult findBySpec(PlcInteractiveDataParam param){ return null; } @Override public List findListBySpec(PlcInteractiveDataParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(PlcInteractiveDataParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(PlcInteractiveDataParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private PlcInteractiveData getOldEntity(PlcInteractiveDataParam param) { return this.getById(getKey(param)); } private PlcInteractiveData getEntity(PlcInteractiveDataParam param) { PlcInteractiveData entity = new PlcInteractiveData(); ToolUtil.copyProperties(param, entity); return entity; } }