package cn.stylefeng.guns.modular.em.equipmentMaintainContentConf.service.impl;
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.em.equipmentMaintainContentConf.entity.EquipmentMaintainContentConf;
import cn.stylefeng.guns.modular.em.equipmentMaintainContentConf.mapper.EquipmentMaintainContentConfMapper;
import cn.stylefeng.guns.modular.em.equipmentMaintainContentConf.model.params.EquipmentMaintainContentConfParam;
import cn.stylefeng.guns.modular.em.equipmentMaintainContentConf.model.result.EquipmentMaintainContentConfResult;
import cn.stylefeng.guns.modular.em.equipmentMaintainContentConf.service.EquipmentMaintainContentConfService;
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 EquipmentMaintainContentConfServiceImpl extends ServiceImpl implements EquipmentMaintainContentConfService {
@Override
public void add(EquipmentMaintainContentConfParam param){
EquipmentMaintainContentConf entity = getEntity(param);
this.save(entity);
}
@Override
public void delete(EquipmentMaintainContentConfParam param){
this.removeById(getKey(param));
}
@Override
public void update(EquipmentMaintainContentConfParam param){
EquipmentMaintainContentConf oldEntity = getOldEntity(param);
EquipmentMaintainContentConf newEntity = getEntity(param);
ToolUtil.copyProperties(newEntity, oldEntity);
this.updateById(newEntity);
}
@Override
public EquipmentMaintainContentConfResult findBySpec(EquipmentMaintainContentConfParam param){
return null;
}
@Override
public List findListBySpec(EquipmentMaintainContentConfParam param){
return null;
}
@Override
public LayuiPageInfo findPageBySpec(EquipmentMaintainContentConfParam param){
Page pageContext = getPageContext();
IPage page = this.baseMapper.customPageList(pageContext, param);
return LayuiPageFactory.createPageInfo(page);
}
private Serializable getKey(EquipmentMaintainContentConfParam param){
return param.getId();
}
private Page getPageContext() {
return LayuiPageFactory.defaultPage();
}
private EquipmentMaintainContentConf getOldEntity(EquipmentMaintainContentConfParam param) {
return this.getById(getKey(param));
}
private EquipmentMaintainContentConf getEntity(EquipmentMaintainContentConfParam param) {
EquipmentMaintainContentConf entity = new EquipmentMaintainContentConf();
ToolUtil.copyProperties(param, entity);
return entity;
}
}