修复医嘱下获取读取慢问题,同时解决系列字典表读取慢问题
This commit is contained in:
@@ -2,6 +2,7 @@ package com.openhis.common.aspectj;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DictUtils;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@@ -115,19 +116,12 @@ public class DictAspect {
|
||||
}
|
||||
|
||||
private String queryDictLabel(String dictTable, String dictCode, String dictText, String dictValue) {
|
||||
String sql;
|
||||
if (StringUtils.isEmpty(dictTable)) {
|
||||
// 场景 1:默认查询 sys_dict_data 表
|
||||
sql = "SELECT dict_label FROM sys_dict_data WHERE dict_type = ? AND dict_value::varchar = ? LIMIT 1";
|
||||
try {
|
||||
return jdbcTemplate.queryForObject(sql, String.class, dictCode, dictValue);
|
||||
} catch (DataAccessException e) {
|
||||
// 如果查询结果为空,返回 空字符串
|
||||
return "";
|
||||
}
|
||||
if (StringUtils.hasText(dictTable)) {
|
||||
// 场景 1:默认字典走DictUtils缓存
|
||||
return DictUtils.getDictLabel(dictCode, dictValue);
|
||||
} else {
|
||||
// 场景 2:查询指定表
|
||||
sql = String.format("SELECT %s FROM %s WHERE %s::varchar = ? LIMIT 1", dictText, dictTable, dictCode);
|
||||
String sql = String.format("SELECT %s FROM %s WHERE %s::varchar = ? LIMIT 1", dictText, dictTable, dictCode);
|
||||
try {
|
||||
return jdbcTemplate.queryForObject(sql, String.class, dictValue);
|
||||
} catch (DataAccessException e) {
|
||||
|
||||
Reference in New Issue
Block a user