dengzedong
4 天以前 7f0bcd00c556889ba890e5e68c681f1b5d4267e1
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
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.DaMeasurePointDao;
import com.iailab.module.data.point.entity.DaMeasurePointEntity;
import com.iailab.module.data.point.service.DaMeasurePointService;
import com.iailab.module.data.point.dto.DaMeasurePointDTO;
import org.springframework.stereotype.Service;
 
import java.util.Arrays;
import java.util.UUID;
 
/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年05月12日
 */
@Service
public class DaMeasurePointServiceImpl extends BaseServiceImpl<DaMeasurePointDao, DaMeasurePointEntity> implements DaMeasurePointService {
 
    @Override
    public void add(DaMeasurePointDTO dto, String pointId) {
        DaMeasurePointEntity entity = ConvertUtils.sourceToTarget(dto, DaMeasurePointEntity.class);
        entity.setId(UUID.randomUUID().toString());
        entity.setPointId(pointId);
        baseDao.insert(entity);
    }
 
    @Override
    public DaMeasurePointDTO getByPoint(String pointId) {
        QueryWrapper<DaMeasurePointEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("point_id", pointId);
        DaMeasurePointEntity entity = baseDao.selectOne(wrapper);
        return ConvertUtils.sourceToTarget(entity, DaMeasurePointDTO.class);
    }
 
    @Override
    public void update(DaMeasurePointDTO dto) {
        DaMeasurePointEntity entity = ConvertUtils.sourceToTarget(dto, DaMeasurePointEntity.class);
        this.updateById(entity);
    }
 
    @Override
    public void deleteBatch(String[] ids) {
        baseDao.deleteBatchIds(Arrays.asList(ids));
    }
 
    @Override
    public void deleteByPoint(String[] ids) {
        QueryWrapper<DaMeasurePointEntity> wrapper = new QueryWrapper<>();
        wrapper.in("point_id", ids);
        baseDao.delete(wrapper);
    }
}