提交 | 用户 | 时间
|
1ac2bc
|
1 |
package cn.stylefeng.guns.modular.zsx.bs.productRouteChildInfo.service.impl; |
懒 |
2 |
|
|
3 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; |
|
4 |
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; |
|
5 |
import cn.stylefeng.guns.modular.zsx.bs.productBomChildInfo.entity.ProductBomChildInfo; |
|
6 |
import cn.stylefeng.guns.modular.zsx.bs.productRouteChildInfo.entity.ProductRouteChildInfo; |
|
7 |
import cn.stylefeng.guns.modular.zsx.bs.productRouteChildInfo.mapper.ProductRouteChildInfoMapper; |
|
8 |
import cn.stylefeng.guns.modular.zsx.bs.productRouteChildInfo.model.params.ProductRouteChildInfoParam; |
|
9 |
import cn.stylefeng.guns.modular.zsx.bs.productRouteChildInfo.model.result.ProductRouteChildInfoResult; |
|
10 |
import cn.stylefeng.guns.modular.zsx.bs.productRouteChildInfo.service.ProductRouteChildInfoService; |
|
11 |
import cn.stylefeng.roses.core.util.ToolUtil; |
|
12 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
13 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
14 |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
15 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
16 |
import org.springframework.stereotype.Service; |
|
17 |
|
|
18 |
import java.io.Serializable; |
|
19 |
import java.util.List; |
|
20 |
|
|
21 |
/** |
|
22 |
* <p> |
|
23 |
* 工艺路线子信息 服务实现类 |
|
24 |
* </p> |
|
25 |
* |
|
26 |
* @author ruimin |
|
27 |
* @since 2023-08-24 |
|
28 |
*/ |
|
29 |
@Service |
|
30 |
public class ProductRouteChildInfoServiceImpl extends ServiceImpl<ProductRouteChildInfoMapper, ProductRouteChildInfo> implements ProductRouteChildInfoService { |
|
31 |
|
|
32 |
@Override |
|
33 |
public void add(ProductRouteChildInfoParam param){ |
|
34 |
ProductRouteChildInfo entity = getEntity(param); |
|
35 |
this.save(entity); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public void delete(ProductRouteChildInfoParam param){ |
|
40 |
this.removeById(getKey(param)); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public void update(ProductRouteChildInfoParam param){ |
|
45 |
ProductRouteChildInfo oldEntity = getOldEntity(param); |
|
46 |
ProductRouteChildInfo newEntity = getEntity(param); |
|
47 |
ToolUtil.copyProperties(newEntity, oldEntity); |
|
48 |
this.updateById(newEntity); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public ProductRouteChildInfoResult findBySpec(ProductRouteChildInfoParam param){ |
|
53 |
return null; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public List<ProductRouteChildInfoResult> findListBySpec(ProductRouteChildInfoParam param){ |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public LayuiPageInfo findPageBySpec(ProductRouteChildInfoParam param){ |
|
63 |
Page pageContext = getPageContext(); |
|
64 |
IPage page = this.baseMapper.customPageList(pageContext, param); |
|
65 |
return LayuiPageFactory.createPageInfo(page); |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public void deleteBomChildByBomCode(String routeCode) { |
|
70 |
this.baseMapper.delete(new QueryWrapper<ProductRouteChildInfo>().eq("route_code",routeCode)); |
|
71 |
} |
|
72 |
|
|
73 |
private Serializable getKey(ProductRouteChildInfoParam param){ |
|
74 |
return param.getId(); |
|
75 |
} |
|
76 |
|
|
77 |
private Page getPageContext() { |
|
78 |
return LayuiPageFactory.defaultPage(); |
|
79 |
} |
|
80 |
|
|
81 |
private ProductRouteChildInfo getOldEntity(ProductRouteChildInfoParam param) { |
|
82 |
return this.getById(getKey(param)); |
|
83 |
} |
|
84 |
|
|
85 |
private ProductRouteChildInfo getEntity(ProductRouteChildInfoParam param) { |
|
86 |
ProductRouteChildInfo entity = new ProductRouteChildInfo(); |
|
87 |
ToolUtil.copyProperties(param, entity); |
|
88 |
return entity; |
|
89 |
} |
|
90 |
|
|
91 |
} |