懒羊羊
2023-08-30 71e81ed1d12e4d69f53c8ad9e066650ad4186293
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package cn.stylefeng.guns.modular.em.equipmentMaintainTask.service.impl;
 
import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.em.equipmentMaintainTask.entity.EquipmentMaintainTask;
import cn.stylefeng.guns.modular.em.equipmentMaintainTask.mapper.EquipmentMaintainTaskMapper;
import cn.stylefeng.guns.modular.em.equipmentMaintainTask.model.params.EquipmentMaintainTaskParam;
import cn.stylefeng.guns.modular.em.equipmentMaintainTask.model.result.EquipmentMaintainTaskResult;
import  cn.stylefeng.guns.modular.em.equipmentMaintainTask.service.EquipmentMaintainTaskService;
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-02-21
 */
@Service
public class EquipmentMaintainTaskServiceImpl extends ServiceImpl<EquipmentMaintainTaskMapper, EquipmentMaintainTask> implements EquipmentMaintainTaskService {
 
    @Override
    public void add(EquipmentMaintainTaskParam param){
        EquipmentMaintainTask entity = getEntity(param);
        this.save(entity);
    }
 
    @Override
    public void delete(EquipmentMaintainTaskParam param){
        this.removeById(getKey(param));
    }
 
    @Override
    public void update(EquipmentMaintainTaskParam param){
        EquipmentMaintainTask oldEntity = getOldEntity(param);
        EquipmentMaintainTask newEntity = getEntity(param);
        ToolUtil.copyProperties(newEntity, oldEntity);
        this.updateById(newEntity);
    }
 
    @Override
    public EquipmentMaintainTaskResult findBySpec(EquipmentMaintainTaskParam param){
        return null;
    }
 
    @Override
    public List<EquipmentMaintainTaskResult> findListBySpec(EquipmentMaintainTaskParam param){
        return null;
    }
 
    @Override
    public LayuiPageInfo findPageBySpec(EquipmentMaintainTaskParam param){
        Page pageContext = getPageContext();
        IPage page = this.baseMapper.customPageList(pageContext, param);
        return LayuiPageFactory.createPageInfo(page);
    }
 
    private Serializable getKey(EquipmentMaintainTaskParam param){
        return param.getId();
    }
 
    private Page getPageContext() {
        return LayuiPageFactory.defaultPage();
    }
 
    private EquipmentMaintainTask getOldEntity(EquipmentMaintainTaskParam param) {
        return this.getById(getKey(param));
    }
 
    private EquipmentMaintainTask getEntity(EquipmentMaintainTaskParam param) {
        EquipmentMaintainTask entity = new EquipmentMaintainTask();
        ToolUtil.copyProperties(param, entity);
        return entity;
    }
 
}