模型环境指标反查保存

This commit is contained in:
xiaogu
2025-09-11 10:44:07 +08:00
parent aa8f41fdb4
commit ad8dd9797b

View File

@@ -7,10 +7,10 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexPageReqVO; import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexPageReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexSaveReqVO; import cn.iocoder.yudao.module.farm.controller.admin.modelenvironmentindex.vo.ModelEnvironmentIndexSaveReqVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO; import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.environmentindexconfig.EnvironmentIndexConfigDO; import cn.iocoder.yudao.module.farm.dal.dataobject.indicatorname.IndicatorNameDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.modelenvironmentindex.ModelEnvironmentIndexDO; import cn.iocoder.yudao.module.farm.dal.dataobject.modelenvironmentindex.ModelEnvironmentIndexDO;
import cn.iocoder.yudao.module.farm.dal.mysql.deviceclassify.DeviceClassifyMapper; import cn.iocoder.yudao.module.farm.dal.mysql.deviceclassify.DeviceClassifyMapper;
import cn.iocoder.yudao.module.farm.dal.mysql.environmentindexconfig.EnvironmentIndexConfigMapper; import cn.iocoder.yudao.module.farm.dal.mysql.indicatorname.IndicatorNameMapper;
import cn.iocoder.yudao.module.farm.dal.mysql.modelenvironmentindex.ModelEnvironmentIndexMapper; import cn.iocoder.yudao.module.farm.dal.mysql.modelenvironmentindex.ModelEnvironmentIndexMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -34,7 +34,7 @@ public class ModelEnvironmentIndexServiceImpl implements ModelEnvironmentIndexSe
@Resource @Resource
private ModelEnvironmentIndexMapper modelEnvironmentIndexMapper; private ModelEnvironmentIndexMapper modelEnvironmentIndexMapper;
@Resource @Resource
private EnvironmentIndexConfigMapper environmentIndexConfigMapper; private IndicatorNameMapper indicatorNameMapper;
@Resource @Resource
private DeviceClassifyMapper deviceClassifyMapper; private DeviceClassifyMapper deviceClassifyMapper;
@@ -45,9 +45,11 @@ public class ModelEnvironmentIndexServiceImpl implements ModelEnvironmentIndexSe
ModelEnvironmentIndexDO modelEnvironmentIndex = BeanUtils.toBean(createReqVO, ModelEnvironmentIndexDO.class); ModelEnvironmentIndexDO modelEnvironmentIndex = BeanUtils.toBean(createReqVO, ModelEnvironmentIndexDO.class);
modelEnvironmentIndex.setId(IdUtil.fastUUID()); modelEnvironmentIndex.setId(IdUtil.fastUUID());
modelEnvironmentIndex.setTenantId(String.valueOf(user.getTenantId())); modelEnvironmentIndex.setTenantId(String.valueOf(user.getTenantId()));
EnvironmentIndexConfigDO environmentIndexConfigDO = environmentIndexConfigMapper.selectById(modelEnvironmentIndex.getIndicators()); IndicatorNameDO indicatorNameDO = indicatorNameMapper.selectById(modelEnvironmentIndex.getIndicators());
modelEnvironmentIndex.setIndicatorsName(environmentIndexConfigDO.getName()); modelEnvironmentIndex.setIndicatorsName(indicatorNameDO.getName());
modelEnvironmentIndex.setIndicatorDescription(environmentIndexConfigDO.getDescription()); modelEnvironmentIndex.setIndicatorDescription(indicatorNameDO.getDescription());
modelEnvironmentIndex.setSampleValue(indicatorNameDO.getSampleValue());
modelEnvironmentIndex.setUnit(indicatorNameDO.getUnit());
DeviceClassifyDO deviceClassifyDO = deviceClassifyMapper.selectById(modelEnvironmentIndex.getDeviceClass()); DeviceClassifyDO deviceClassifyDO = deviceClassifyMapper.selectById(modelEnvironmentIndex.getDeviceClass());
modelEnvironmentIndex.setDeviceClassName(deviceClassifyDO.getName()); modelEnvironmentIndex.setDeviceClassName(deviceClassifyDO.getName());
modelEnvironmentIndexMapper.insert(modelEnvironmentIndex); modelEnvironmentIndexMapper.insert(modelEnvironmentIndex);