我要 update 表data_resources_summary 的data_numbers 字段,条件是 datasource = oracle data_resources = 表数量 。 更新值为select count(1) from yt.dim_t_elk_full_metadata;
时间: 2024-04-11 09:26:13 浏览: 29
好的,你可以使用以下 SQL 语句来更新表 data_resources_summary 的 data_numbers 字段:
```sql
UPDATE data_resources_summary
SET data_numbers = (
SELECT COUNT(1)
FROM yt.dim_t_elk_full_metadata
)
WHERE datasource = 'oracle' AND data_resources = '表数量';
```
请确保将 `yt.dim_t_elk_full_metadata` 替换为你实际表的名称,然后执行该 SQL 语句即可完成更新操作。
相关问题
gv_date.DataSource = dt;
这段代码是将一个 DataTable 对象 dt 绑定到一个数据控件 gv_date 上,用于展示数据。其中,gv_date 是数据控件的名称,可以是 GridView、DataGrid、DataList 等 ASP.NET 中的数据控件。通常情况下,DataTable 对象是通过数据库查询或其他方式获取到的数据集合,而数据控件则可以直接将这些数据展示在网页上,方便用户浏览和操作。
mybatispuls报错,找不到字段,但是我数据库表里有字段,del_flag
出现这种情况可能是因为MybatisPlus默认开启了驼峰命名转换,而您的表中的字段名是下划线命名的,导致MybatisPlus找不到该字段。您可以试试以下方法解决该问题:
1. 在实体类对应字段上添加@TableField注解,指定该字段名对应的数据库字段名,例如:
```java
@TableField(value = "del_flag")
private Integer delFlag;
```
2. 在MybatisPlus的全局配置中,禁用驼峰命名转换,例如:
```java
@Configuration
@MapperScan("com.example.mapper")
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
return new MybatisPlusInterceptor();
}
@Bean
public ConfigurationCustomizer configurationCustomizer() {
return configuration -> configuration.setObjectWrapperFactory(new MybatisMapWrapperFactory());
}
@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
sqlSessionFactory.setTypeAliasesPackage("com.example.entity");
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setDbConfig(new GlobalConfig.DbConfig().setCapitalMode(false));
sqlSessionFactory.setGlobalConfig(globalConfig);
MybatisConfiguration configuration = new MybatisConfiguration();
configuration.setMapUnderscoreToCamelCase(false);
sqlSessionFactory.setConfiguration(configuration);
sqlSessionFactory.setPlugins(new Interceptor[]{
new PaginationInterceptor(),
new OptimisticLockerInterceptor(),
new MybatisPlusInterceptor()
});
return sqlSessionFactory.getObject();
}
}
```
配置中的`configuration.setMapUnderscoreToCamelCase(false)`即为禁用驼峰命名转换的配置。
希望以上方法可以帮到您。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)