package cn.stylefeng.guns.modular.gm.greaseManage.service.impl;
|
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
|
import cn.stylefeng.guns.modular.gm.greaseManage.entity.GreaseManage;
|
import cn.stylefeng.guns.modular.gm.greaseManage.mapper.GreaseManageMapper;
|
import cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam;
|
import cn.stylefeng.guns.modular.gm.greaseManage.model.result.GreaseManageResult;
|
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
|
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 ruimin
|
* @since 2023-12-11
|
*/
|
@Service
|
public class GreaseManageServiceImpl extends ServiceImpl<GreaseManageMapper, GreaseManage> implements GreaseManageService {
|
|
@Override
|
public void add(GreaseManageParam param){
|
GreaseManage entity = getEntity(param);
|
this.save(entity);
|
}
|
|
@Override
|
public void delete(GreaseManageParam param){
|
this.removeById(getKey(param));
|
}
|
|
@Override
|
public void update(GreaseManageParam param){
|
GreaseManage oldEntity = getOldEntity(param);
|
GreaseManage newEntity = getEntity(param);
|
ToolUtil.copyProperties(newEntity, oldEntity);
|
this.updateById(newEntity);
|
}
|
|
@Override
|
public GreaseManageResult findBySpec(GreaseManageParam param){
|
return null;
|
}
|
|
@Override
|
public List<GreaseManageResult> findListBySpec(GreaseManageParam param){
|
return this.baseMapper.customList(param);
|
}
|
|
@Override
|
public LayuiPageInfo findPageBySpec(GreaseManageParam param){
|
Page pageContext = getPageContext();
|
IPage page = this.baseMapper.customPageList(pageContext, param);
|
return LayuiPageFactory.createPageInfo(page);
|
}
|
|
private Serializable getKey(GreaseManageParam param){
|
return param.getId();
|
}
|
|
private Page getPageContext() {
|
return LayuiPageFactory.defaultPage();
|
}
|
|
private GreaseManage getOldEntity(GreaseManageParam param) {
|
return this.getById(getKey(param));
|
}
|
|
private GreaseManage getEntity(GreaseManageParam param) {
|
GreaseManage entity = new GreaseManage();
|
ToolUtil.copyProperties(param, entity);
|
return entity;
|
}
|
|
}
|