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