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