perf: 增加表时间字段缓存

dev
huangfeng 8 months ago
parent c09bfebfde
commit 318f9c8aa2

@ -11,6 +11,7 @@ import com.xydl.cac.util.DataUtil;
import com.xydl.cac.util.DateUtil; import com.xydl.cac.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -81,7 +82,8 @@ public class DataServiceImpl implements DataService {
return result; return result;
} }
private String getTimeField(String tableName) { @Cacheable(value = "timeField", key = "#tableName")
public String getTimeField(String tableName) {
if (StringUtils.isBlank(schema)) { if (StringUtils.isBlank(schema)) {
this.getDatabase(); this.getDatabase();
} }

Loading…
Cancel
Save