package cn.stylefeng.guns.modular.bs.equipmentInfo.service.impl;
|
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
|
import cn.stylefeng.guns.modular.bs.equipmentInfo.entity.EquipmentInfo;
|
import cn.stylefeng.guns.modular.bs.equipmentInfo.mapper.EquipmentInfoMapper;
|
import cn.stylefeng.guns.modular.bs.equipmentInfo.model.params.EquipmentInfoParam;
|
import cn.stylefeng.guns.modular.bs.equipmentInfo.model.result.EquipmentInfoResult;
|
import cn.stylefeng.guns.modular.bs.equipmentInfo.service.EquipmentInfoService;
|
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;
|
|
/**
|
* <p>
|
* 设备档案 服务实现类
|
* </p>
|
*
|
* @author cl
|
* @since 2022-10-28
|
*/
|
@Service
|
public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, EquipmentInfo> implements EquipmentInfoService {
|
|
@Override
|
public void add(EquipmentInfoParam param){
|
EquipmentInfo entity = getEntity(param);
|
this.save(entity);
|
}
|
|
@Override
|
public void delete(EquipmentInfoParam param){
|
this.removeById(getKey(param));
|
}
|
|
@Override
|
public void update(EquipmentInfoParam param){
|
EquipmentInfo oldEntity = getOldEntity(param);
|
EquipmentInfo newEntity = getEntity(param);
|
ToolUtil.copyProperties(newEntity, oldEntity);
|
this.updateById(newEntity);
|
}
|
|
@Override
|
public EquipmentInfoResult findBySpec(EquipmentInfoParam param){
|
return null;
|
}
|
|
@Override
|
public List<EquipmentInfoResult> findListBySpec(EquipmentInfoParam param){
|
return this.baseMapper.customList(param);
|
}
|
|
@Override
|
public LayuiPageInfo findPageBySpec(EquipmentInfoParam param){
|
Page pageContext = getPageContext();
|
IPage page = this.baseMapper.customPageList(pageContext, param);
|
return LayuiPageFactory.createPageInfo(page);
|
}
|
|
@Override
|
public List<EquipmentInfoResult> exportTable(EquipmentInfoParam param) {
|
return this.baseMapper.customList(param);
|
}
|
|
private Serializable getKey(EquipmentInfoParam param){
|
return param.getId();
|
}
|
|
private Page getPageContext() {
|
return LayuiPageFactory.defaultPage();
|
}
|
|
private EquipmentInfo getOldEntity(EquipmentInfoParam param) {
|
return this.getById(getKey(param));
|
}
|
|
private EquipmentInfo getEntity(EquipmentInfoParam param) {
|
EquipmentInfo entity = new EquipmentInfo();
|
ToolUtil.copyProperties(param, entity);
|
return entity;
|
}
|
|
}
|