package cn.stylefeng.guns.modular.em.equipmentMaintainContentPlan.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.em.equipmentMaintainContentPlan.entity.EquipmentMaintainContentPlan; import cn.stylefeng.guns.modular.em.equipmentMaintainContentPlan.mapper.EquipmentMaintainContentPlanMapper; import cn.stylefeng.guns.modular.em.equipmentMaintainContentPlan.model.params.EquipmentMaintainContentPlanParam; import cn.stylefeng.guns.modular.em.equipmentMaintainContentPlan.model.result.EquipmentMaintainContentPlanResult; import cn.stylefeng.guns.modular.em.equipmentMaintainContentPlan.service.EquipmentMaintainContentPlanService; 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 ruimin * @since 2023-02-20 */ @Service public class EquipmentMaintainContentPlanServiceImpl extends ServiceImpl implements EquipmentMaintainContentPlanService { @Override public void add(EquipmentMaintainContentPlanParam param){ EquipmentMaintainContentPlan entity = getEntity(param); this.save(entity); } @Override public void delete(EquipmentMaintainContentPlanParam param){ this.removeById(getKey(param)); } @Override public void update(EquipmentMaintainContentPlanParam param){ EquipmentMaintainContentPlan oldEntity = getOldEntity(param); EquipmentMaintainContentPlan newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public EquipmentMaintainContentPlanResult findBySpec(EquipmentMaintainContentPlanParam param){ return null; } @Override public List findListBySpec(EquipmentMaintainContentPlanParam param){ return null; } @Override public LayuiPageInfo findPageBySpec(EquipmentMaintainContentPlanParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } private Serializable getKey(EquipmentMaintainContentPlanParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private EquipmentMaintainContentPlan getOldEntity(EquipmentMaintainContentPlanParam param) { return this.getById(getKey(param)); } private EquipmentMaintainContentPlan getEntity(EquipmentMaintainContentPlanParam param) { EquipmentMaintainContentPlan entity = new EquipmentMaintainContentPlan(); ToolUtil.copyProperties(param, entity); return entity; } }