package com.iailab.module.data.ind.value.service.impl;
|
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.object.BeanUtils;
|
import com.iailab.framework.tenant.core.context.DataContextHolder;
|
import com.iailab.module.data.ind.item.vo.IndItemValueVO;
|
import com.iailab.module.data.ind.value.dao.IndItemValueDao;
|
import com.iailab.module.data.ind.value.dto.QuerySourceValueDTO;
|
import com.iailab.module.data.ind.value.entity.IndItemValueEntity;
|
import com.iailab.module.data.ind.value.service.IndItemValueService;
|
import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO;
|
import com.iailab.module.data.ind.value.vo.IndItemValueSaveReqVO;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
import java.util.UUID;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年09月11日
|
*/
|
@Service
|
public class IndItemValueServiceImpl extends BaseServiceImpl<IndItemValueDao, IndItemValueEntity> implements IndItemValueService {
|
|
@Override
|
public PageResult<IndItemValueEntity> page(IndItemValuePageReqVO reqVO) {
|
return baseDao.selectPage(reqVO);
|
}
|
|
@Override
|
public void create(IndItemValueSaveReqVO createReqVO) {
|
IndItemValueEntity entity = BeanUtils.toBean(createReqVO, IndItemValueEntity.class);
|
entity.setId(UUID.randomUUID().toString());
|
baseDao.insert(entity);
|
}
|
|
@Override
|
public void update(IndItemValueSaveReqVO updateReqVO) {
|
IndItemValueEntity entity = BeanUtils.toBean(updateReqVO, IndItemValueEntity.class);
|
baseDao.updateById(entity);
|
}
|
|
@Override
|
public IndItemValueEntity get(String id) {
|
return baseDao.selectById(id);
|
}
|
|
@Override
|
public void delete(String id) {
|
baseDao.deleteById(id);
|
}
|
|
/**
|
* 根据配置的数据源动态查询
|
* @param dto
|
* @return
|
*/
|
@Override
|
public List<IndItemValueVO> getSourceValue(QuerySourceValueDTO dto) {
|
if (StringUtils.isEmpty(dto.getDataSource())) {
|
log.warn("数据源不能为空");
|
return null;
|
}
|
DataContextHolder.setDataSourceId(Long.valueOf(dto.getDataSource()));
|
return baseDao.getSourceValue(dto);
|
}
|
}
|