package cn.stylefeng.guns.modular.sc.equipmentAlarmConf.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.sc.equipmentAlarmConf.entity.EquipmentAlarmConf; import cn.stylefeng.guns.modular.sc.equipmentAlarmConf.mapper.EquipmentAlarmConfMapper; import cn.stylefeng.guns.modular.sc.equipmentAlarmConf.model.params.EquipmentAlarmConfParam; import cn.stylefeng.guns.modular.sc.equipmentAlarmConf.model.result.EquipmentAlarmConfResult; import cn.stylefeng.guns.modular.sc.equipmentAlarmConf.service.EquipmentAlarmConfService; 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; /** *

* 报警代码配置 服务实现类 *

* * @author cl * @since 2022-10-28 */ @Service public class EquipmentAlarmConfServiceImpl extends ServiceImpl implements EquipmentAlarmConfService { @Override public void add(EquipmentAlarmConfParam param){ EquipmentAlarmConf entity = getEntity(param); this.save(entity); } @Override public void delete(EquipmentAlarmConfParam param){ this.removeById(getKey(param)); } @Override public void update(EquipmentAlarmConfParam param){ EquipmentAlarmConf oldEntity = getOldEntity(param); EquipmentAlarmConf newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public EquipmentAlarmConfResult findBySpec(EquipmentAlarmConfParam param){ return null; } @Override public List findListBySpec(EquipmentAlarmConfParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(EquipmentAlarmConfParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(EquipmentAlarmConfParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private EquipmentAlarmConf getOldEntity(EquipmentAlarmConfParam param) { return this.getById(getKey(param)); } private EquipmentAlarmConf getEntity(EquipmentAlarmConfParam param) { EquipmentAlarmConf entity = new EquipmentAlarmConf(); ToolUtil.copyProperties(param, entity); return entity; } }