mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 07:55:06 +08:00
适配 Oracle 数据库
1. 修复配置中心的 DAO 查询报错 2. 适配 LIMIT 1 的查询
This commit is contained in:
@ -2,12 +2,10 @@ package cn.iocoder.yudao.module.infra.dal.mysql.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.apollo.internals.ConfigFrameworkDAO;
|
||||
import cn.iocoder.yudao.framework.apollo.internals.dto.ConfigRespDTO;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -26,14 +24,18 @@ public class ConfigDAOImpl implements ConfigFrameworkDAO {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {
|
||||
return jdbcTemplate.query("SELECT id FROM infra_config WHERE update_time > ? LIMIT 1",
|
||||
ResultSet::next, maxUpdateTime);
|
||||
public int selectCountByUpdateTimeGt(Date maxUpdateTime) {
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM infra_config WHERE update_time > ?",
|
||||
Integer.class, maxUpdateTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigRespDTO> selectList() {
|
||||
return jdbcTemplate.query("SELECT `key`, `value`, update_time, deleted FROM infra_config", new BeanPropertyRowMapper<>(ConfigRespDTO.class));
|
||||
return jdbcTemplate.query("SELECT config_key, value, update_time, deleted FROM infra_config",
|
||||
(rs, rowNum) -> new ConfigRespDTO().setKey(rs.getString("config_key"))
|
||||
.setValue(rs.getString("value"))
|
||||
.setUpdateTime(rs.getDate("update_time"))
|
||||
.setDeleted(rs.getBoolean("deleted")));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user