提交 | 用户 | 时间
|
2a6f08
|
1 |
package com.iailab.module.data.ind.value.service.impl; |
潘 |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.PageResult; |
|
4 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
5 |
import com.iailab.framework.common.util.object.BeanUtils; |
441d30
|
6 |
import com.iailab.framework.tenant.core.context.DataContextHolder; |
cf757d
|
7 |
import com.iailab.module.data.ind.item.vo.IndItemValueVO; |
2a6f08
|
8 |
import com.iailab.module.data.ind.value.dao.IndItemValueDao; |
cf757d
|
9 |
import com.iailab.module.data.ind.value.dto.QuerySourceValueDTO; |
2a6f08
|
10 |
import com.iailab.module.data.ind.value.entity.IndItemValueEntity; |
潘 |
11 |
import com.iailab.module.data.ind.value.service.IndItemValueService; |
|
12 |
import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO; |
|
13 |
import com.iailab.module.data.ind.value.vo.IndItemValueSaveReqVO; |
cf757d
|
14 |
import org.apache.commons.lang3.StringUtils; |
2a6f08
|
15 |
import org.springframework.stereotype.Service; |
潘 |
16 |
|
cf757d
|
17 |
import java.util.List; |
2a6f08
|
18 |
import java.util.UUID; |
潘 |
19 |
|
|
20 |
/** |
|
21 |
* @author PanZhibao |
|
22 |
* @Description |
|
23 |
* @createTime 2024年09月11日 |
|
24 |
*/ |
|
25 |
@Service |
|
26 |
public class IndItemValueServiceImpl extends BaseServiceImpl<IndItemValueDao, IndItemValueEntity> implements IndItemValueService { |
|
27 |
|
|
28 |
@Override |
|
29 |
public PageResult<IndItemValueEntity> page(IndItemValuePageReqVO reqVO) { |
|
30 |
return baseDao.selectPage(reqVO); |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public void create(IndItemValueSaveReqVO createReqVO) { |
|
35 |
IndItemValueEntity entity = BeanUtils.toBean(createReqVO, IndItemValueEntity.class); |
|
36 |
entity.setId(UUID.randomUUID().toString()); |
|
37 |
baseDao.insert(entity); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public void update(IndItemValueSaveReqVO updateReqVO) { |
|
42 |
IndItemValueEntity entity = BeanUtils.toBean(updateReqVO, IndItemValueEntity.class); |
|
43 |
baseDao.updateById(entity); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public IndItemValueEntity get(String id) { |
|
48 |
return baseDao.selectById(id); |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public void delete(String id) { |
|
53 |
baseDao.deleteById(id); |
|
54 |
} |
cf757d
|
55 |
|
潘 |
56 |
/** |
|
57 |
* 根据配置的数据源动态查询 |
|
58 |
* @param dto |
|
59 |
* @return |
|
60 |
*/ |
|
61 |
@Override |
|
62 |
public List<IndItemValueVO> getSourceValue(QuerySourceValueDTO dto) { |
|
63 |
if (StringUtils.isEmpty(dto.getDataSource())) { |
|
64 |
log.warn("数据源不能为空"); |
|
65 |
return null; |
|
66 |
} |
441d30
|
67 |
DataContextHolder.setDataSourceId(Long.valueOf(dto.getDataSource())); |
cf757d
|
68 |
return baseDao.getSourceValue(dto); |
潘 |
69 |
} |
2a6f08
|
70 |
} |