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);
|
}
|
}
|