package cn.stylefeng.guns.modular.zsx.bs.productBomInfo.service.impl;
|
|
import cn.stylefeng.guns.base.auth.context.LoginContextHolder;
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
|
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
|
import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.entity.ProductBomInfo;
|
import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.mapper.ProductBomInfoMapper;
|
import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.model.params.ProductBomInfoParam;
|
import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.model.result.ProductBomInfoResult;
|
import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.service.ProductBomInfoService;
|
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>
|
* 基础BOM 服务实现类
|
* </p>
|
*
|
* @author ruimin
|
* @since 2023-08-24
|
*/
|
@Service
|
public class ProductBomInfoServiceImpl extends ServiceImpl<ProductBomInfoMapper, ProductBomInfo> implements ProductBomInfoService {
|
|
@Override
|
public void add(ProductBomInfoParam param){
|
param.setCreateUser(LoginContextHolder.getContext().getUser().getName());
|
ProductBomInfo entity = getEntity(param);
|
this.save(entity);
|
}
|
|
@Override
|
public void delete(ProductBomInfoParam param){
|
this.removeById(getKey(param));
|
}
|
|
@Override
|
public void update(ProductBomInfoParam param){
|
param.setUpdateUser(LoginContextHolder.getContext().getUser().getName());
|
ProductBomInfo oldEntity = getOldEntity(param);
|
ProductBomInfo newEntity = getEntity(param);
|
ToolUtil.copyProperties(newEntity, oldEntity);
|
this.updateById(newEntity);
|
}
|
|
@Override
|
public ProductBomInfoResult findBySpec(ProductBomInfoParam param){
|
return null;
|
}
|
|
@Override
|
public List<ProductBomInfoResult> findListBySpec(ProductBomInfoParam param){
|
return null;
|
}
|
|
@Override
|
public LayuiPageInfo findPageBySpec(ProductBomInfoParam param){
|
Page pageContext = getPageContext();
|
IPage page = this.baseMapper.customPageList(pageContext, param);
|
return LayuiPageFactory.createPageInfo(page);
|
}
|
|
private Serializable getKey(ProductBomInfoParam param){
|
return param.getId();
|
}
|
|
private Page getPageContext() {
|
return LayuiPageFactory.defaultPage();
|
}
|
|
private ProductBomInfo getOldEntity(ProductBomInfoParam param) {
|
return this.getById(getKey(param));
|
}
|
|
private ProductBomInfo getEntity(ProductBomInfoParam param) {
|
ProductBomInfo entity = new ProductBomInfo();
|
ToolUtil.copyProperties(param, entity);
|
return entity;
|
}
|
|
}
|