From 90a1495b9d765c9e1d48f689dbcf977cbdb2768e Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 31 十二月 2024 17:23:13 +0800 Subject: [PATCH] 模型结果修改为存在唯一索引则修改,不存在插入。避免死锁问题 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartServiceImpl.java | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartServiceImpl.java index 4c68120..ac0b631 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartServiceImpl.java @@ -5,20 +5,18 @@ import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mpk.dao.ChartDao; -import com.iailab.module.model.mpk.dao.ChartParamDao; import com.iailab.module.model.mpk.dto.ChartDTO; -import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.entity.ChartEntity; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.service.ChartParamService; import com.iailab.module.model.mpk.service.ChartService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; -import java.util.Date; -import java.util.Map; -import java.util.UUID; +import java.util.*; /** * @description: @@ -28,6 +26,9 @@ @Slf4j @Service public class ChartServiceImpl extends BaseServiceImpl<ChartDao, ChartEntity> implements ChartService { + + @Autowired + private ChartParamService chartParamService; @Override public PageData<ChartDTO> page(Map<String, Object> params) { @@ -71,4 +72,16 @@ .like(StringUtils.isNotBlank(chartCode), "chart_code", chartCode); return wrapper; } + + @Override + public Map<String, String> getByChartCode(String chartCode) { + Map<String, String> result = new HashMap<>(); + QueryWrapper<ChartEntity> wrapper = new QueryWrapper<>(); + wrapper.eq("chart_code", chartCode); + ChartEntity entity = baseDao.selectOne(wrapper); + if (entity == null) { + return result; + } + return chartParamService.getByChartId(entity.getId()); + } } \ No newline at end of file -- Gitblit v1.9.3