提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.data.point.service.impl; |
H |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
5 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
6 |
import com.iailab.module.data.point.dao.DaMeasurePointDao; |
|
7 |
import com.iailab.module.data.point.entity.DaMeasurePointEntity; |
|
8 |
import com.iailab.module.data.point.service.DaMeasurePointService; |
|
9 |
import com.iailab.module.data.point.dto.DaMeasurePointDTO; |
|
10 |
import org.springframework.stereotype.Service; |
|
11 |
|
|
12 |
import java.util.Arrays; |
|
13 |
import java.util.UUID; |
|
14 |
|
|
15 |
/** |
|
16 |
* @author PanZhibao |
|
17 |
* @Description |
|
18 |
* @createTime 2024年05月12日 |
|
19 |
*/ |
|
20 |
@Service |
|
21 |
public class DaMeasurePointServiceImpl extends BaseServiceImpl<DaMeasurePointDao, DaMeasurePointEntity> implements DaMeasurePointService { |
|
22 |
|
|
23 |
@Override |
|
24 |
public void add(DaMeasurePointDTO dto, String pointId) { |
|
25 |
DaMeasurePointEntity entity = ConvertUtils.sourceToTarget(dto, DaMeasurePointEntity.class); |
|
26 |
entity.setId(UUID.randomUUID().toString()); |
|
27 |
entity.setPointId(pointId); |
|
28 |
baseDao.insert(entity); |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
public DaMeasurePointDTO getByPoint(String pointId) { |
|
33 |
QueryWrapper<DaMeasurePointEntity> wrapper = new QueryWrapper<>(); |
|
34 |
wrapper.eq("point_id", pointId); |
|
35 |
DaMeasurePointEntity entity = baseDao.selectOne(wrapper); |
|
36 |
return ConvertUtils.sourceToTarget(entity, DaMeasurePointDTO.class); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public void update(DaMeasurePointDTO dto) { |
|
41 |
DaMeasurePointEntity entity = ConvertUtils.sourceToTarget(dto, DaMeasurePointEntity.class); |
|
42 |
this.updateById(entity); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public void deleteBatch(String[] ids) { |
|
47 |
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public void deleteByPoint(String[] ids) { |
|
52 |
QueryWrapper<DaMeasurePointEntity> wrapper = new QueryWrapper<>(); |
|
53 |
wrapper.in("point_id", ids); |
|
54 |
baseDao.delete(wrapper); |
|
55 |
} |
|
56 |
} |