1. 办公基价作价

This commit is contained in:
purple
2020-06-09 19:28:45 +08:00
parent 645c661478
commit 517f42edf5
10 changed files with 452 additions and 227 deletions

View File

@ -354,8 +354,8 @@ export default {
return ""; return "";
}, },
/** 查询办公基价列表 */ /** 查询办公基价列表 */
getList(formName) { getList() {
this.$refs[formName].validate(valid => { this.$refs['queryForm'].validate(valid => {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
list(this.queryParams).then(response => { list(this.queryParams).then(response => {
@ -381,7 +381,7 @@ export default {
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageIndex = 1; this.queryParams.pageIndex = 1;
this.getList("queryForm"); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {

View File

@ -64,6 +64,15 @@
v-hasPermi="['system:user:import']" v-hasPermi="['system:user:import']"
>导入</el-button> >导入</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-druid"
size="mini"
@click="handleImport"
v-hasPermi="['system:user:import']"
>基价变化一览</el-button>
</el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="dataList"> <el-table v-loading="loading" :data="dataList">

View File

@ -26,7 +26,7 @@
<mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version> <mybatis.spring.boot.starter.version>1.3.2</mybatis.spring.boot.starter.version>
<pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version> <pagehelper.spring.boot.starter.version>1.2.5</pagehelper.spring.boot.starter.version>
<fastjson.version>1.2.68</fastjson.version> <fastjson.version>1.2.68</fastjson.version>
<druid.version>1.1.14</druid.version> <!-- <druid.version>1.1.14</druid.version>-->
<commons.io.version>2.5</commons.io.version> <commons.io.version>2.5</commons.io.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version> <commons.fileupload.version>1.3.3</commons.fileupload.version>
<bitwalker.version>1.19</bitwalker.version> <bitwalker.version>1.19</bitwalker.version>
@ -99,6 +99,7 @@
<groupId>com.microsoft.sqlserver</groupId> <groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId> <artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<version>7.4.0.jre8</version>
</dependency> </dependency>
<!-- SpringBoot集成mybatis框架 --> <!-- SpringBoot集成mybatis框架 -->
@ -116,11 +117,11 @@
</dependency> </dependency>
<!--阿里数据库连接池 --> <!--阿里数据库连接池 -->
<dependency> <!-- <dependency>-->
<groupId>com.alibaba</groupId> <!-- <groupId>com.alibaba</groupId>-->
<artifactId>druid-spring-boot-starter</artifactId> <!-- <artifactId>druid-spring-boot-starter</artifactId>-->
<version>${druid.version}</version> <!-- <version>${druid.version}</version>-->
</dependency> <!-- </dependency>-->
<!--常用工具类 --> <!--常用工具类 -->
<dependency> <dependency>

View File

@ -1,6 +1,6 @@
package com.ruoyi; package com.ruoyi;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; //import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration; import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -11,7 +11,8 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* *
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class, @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
// DruidDataSourceAutoConfigure.class,
PageHelperAutoConfiguration.class}) PageHelperAutoConfiguration.class})
public class RuoYiApplication { public class RuoYiApplication {
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -1,125 +1,125 @@
package com.ruoyi.framework.config; //package com.ruoyi.framework.config;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.sql.DataSource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
import com.alibaba.druid.util.Utils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.framework.datasource.DynamicDataSource;
/**
* druid 配置多数据源
*
* @author ruoyi
*/
@Configuration
public class DruidConfig
{
// @Bean
// @ConfigurationProperties("spring.datasource.druid.master")
// public DataSource masterDataSource(DruidProperties druidProperties)
// {
// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
// return druidProperties.dataSource(dataSource);
// }
// //
// @Bean //import java.io.IOException;
// @ConfigurationProperties("spring.datasource.druid.slave") //import java.util.HashMap;
// @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") //import java.util.Map;
// public DataSource slaveDataSource(DruidProperties druidProperties) //import javax.servlet.Filter;
// { //import javax.servlet.FilterChain;
// DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); //import javax.servlet.ServletException;
// return druidProperties.dataSource(dataSource); //import javax.servlet.ServletRequest;
// } //import javax.servlet.ServletResponse;
//import javax.sql.DataSource;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import com.alibaba.druid.pool.DruidDataSource;
//import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
//import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
//import com.alibaba.druid.util.Utils;
//import com.ruoyi.common.utils.spring.SpringUtils;
//import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
//import com.ruoyi.framework.datasource.DynamicDataSource;
// //
// @Bean(name = "dynamicDataSource") ///**
// @Primary // * druid 配置多数据源
// public DynamicDataSource dataSource(DataSource masterDataSource) // *
// { // * @author ruoyi
// Map<Object, Object> targetDataSources = new HashMap<>(); // */
// targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); //@Configuration
// setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); //public class DruidConfig
// return new DynamicDataSource(masterDataSource, targetDataSources); //{
// } //// @Bean
//// @ConfigurationProperties("spring.datasource.druid.master")
//// public DataSource masterDataSource(DruidProperties druidProperties)
//// {
//// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
//// return druidProperties.dataSource(dataSource);
//// }
////
//// @Bean
//// @ConfigurationProperties("spring.datasource.druid.slave")
//// @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
//// public DataSource slaveDataSource(DruidProperties druidProperties)
//// {
//// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
//// return druidProperties.dataSource(dataSource);
//// }
////
//// @Bean(name = "dynamicDataSource")
//// @Primary
//// public DynamicDataSource dataSource(DataSource masterDataSource)
//// {
//// Map<Object, Object> targetDataSources = new HashMap<>();
//// targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
//// setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
//// return new DynamicDataSource(masterDataSource, targetDataSources);
//// }
////
//// /**
//// * 设置数据源
//// *
//// * @param targetDataSources 备选数据源集合
//// * @param sourceName 数据源名称
//// * @param beanName bean名称
//// */
//// public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
//// {
//// try
//// {
//// DataSource dataSource = SpringUtils.getBean(beanName);
//// targetDataSources.put(sourceName, dataSource);
//// }
//// catch (Exception e)
//// {
//// }
//// }
// //
// /** // /**
// * 设置数据源 // * 去除监控页面底部的广告
// *
// * @param targetDataSources 备选数据源集合
// * @param sourceName 数据源名称
// * @param beanName bean名称
// */ // */
// public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) // @SuppressWarnings({ "rawtypes", "unchecked" })
// @Bean
// @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
// public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
// { // {
// try // // 获取web监控页面的参数
// DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
// // 提取common.js的配置路径
// String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
// String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
// final String filePath = "support/http/resources/js/common.js";
// // 创建filter进行过滤
// Filter filter = new Filter()
// { // {
// DataSource dataSource = SpringUtils.getBean(beanName); // @Override
// targetDataSources.put(sourceName, dataSource); // public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
// } // {
// catch (Exception e) // }
// { // @Override
// } // public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
// throws IOException, ServletException
// {
// chain.doFilter(request, response);
// // 重置缓冲区,响应头不会被重置
// response.resetBuffer();
// // 获取common.js
// String text = Utils.readFromResource(filePath);
// // 正则替换banner, 除去底部的广告信息
// text = text.replaceAll("<a.*?banner\"></a><br/>", "");
// text = text.replaceAll("powered.*?shrek.wang</a>", "");
// response.getWriter().write(text);
// }
// @Override
// public void destroy()
// {
// }
// };
// FilterRegistrationBean registrationBean = new FilterRegistrationBean();
// registrationBean.setFilter(filter);
// registrationBean.addUrlPatterns(commonJsPattern);
// return registrationBean;
// } // }
//}
/**
* 去除监控页面底部的广告
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Bean
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
{
// 获取web监控页面的参数
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
// 提取common.js的配置路径
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
final String filePath = "support/http/resources/js/common.js";
// 创建filter进行过滤
Filter filter = new Filter()
{
@Override
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
{
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
chain.doFilter(request, response);
// 重置缓冲区,响应头不会被重置
response.resetBuffer();
// 获取common.js
String text = Utils.readFromResource(filePath);
// 正则替换banner, 除去底部的广告信息
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
text = text.replaceAll("powered.*?shrek.wang</a>", "");
response.getWriter().write(text);
}
@Override
public void destroy()
{
}
};
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(filter);
registrationBean.addUrlPatterns(commonJsPattern);
return registrationBean;
}
}

View File

@ -0,0 +1,131 @@
package com.ruoyi.framework.config;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.sql.DataSource;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
//import com.alibaba.druid.pool.DruidDataSource;
//import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
//import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
//import com.alibaba.druid.util.Utils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.framework.datasource.DynamicDataSource;
/**
* druid 配置多数据源
*
* @author ruoyi
*/
@Configuration
public class HikariCPConfig {
// @Bean
// @ConfigurationProperties("spring.datasource.druid.master")
// public DataSource masterDataSource(HikariConfig hikariConfig) {
// HikariDataSource hikariDataSource = new HikariDataSource(hikariConfig);
//
// return hikariDataSource;
//
//// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
//// return druidProperties.dataSource(dataSource);
// }
//
// @Bean
// @ConfigurationProperties("spring.datasource.druid.slave")
// @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
// public DataSource slaveDataSource(DruidProperties druidProperties)
// {
// DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
// return druidProperties.dataSource(dataSource);
// }
//
// @Bean(name = "dynamicDataSource")
// @Primary
// public DynamicDataSource dataSource(DataSource masterDataSource)
// {
// Map<Object, Object> targetDataSources = new HashMap<>();
// targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
// setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
// return new DynamicDataSource(masterDataSource, targetDataSources);
// }
//
// /**
// * 设置数据源
// *
// * @param targetDataSources 备选数据源集合
// * @param sourceName 数据源名称
// * @param beanName bean名称
// */
// public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
// {
// try
// {
// DataSource dataSource = SpringUtils.getBean(beanName);
// targetDataSources.put(sourceName, dataSource);
// }
// catch (Exception e)
// {
// }
// }
/**
* 去除监控页面底部的广告
*/
// @SuppressWarnings({ "rawtypes", "unchecked" })
// @Bean
// @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
// public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
// {
// // 获取web监控页面的参数
// DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
// // 提取common.js的配置路径
// String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
// String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
// final String filePath = "support/http/resources/js/common.js";
// // 创建filter进行过滤
// Filter filter = new Filter()
// {
// @Override
// public void init(javax.servlet.FilterConfig filterConfig) throws ServletException
// {
// }
// @Override
// public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
// throws IOException, ServletException
// {
// chain.doFilter(request, response);
// // 重置缓冲区,响应头不会被重置
// response.resetBuffer();
// // 获取common.js
// String text = Utils.readFromResource(filePath);
// // 正则替换banner, 除去底部的广告信息
// text = text.replaceAll("<a.*?banner\"></a><br/>", "");
// text = text.replaceAll("powered.*?shrek.wang</a>", "");
// response.getWriter().write(text);
// }
// @Override
// public void destroy()
// {
// }
// };
// FilterRegistrationBean registrationBean = new FilterRegistrationBean();
// registrationBean.setFilter(filter);
// registrationBean.addUrlPatterns(commonJsPattern);
// return registrationBean;
// }
}

View File

@ -5,7 +5,6 @@ import java.util.*;
import com.ruoyi.common.exception.CustomException; import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.UVConfig; import com.ruoyi.framework.config.UVConfig;
import com.ruoyi.project.common.UVResponse; import com.ruoyi.project.common.UVResponse;
import com.ruoyi.project.common.VueSelectModel; import com.ruoyi.project.common.VueSelectModel;
@ -17,10 +16,7 @@ import com.ruoyi.project.system.service.impl.SysUserServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
/** /**

View File

@ -1,72 +1,108 @@
# 数据源配置 # 数据源配置
spring: spring:
datasource: datasource:
druid: dynamic:
statViewServlet: primary: master
enabled: true hikari:
# 设置白名单,不填则允许所有访问 connection-timeout: 30000
allow: validation-timeout: 30000
url-pattern: /druid/* idle-timeout: 30000
# 控制台管理用户名和密码 max-lifetime: 30000
login-username: max-pool-size: 30
login-password: min-idle: 10
dynamic: initialization-fail-timeout: 30000
druid: connection-init-sql: select 1
# 初始连接数 connection-test-query: select 1
initialSize: 5 is-auto-commit: true
# 最小连接池数量 is-read-only: false
minIdle: 10 datasource:
# 最大连接池数量 master:
maxActive: 20 driver-class-name: com.mysql.jdbc.Driver
# 配置获取连接等待超时的时间 url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
maxWait: 60000 username: root
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 password: LOLm2dI2UQF#RxOf
timeBetweenEvictionRunsMillis: 60000 teemlink:
# 配置一个连接在池中最小生存的时间,单位是毫秒 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
minEvictableIdleTimeMillis: 300000 url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
# 配置一个连接在池中最大生存的时间,单位是毫秒 username: sa
maxEvictableIdleTimeMillis: 900000 password: Lcdatacenter_888
# 配置检测连接是否有效 compute:
validationQuery: SELECT 1 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
testWhileIdle: true url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute
testOnBorrow: false username: sa
testOnReturn: false password: Lcdatacenter_888
webStatFilter: clean:
enabled: true driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
filters: stat,wall url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean
wall: username: sa
multiStatementAllow: true password: Lcdatacenter_888
stat:
log-slow-sql: true # druid:
slow-sql-millis: 1000 # statViewServlet:
merge-sql: true # enabled: true
primary: master # # 设置白名单,不填则允许所有访问
datasource: # allow:
# 主库数据源 # url-pattern: /druid/*
master: # # 控制台管理用户名和密码
driver-class-name: com.mysql.jdbc.Driver # login-username:
url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # login-password:
username: root # dynamic:
password: LOLm2dI2UQF#RxOf # druid:
# 从库数据源 # # 初始连接数
# slave: # initialSize: 5
# # 从数据源开关/默认关闭 # # 最小连接池数量
# enabled: false # minIdle: 10
# url: # # 最大连接池数量
# username: # maxActive: 20
# password: # # 配置获取连接等待超时的时间
teemlink: # maxWait: 60000
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver # # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data # timeBetweenEvictionRunsMillis: 60000
username: sa # # 配置一个连接在池中最小生存的时间,单位是毫秒
password: Lcdatacenter_888 # minEvictableIdleTimeMillis: 300000
compute: # # 配置一个连接在池中最大生存的时间,单位是毫秒
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver # maxEvictableIdleTimeMillis: 900000
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute # # 配置检测连接是否有效
username: sa # validationQuery: SELECT 1
password: Lcdatacenter_888 # testWhileIdle: true
clean: # testOnBorrow: false
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver # testOnReturn: false
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean ## webStatFilter:
username: sa ## enabled: true
password: Lcdatacenter_888 ## filters: stat,wall
## wall:
## multiStatementAllow: true
# stat:
# log-slow-sql: true
# slow-sql-millis: 1000
# merge-sql: true
# primary: master
# datasource:
# # 主库数据源
# master:
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://172.16.30.243:6060/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: LOLm2dI2UQF#RxOf
# # 从库数据源
## slave:
## # 从数据源开关/默认关闭
## enabled: false
## url:
## username:
## password:
# teemlink:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data
# username: sa
# password: Lcdatacenter_888
# compute:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_compute
# username: sa
# password: Lcdatacenter_888
# clean:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=uv_clean
# username: sa
# password: Lcdatacenter_888

View File

@ -54,36 +54,30 @@
,a.Status ,a.Status
,a.BuildingStd ,a.BuildingStd
,a.AdjEvd ,a.AdjEvd
,b.AreaCoff ,a.AreaCoff
,b.YearCoff ,a.YearCoff
,b.BuildingCoff ,a.BuildingCoff
,b.ProjectName ,a.ProjectName
,b.ProjectAddr ,a.ProjectAddr
,b.BuildingAddr ,a.BuildingAddr
,b.County ,a.County
,b.Loop ,a.Loop
,b.Block ,a.Block
,b.Street ,a.Street
,b.Year ,a.Year
,b.AvgArea ,a.AvgArea
,b.TotalFloorSum ,a.TotalFloorSum
,b.UpperFloorSum ,a.UpperFloorSum
,b.OfficeClass ,a.OfficeClass
,b.Grade ,a.Grade
,c.MainPrice AS mainPrice_1 ,a.mainPrice_1
,c.MainPriceRent as mainPriceRent_1 ,a.mainPriceRent_1
, ${yearMonth} as yearMonth , ${yearMonth} as yearMonth
FROM ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth} a FROM ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth} a
left join DIM_OFFICE_PROJECT_BUILDING_201909 b on a.BuildingID_P=b.BuildingID_P
left join ODS_OFFICE_BUILDING_PRICE_INFO_${lastYearMonth} c on a.BuildingID_P = c.BuildingID_P
WHERE b.EffDate <![CDATA[ <= ]]> getdate() AND b.ExpirDate <![CDATA[ > ]]> getdate() AND c.Status=1
</sql> </sql>
<select id="getCount" parameterType="com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice" resultType="int"> <select id="getCount" parameterType="com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice" resultType="int">
select count(1) FROM ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth} a select count(1) FROM ODS_OFFICE_BUILDING_PRICE_INFO_${yearMonth} a
left join DIM_OFFICE_PROJECT_BUILDING_201909 b on a.BuildingID_P=b.BuildingID_P
left join ODS_OFFICE_BUILDING_PRICE_INFO_${lastYearMonth} c on a.BuildingID_P = c.BuildingID_P
WHERE b.EffDate <![CDATA[ <= ]]> getdate() AND b.ExpirDate <![CDATA[ > ]]> getdate() AND c.Status=1
<if test="communityId != null"> <if test="communityId != null">
AND a.PROJECTID_P = #{communityId} AND a.PROJECTID_P = #{communityId}
</if> </if>
@ -107,7 +101,7 @@
<if test="status != null"> <if test="status != null">
AND a.STATUS = #{status} AND a.STATUS = #{status}
</if> </if>
order by a.ModifyDate DESC,a.BUILDINGID_P ASC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only; order by a.id desc OFFSET #{pageIndex} rows fetch next #{pageSize} rows only;
</select> </select>
<select id="getById" resultMap="OfficeBasePriceUltimateResult"> <select id="getById" resultMap="OfficeBasePriceUltimateResult">

View File

@ -0,0 +1,57 @@
package com.uvaluation.longtime;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.RuoYiApplication;
import com.ruoyi.project.data.price.domain.UltimateOfficeBasePrice;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.test.context.junit4.SpringRunner;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RuoYiApplication.class)
@DS("master")
public class SqlTests {
@Autowired
private JdbcTemplate jdbcTemplate;
@Test
@DS("compute")
public void testSpendTime() {
Integer coutn = jdbcTemplate.queryForObject("select count(1) from ODS_OFFICE_BUILDING_PRICE_INFO_202006 ",
Integer.class);
List<UltimateOfficeBasePrice> list = jdbcTemplate.query("SELECT a.ID ,a.BuildingID_P ,a.ProjectID_P ,a" +
".MainPrice ,a.MainPriceRent ,a" +
".MainPricePst " +
",a.MainPriceRentPst ,a.MainPriceType ,a.MainPriceRentType ,a.ModifyDate ,a.Status ,a.BuildingStd ,a" +
".AdjEvd ,b.AreaCoff ,b.YearCoff ,b.BuildingCoff ,b.ProjectName ,b.ProjectAddr ,b.BuildingAddr ,b" +
".County ,b.Loop ,b.Block ,b.Street ,b.Year ,b.AvgArea ,b.TotalFloorSum ,b.UpperFloorSum ,b" +
".OfficeClass ,b.Grade ,c.MainPrice AS mainPrice_1 ,c.MainPriceRent as mainPriceRent_1 , 202006 as " +
"yearMonth FROM ODS_OFFICE_BUILDING_PRICE_INFO_202006 a left join DIM_OFFICE_PROJECT_BUILDING_201909 " +
"b on a.BuildingID_P=b.BuildingID_P left join ODS_OFFICE_BUILDING_PRICE_INFO_202005 c on a" +
".BuildingID_P = c.BuildingID_P WHERE b.valid=1 AND c.Status=1 order by a.id desc OFFSET 18570 rows " +
" fetch next 10 rows only;", new TestTempMapper());
Assert.assertEquals(list.size(), 2);
}
class TestTempMapper implements RowMapper<UltimateOfficeBasePrice> {
@Override
public UltimateOfficeBasePrice mapRow(ResultSet resultSet, int rowNum) throws SQLException {
UltimateOfficeBasePrice result = new UltimateOfficeBasePrice();
result.setId(resultSet.getString("id"));
result.setBuildingId(resultSet.getString("BuildingID_P"));
return result;
}
}
}