liriming
2024-12-03 97f3c16ac595493405e8cf76399dc703c088ef6f
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);
    }
 
}