package cn.stylefeng.guns.modular.zsx.bs.productRouteInfo.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.productRouteInfo.entity.ProductRouteInfo;
|
import cn.stylefeng.guns.modular.zsx.bs.productRouteInfo.mapper.ProductRouteInfoMapper;
|
import cn.stylefeng.guns.modular.zsx.bs.productRouteInfo.model.params.ProductRouteInfoParam;
|
import cn.stylefeng.guns.modular.zsx.bs.productRouteInfo.model.result.ProductRouteInfoResult;
|
import cn.stylefeng.guns.modular.zsx.bs.productRouteInfo.service.ProductRouteInfoService;
|
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-08-24
|
*/
|
@Service
|
public class ProductRouteInfoServiceImpl extends ServiceImpl<ProductRouteInfoMapper, ProductRouteInfo> implements ProductRouteInfoService {
|
|
@Override
|
public void add(ProductRouteInfoParam param){
|
param.setCreateUser(LoginContextHolder.getContext().getUser().getName());
|
ProductRouteInfo entity = getEntity(param);
|
this.save(entity);
|
}
|
|
@Override
|
public void delete(ProductRouteInfoParam param){
|
this.removeById(getKey(param));
|
}
|
|
@Override
|
public void update(ProductRouteInfoParam param){
|
param.setUpdateUser(LoginContextHolder.getContext().getUser().getName());
|
ProductRouteInfo oldEntity = getOldEntity(param);
|
ProductRouteInfo newEntity = getEntity(param);
|
ToolUtil.copyProperties(newEntity, oldEntity);
|
this.updateById(newEntity);
|
}
|
|
@Override
|
public ProductRouteInfoResult findBySpec(ProductRouteInfoParam param){
|
return null;
|
}
|
|
@Override
|
public List<ProductRouteInfoResult> findListBySpec(ProductRouteInfoParam param){
|
return null;
|
}
|
|
@Override
|
public LayuiPageInfo findPageBySpec(ProductRouteInfoParam param){
|
Page pageContext = getPageContext();
|
IPage page = this.baseMapper.customPageList(pageContext, param);
|
return LayuiPageFactory.createPageInfo(page);
|
}
|
|
private Serializable getKey(ProductRouteInfoParam param){
|
return param.getId();
|
}
|
|
private Page getPageContext() {
|
return LayuiPageFactory.defaultPage();
|
}
|
|
private ProductRouteInfo getOldEntity(ProductRouteInfoParam param) {
|
return this.getById(getKey(param));
|
}
|
|
private ProductRouteInfo getEntity(ProductRouteInfoParam param) {
|
ProductRouteInfo entity = new ProductRouteInfo();
|
ToolUtil.copyProperties(param, entity);
|
return entity;
|
}
|
|
}
|