潘志宝
2024-11-29 0ed8ac1f3171e0d43d07f0c1bac32fc3712bd15b
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
package com.iailab.module.data.point.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iailab.framework.common.service.impl.BaseServiceImpl;
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.module.data.point.dao.DaCumulatePointDao;
import com.iailab.module.data.point.dto.DaCumulatePointDTO;
import com.iailab.module.data.point.entity.DaCumulatePointEntity;
import com.iailab.module.data.point.service.DaCumulatePointService;
import org.springframework.stereotype.Service;
 
import java.util.Arrays;
 
/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年11月28日
 */
@Service
public class DaCumulatePointServiceImpl extends BaseServiceImpl<DaCumulatePointDao, DaCumulatePointEntity> implements DaCumulatePointService {
 
    @Override
    public void add(DaCumulatePointDTO dto, String pointId) {
        DaCumulatePointEntity entity = ConvertUtils.sourceToTarget(dto, DaCumulatePointEntity.class);
        entity.setPointId(pointId);
        baseDao.insert(entity);
    }
 
    @Override
    public DaCumulatePointDTO getByPoint(String pointId) {
        QueryWrapper<DaCumulatePointEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("point_id", pointId);
        DaCumulatePointEntity entity = baseDao.selectOne(wrapper);
        return ConvertUtils.sourceToTarget(entity, DaCumulatePointDTO.class);
    }
 
    @Override
    public void update(DaCumulatePointDTO dto) {
        DaCumulatePointEntity entity = ConvertUtils.sourceToTarget(dto, DaCumulatePointEntity.class);
        this.updateById(entity);
    }
 
    @Override
    public void deleteBatch(String[] ids) {
        baseDao.deleteBatchIds(Arrays.asList(ids));
    }
 
    @Override
    public void deleteByPoint(String[] ids) {
        QueryWrapper<DaCumulatePointEntity> wrapper = new QueryWrapper<>();
        wrapper.in("point_id", Arrays.asList(ids));
        baseDao.delete(wrapper);
    }
 
}