1. 接入多源数据

2. 办公基价批量更新和单个更新配置
This commit is contained in:
purple
2020-05-20 18:38:04 +08:00
parent 615ecc2b5b
commit 7e7dfc556a
23 changed files with 2402 additions and 327 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@ -10,11 +11,10 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class })
public class RuoYiApplication
{
public static void main(String[] args)
{
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class,
PageHelperAutoConfiguration.class})
public class RuoYiApplication {
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +

View File

@ -7,6 +7,8 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Date;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.poi.ss.usermodel.DateUtil;
@ -17,12 +19,11 @@ import com.ruoyi.common.utils.DateUtils;
/**
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
*
*
* @author ruoyi
*/
@SuppressWarnings("rawtypes")
public class ReflectUtils
{
public class ReflectUtils {
private static final String SETTER_PREFIX = "set";
private static final String GETTER_PREFIX = "get";
@ -36,13 +37,11 @@ public class ReflectUtils
* 支持多级,如:对象名.对象名.方法
*/
@SuppressWarnings("unchecked")
public static <E> E invokeGetter(Object obj, String propertyName)
{
public static <E> E invokeGetter(Object obj, String propertyName) {
Object object = obj;
for (String name : StringUtils.split(propertyName, "."))
{
for (String name : StringUtils.split(propertyName, ".")) {
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
object = invokeMethod(object, getterMethodName, new Class[]{}, new Object[]{});
}
return (E) object;
}
@ -51,21 +50,16 @@ public class ReflectUtils
* 调用Setter方法, 仅匹配方法名。
* 支持多级,如:对象名.对象名.方法
*/
public static <E> void invokeSetter(Object obj, String propertyName, E value)
{
public static <E> void invokeSetter(Object obj, String propertyName, E value) {
Object object = obj;
String[] names = StringUtils.split(propertyName, ".");
for (int i = 0; i < names.length; i++)
{
if (i < names.length - 1)
{
for (int i = 0; i < names.length; i++) {
if (i < names.length - 1) {
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
}
else
{
object = invokeMethod(object, getterMethodName, new Class[]{}, new Object[]{});
} else {
String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
invokeMethodByName(object, setterMethodName, new Object[] { value });
invokeMethodByName(object, setterMethodName, new Object[]{value});
}
}
}
@ -74,21 +68,16 @@ public class ReflectUtils
* 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数.
*/
@SuppressWarnings("unchecked")
public static <E> E getFieldValue(final Object obj, final String fieldName)
{
public static <E> E getFieldValue(final Object obj, final String fieldName) {
Field field = getAccessibleField(obj, fieldName);
if (field == null)
{
if (field == null) {
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
return null;
}
E result = null;
try
{
try {
result = (E) field.get(obj);
}
catch (IllegalAccessException e)
{
} catch (IllegalAccessException e) {
logger.error("不可能抛出的异常{}", e.getMessage());
}
return result;
@ -97,21 +86,16 @@ public class ReflectUtils
/**
* 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数.
*/
public static <E> void setFieldValue(final Object obj, final String fieldName, final E value)
{
public static <E> void setFieldValue(final Object obj, final String fieldName, final E value) {
Field field = getAccessibleField(obj, fieldName);
if (field == null)
{
if (field == null) {
// throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
return;
}
try
{
try {
field.set(obj, value);
}
catch (IllegalAccessException e)
{
} catch (IllegalAccessException e) {
logger.error("不可能抛出的异常: {}", e.getMessage());
}
}
@ -123,24 +107,18 @@ public class ReflectUtils
*/
@SuppressWarnings("unchecked")
public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes,
final Object[] args)
{
if (obj == null || methodName == null)
{
final Object[] args) {
if (obj == null || methodName == null) {
return null;
}
Method method = getAccessibleMethod(obj, methodName, parameterTypes);
if (method == null)
{
if (method == null) {
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
return null;
}
try
{
try {
return (E) method.invoke(obj, args);
}
catch (Exception e)
{
} catch (Exception e) {
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
throw convertReflectionExceptionToUnchecked(msg, e);
}
@ -152,64 +130,51 @@ public class ReflectUtils
* 只匹配函数名,如果有多个同名函数调用第一个。
*/
@SuppressWarnings("unchecked")
public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args)
{
public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args) {
Method method = getAccessibleMethodByName(obj, methodName, args.length);
if (method == null)
{
if (method == null) {
// 如果为空不报错,直接返回空。
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
return null;
}
try
{
try {
// 类型转换(将参数数据类型转换为目标方法参数类型)
Class<?>[] cs = method.getParameterTypes();
for (int i = 0; i < cs.length; i++)
{
if (args[i] != null && !args[i].getClass().equals(cs[i]))
{
if (cs[i] == String.class)
{
for (int i = 0; i < cs.length; i++) {
if (args[i] != null && !args[i].getClass().equals(cs[i])) {
if (cs[i] == String.class) {
args[i] = Convert.toStr(args[i]);
if (StringUtils.endsWith((String) args[i], ".0"))
{
if (StringUtils.endsWith((String) args[i], ".0")) {
args[i] = StringUtils.substringBefore((String) args[i], ".0");
}
}
else if (cs[i] == Integer.class)
{
} else if (cs[i] == Integer.class) {
args[i] = Convert.toInt(args[i]);
}
else if (cs[i] == Long.class)
{
} else if (cs[i] == Long.class) {
args[i] = Convert.toLong(args[i]);
}
else if (cs[i] == Double.class)
{
} else if (cs[i] == Double.class) {
args[i] = Convert.toDouble(args[i]);
}
else if (cs[i] == Float.class)
{
} else if (cs[i] == Float.class) {
args[i] = Convert.toFloat(args[i]);
}
else if (cs[i] == Date.class)
{
if (args[i] instanceof String)
{
} else if (cs[i] == Date.class) {
if (args[i] instanceof String) {
args[i] = DateUtils.parseDate(args[i]);
}
else
{
} else {
args[i] = DateUtil.getJavaDate((Double) args[i]);
}
} else if (cs[i] == Boolean.class) {
if (null != args[i]) {
String cellValue = args[i].toString().toLowerCase();
if ("true".equals(cellValue)) {
args[i] = true;
} else if ("false".equals(cellValue)) {
args[i] = false;
}
}
}
}
}
return (E) method.invoke(obj, args);
}
catch (Exception e)
{
} catch (Exception e) {
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
throw convertReflectionExceptionToUnchecked(msg, e);
}
@ -219,24 +184,19 @@ public class ReflectUtils
* 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问.
* 如向上转型到Object仍无法找到, 返回null.
*/
public static Field getAccessibleField(final Object obj, final String fieldName)
{
public static Field getAccessibleField(final Object obj, final String fieldName) {
// 为空不报错。直接返回 null
if (obj == null)
{
if (obj == null) {
return null;
}
Validate.notBlank(fieldName, "fieldName can't be blank");
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass())
{
try
{
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass =
superClass.getSuperclass()) {
try {
Field field = superClass.getDeclaredField(fieldName);
makeAccessible(field);
return field;
}
catch (NoSuchFieldException e)
{
} catch (NoSuchFieldException e) {
continue;
}
}
@ -250,24 +210,19 @@ public class ReflectUtils
* 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
*/
public static Method getAccessibleMethod(final Object obj, final String methodName,
final Class<?>... parameterTypes)
{
final Class<?>... parameterTypes) {
// 为空不报错。直接返回 null
if (obj == null)
{
if (obj == null) {
return null;
}
Validate.notBlank(methodName, "methodName can't be blank");
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass())
{
try
{
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType =
searchType.getSuperclass()) {
try {
Method method = searchType.getDeclaredMethod(methodName, parameterTypes);
makeAccessible(method);
return method;
}
catch (NoSuchMethodException e)
{
} catch (NoSuchMethodException e) {
continue;
}
}
@ -280,21 +235,17 @@ public class ReflectUtils
* 只匹配函数名。
* 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
*/
public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum)
{
public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) {
// 为空不报错。直接返回 null
if (obj == null)
{
if (obj == null) {
return null;
}
Validate.notBlank(methodName, "methodName can't be blank");
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass())
{
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType =
searchType.getSuperclass()) {
Method[] methods = searchType.getDeclaredMethods();
for (Method method : methods)
{
if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum)
{
for (Method method : methods) {
if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) {
makeAccessible(method);
return method;
}
@ -306,11 +257,9 @@ public class ReflectUtils
/**
* 改变private/protected的方法为public尽量不调用实际改动的语句避免JDK的SecurityManager抱怨。
*/
public static void makeAccessible(Method method)
{
public static void makeAccessible(Method method) {
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
&& !method.isAccessible())
{
&& !method.isAccessible()) {
method.setAccessible(true);
}
}
@ -318,11 +267,9 @@ public class ReflectUtils
/**
* 改变private/protected的成员变量为public尽量不调用实际改动的语句避免JDK的SecurityManager抱怨。
*/
public static void makeAccessible(Field field)
{
public static void makeAccessible(Field field) {
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible())
{
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
field.setAccessible(true);
}
}
@ -332,8 +279,7 @@ public class ReflectUtils
* 如无法找到, 返回Object.class.
*/
@SuppressWarnings("unchecked")
public static <T> Class<T> getClassGenricType(final Class clazz)
{
public static <T> Class<T> getClassGenricType(final Class clazz) {
return getClassGenricType(clazz, 0);
}
@ -341,26 +287,22 @@ public class ReflectUtils
* 通过反射, 获得Class定义中声明的父类的泛型参数的类型.
* 如无法找到, 返回Object.class.
*/
public static Class getClassGenricType(final Class clazz, final int index)
{
public static Class getClassGenricType(final Class clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType))
{
if (!(genType instanceof ParameterizedType)) {
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
return Object.class;
}
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0)
{
if (index >= params.length || index < 0) {
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
+ params.length);
return Object.class;
}
if (!(params[index] instanceof Class))
{
if (!(params[index] instanceof Class)) {
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
return Object.class;
}
@ -368,18 +310,14 @@ public class ReflectUtils
return (Class) params[index];
}
public static Class<?> getUserClass(Object instance)
{
if (instance == null)
{
public static Class<?> getUserClass(Object instance) {
if (instance == null) {
throw new RuntimeException("Instance must not be null");
}
Class clazz = instance.getClass();
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR))
{
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && !Object.class.equals(superClass))
{
if (superClass != null && !Object.class.equals(superClass)) {
return superClass;
}
}
@ -390,15 +328,11 @@ public class ReflectUtils
/**
* 将反射时的checked exception转换为unchecked exception.
*/
public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e)
{
public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) {
if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException
|| e instanceof NoSuchMethodException)
{
|| e instanceof NoSuchMethodException) {
return new IllegalArgumentException(msg, e);
}
else if (e instanceof InvocationTargetException)
{
} else if (e instanceof InvocationTargetException) {
return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException());
}
return new RuntimeException(msg, e);

View File

@ -21,7 +21,6 @@ import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatPropertie
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.config.properties.DruidProperties;
import com.ruoyi.framework.datasource.DynamicDataSource;
/**

View File

@ -1,77 +1,77 @@
package com.ruoyi.framework.config.properties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource;
/**
* druid 配置属性
*
* @author ruoyi
*/
@Configuration
public class DruidProperties
{
@Value("${spring.datasource.druid.initialSize}")
private int initialSize;
@Value("${spring.datasource.druid.minIdle}")
private int minIdle;
@Value("${spring.datasource.druid.maxActive}")
private int maxActive;
@Value("${spring.datasource.druid.maxWait}")
private int maxWait;
@Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
private int timeBetweenEvictionRunsMillis;
@Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
private int minEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
private int maxEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.validationQuery}")
private String validationQuery;
@Value("${spring.datasource.druid.testWhileIdle}")
private boolean testWhileIdle;
@Value("${spring.datasource.druid.testOnBorrow}")
private boolean testOnBorrow;
@Value("${spring.datasource.druid.testOnReturn}")
private boolean testOnReturn;
public DruidDataSource dataSource(DruidDataSource datasource)
{
/** 配置初始化大小、最小、最大 */
datasource.setInitialSize(initialSize);
datasource.setMaxActive(maxActive);
datasource.setMinIdle(minIdle);
/** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait);
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
/**
* 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'。如果validationQuery为nulltestOnBorrow、testOnReturn、testWhileIdle都不会起作用。
*/
datasource.setValidationQuery(validationQuery);
/** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
datasource.setTestWhileIdle(testWhileIdle);
/** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnBorrow(testOnBorrow);
/** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnReturn(testOnReturn);
return datasource;
}
}
//package com.ruoyi.framework.config.properties;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import com.alibaba.druid.pool.DruidDataSource;
//
///**
// * druid 配置属性
// *
// * @author ruoyi
// */
//@Configuration
//public class DruidProperties
//{
// @Value("${spring.datasource.druid.initialSize}")
// private int initialSize;
//
// @Value("${spring.datasource.druid.minIdle}")
// private int minIdle;
//
// @Value("${spring.datasource.druid.maxActive}")
// private int maxActive;
//
// @Value("${spring.datasource.druid.maxWait}")
// private int maxWait;
//
// @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
// private int timeBetweenEvictionRunsMillis;
//
// @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
// private int minEvictableIdleTimeMillis;
//
// @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
// private int maxEvictableIdleTimeMillis;
//
// @Value("${spring.datasource.druid.validationQuery}")
// private String validationQuery;
//
// @Value("${spring.datasource.druid.testWhileIdle}")
// private boolean testWhileIdle;
//
// @Value("${spring.datasource.druid.testOnBorrow}")
// private boolean testOnBorrow;
//
// @Value("${spring.datasource.druid.testOnReturn}")
// private boolean testOnReturn;
//
// public DruidDataSource dataSource(DruidDataSource datasource)
// {
// /** 配置初始化大小、最小、最大 */
// datasource.setInitialSize(initialSize);
// datasource.setMaxActive(maxActive);
// datasource.setMinIdle(minIdle);
//
// /** 配置获取连接等待超时的时间 */
// datasource.setMaxWait(maxWait);
//
// /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
// datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
//
// /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
// datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
// datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
//
// /**
// * 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'。如果validationQuery为nulltestOnBorrow、testOnReturn、testWhileIdle都不会起作用。
// */
// datasource.setValidationQuery(validationQuery);
// /** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
// datasource.setTestWhileIdle(testWhileIdle);
// /** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
// datasource.setTestOnBorrow(testOnBorrow);
// /** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
// datasource.setTestOnReturn(testOnReturn);
// return datasource;
// }
//}

View File

@ -0,0 +1,76 @@
//package com.ruoyi.framework.datasource;
//
//
//import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
//import com.baomidou.dynamic.datasource.provider.YmlDynamicDataSourceProvider;
//import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
//import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidDynamicDataSourceConfiguration;
//import com.github.pagehelper.PageInterceptor;
//import org.apache.ibatis.plugin.Interceptor;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.autoconfigure.AutoConfigureAfter;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.annotation.PostConstruct;
//import javax.sql.DataSource;
//import java.util.List;
//import java.util.Properties;
//
//@Configuration
//@ConditionalOnBean(SqlSessionFactory.class)
////@AutoConfigureAfter(MybatisAutoConfiguration.class)
//@AutoConfigureAfter(DynamicDataSourceAutoConfiguration.class)
//public class DynamicDataSourcePagerDialectConfig {
// @Autowired
// private List<SqlSessionFactory> sqlSessionFactoryList;
//// @Autowired
//// private DynamicDataSourceProvider dynamicDataSourceProvider;
//
// @PostConstruct
// public void addPageInterceptor() {
//
// sqlSessionFactoryList.forEach(x->{
// System.out.println("");
// });
//
//// dynamicDataSourceProvider.loadDataSources().forEach((k, v) -> {
//// PageInterceptor interceptor = new PageInterceptor();
//// Properties properties = new Properties();
////
//// });
//
// //先把一般方式配置的属性放进去
//// properties.putAll(pageHelperProperties());
// //在把特殊配置放进去由于close-conn 利用上面方式时,属性名就是 close-conn 而不是 closeConn所以需要额外的一步
//// properties.putAll(this.properties.getProperties());
//// interceptor.setProperties(properties);
//// for (SqlSessionFactory sqlSessionFactory : sqlSessionFactoryList) {
//// sqlSessionFactory.getConfiguration().addInterceptor(interceptor);
//// }
// }
//
//// @Bean(name = "mssqlSessionFactory")
//// public SqlSessionFactory mssqlSessionFactory(@Qualifier("mssqlDataSource") DataSource dataSource)
//// throws Exception {
//// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
//// //分页插件
//// Interceptor interceptor = new PageInterceptor();
//// Properties properties = new Properties();
//// //数据库
//// properties.setProperty("helperDialect", "sqlserver2012");
//// //是否分页合理化
//// properties.setProperty("reasonable", "false");
////
//// interceptor.setProperties(properties);
////
//// sessionFactory.setPlugins(new Interceptor[] {interceptor});
//// sessionFactory.setDataSource(dataSource);
//// return sessionFactory.getObject();
//// }
//}

View File

@ -1,86 +1,88 @@
package com.ruoyi.framework.web.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public class BaseController
{
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
/**
* 将前台传递过来的日期格式的字符串自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder)
{
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
{
@Override
public void setAsText(String text)
{
setValue(DateUtils.parseDate(text));
}
});
}
/**
* 设置请求分页数据
*/
protected void startPage()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
}
package com.ruoyi.framework.web.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public class BaseController {
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
/**
* 将前台传递过来的日期格式的字符串自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder) {
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
setValue(DateUtils.parseDate(text));
}
});
}
/**
* 设置请求分页数据
*/
protected void startPage() {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfo getDataTable(List<?> list) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
protected TableDataInfo getDataTable(List<?> list, int total) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(total);
return rspData;
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows) {
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.project.data.cases.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/data/cases")
public class CasesController {
/**
* 原始办公挂牌案例
*/
public void originalOfficeOpeningCase() {
}
/**
* 原始住宅销售挂牌案例
*/
public void originalResidenceSalesOpeningCase(){
}
/**
* 原始住宅销售挂牌案例
*/
public void originalResidenceSalesClosingCase(){
}
}

View File

@ -0,0 +1,115 @@
package com.ruoyi.project.data.price.compute.controller;
import java.util.List;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
import com.ruoyi.project.data.price.compute.service.IOfficeBasePriceUltimateService;
import com.ruoyi.project.system.domain.SysUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 【请填写功能名称】Controller
*
* @author ruoyi
* @date 2020-05-20
*/
@RestController
@RequestMapping("/data/compute/price/office")
public class OfficeBasePriceUltimateController extends BaseController {
@Autowired
private IOfficeBasePriceUltimateService officeBasePriceUltimateService;
@Autowired
private TokenService tokenService;
/**
* 查询【请填写功能名称】列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(OfficeBasePriceUltimate officeBasePriceUltimate) {
int pageIndex = ServletUtils.getParameterToInt(TableSupport.PAGE_NUM);
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
officeBasePriceUltimate.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
officeBasePriceUltimate.setPageSize(pageSize);
List<OfficeBasePriceUltimate> list =
officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
return getDataTable(list, total);
}
/**
* 获取【请填写功能名称】详细信息
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(officeBasePriceUltimateService.selectOfficeBasePriceUltimateById(id));
}
/**
* 修改【请填写功能名称】
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "办公基价", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OfficeBasePriceUltimate officeBasePriceUltimate) {
return toAjax(officeBasePriceUltimateService.updateOfficeBasePriceUltimate(officeBasePriceUltimate));
}
/**
* 导出【请填写功能名称】列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "办公基价", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(OfficeBasePriceUltimate officeBasePriceUltimate) {
int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
officeBasePriceUltimate.setPageIndex(0);
officeBasePriceUltimate.setPageSize(total);
List<OfficeBasePriceUltimate> list =
officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
ExcelUtil<OfficeBasePriceUltimate> util = new ExcelUtil<OfficeBasePriceUltimate>(OfficeBasePriceUltimate.class);
return util.exportExcel(list, "办公基价");
}
/**
* 办公基价导入
* @param file
* @return
* @throws Exception
*/
@Log(title = "办公基价", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception {
ExcelUtil<OfficeBasePriceUltimate> util = new ExcelUtil<>(OfficeBasePriceUltimate.class);
List<OfficeBasePriceUltimate> officeBasePriceUltimates = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername();
String message = officeBasePriceUltimateService.batchImport(officeBasePriceUltimates, operName);
return AjaxResult.success(message);
}
}

View File

@ -0,0 +1,178 @@
package com.ruoyi.project.data.price.compute.domain;
import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date;
/**
* 【请填写功能名称】对象 office_base_price_ultimate
*
* @author ruoyi
* @date 2020-05-20
*/
public class OfficeBasePriceUltimate extends BaseEntity {
private Integer pageIndex;
private Integer pageSize;
@Excel(name = "ID")
private String id;
@JSONField(serialize = false)
private Integer yearMonth;
@Excel(name = "楼栋ID")
private String buildingId;
@Excel(name = "小区ID")
private String communityId;
@Excel(name = "主力基价")
private String mainPrice;
@Excel(name = "主力租金")
private String mainPriceRent;
@Excel(name = "主力基价涨跌幅")
private String mainPricePst;
@Excel(name = "主力租金涨跌幅")
private String mainPriceRentPst;
@Excel(name = "主力基价类型")
private String mainPriceType;
@Excel(name = "主力租金类型")
private String mainPriceRentType;
@Excel(name = "更新日期")
private Date updateDate;
@Excel(name = "状态")
private Boolean status;
@Excel(name = "是否标准楼栋")
private Boolean isStandardBuilding;
@Excel(name = "更改价格说明")
private String adjustPriceComment;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getYearMonth() {
return yearMonth;
}
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getMainPrice() {
return mainPrice;
}
public void setMainPrice(String mainPrice) {
this.mainPrice = mainPrice;
}
public String getMainPriceRent() {
return mainPriceRent;
}
public void setMainPriceRent(String mainPriceRent) {
this.mainPriceRent = mainPriceRent;
}
public String getMainPricePst() {
return mainPricePst;
}
public void setMainPricePst(String mainPricePst) {
this.mainPricePst = mainPricePst;
}
public String getMainPriceRentPst() {
return mainPriceRentPst;
}
public void setMainPriceRentPst(String mainPriceRentPst) {
this.mainPriceRentPst = mainPriceRentPst;
}
public String getMainPriceType() {
return mainPriceType;
}
public void setMainPriceType(String mainPriceType) {
this.mainPriceType = mainPriceType;
}
public String getMainPriceRentType() {
return mainPriceRentType;
}
public void setMainPriceRentType(String mainPriceRentType) {
this.mainPriceRentType = mainPriceRentType;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public Boolean getStandardBuilding() {
return isStandardBuilding;
}
public void setStandardBuilding(Boolean standardBuilding) {
isStandardBuilding = standardBuilding;
}
public String getAdjustPriceComment() {
return adjustPriceComment;
}
public void setAdjustPriceComment(String adjustPriceComment) {
this.adjustPriceComment = adjustPriceComment;
}
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -0,0 +1,46 @@
package com.ruoyi.project.data.price.compute.mapper;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
/**
* 【请填写功能名称】Mapper接口
*
* @author ruoyi
* @date 2020-05-20
*/
@DS("teemlink")
public interface OfficeBasePriceUltimateMapper
{
/**
*
* @param id
* @return
*/
OfficeBasePriceUltimate selectOfficeBasePriceUltimateById(String id);
/**
* 查询【请填写功能名称】列表
*
* @param officeBasePriceUltimate 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
List<OfficeBasePriceUltimate> selectOfficeBasePriceUltimateList(OfficeBasePriceUltimate officeBasePriceUltimate);
/**
* 求和
* @param officeBasePriceUltimate
* @return
*/
Integer selectOfficeBasePriceUltimateListCount(OfficeBasePriceUltimate officeBasePriceUltimate);
/**
* 更新
* @param officeBasePriceUltimate
* @return
*/
int updateOfficeBasePriceUltimate(OfficeBasePriceUltimate officeBasePriceUltimate);
}

View File

@ -0,0 +1,41 @@
package com.ruoyi.project.data.price.compute.service;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
import com.ruoyi.project.system.domain.SysUser;
import java.util.List;
/**
* 【请填写功能名称】Service接口
*
* @author ruoyi
* @date 2020-05-20
*/
public interface IOfficeBasePriceUltimateService {
/**
* 查询【请填写功能名称】列表
*
* @param officeBasePriceUltimate 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
List<OfficeBasePriceUltimate> selectOfficeBasePriceUltimateList(OfficeBasePriceUltimate officeBasePriceUltimate);
int selectOfficeBasePriceUltimateListCount(OfficeBasePriceUltimate officeBasePriceUltimate);
OfficeBasePriceUltimate selectOfficeBasePriceUltimateById(String id);
int updateOfficeBasePriceUltimate(OfficeBasePriceUltimate officeBasePriceUltimate);
/**
*
* @param officeBasePriceUltimates
* @param operName
* @return
*/
String batchImport(List<OfficeBasePriceUltimate> officeBasePriceUltimates,String operName);
}

View File

@ -0,0 +1,104 @@
package com.ruoyi.project.data.price.compute.service.impl;
import java.util.List;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
import com.ruoyi.project.data.price.compute.mapper.OfficeBasePriceUltimateMapper;
import com.ruoyi.project.data.price.compute.service.IOfficeBasePriceUltimateService;
import com.ruoyi.project.system.service.impl.SysUserServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 【请填写功能名称】Service业务层处理
*
* @author ruoyi
* @date 2020-05-20
*/
@Service
public class OfficeBasePriceUltimateServiceImpl implements IOfficeBasePriceUltimateService {
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Autowired
private OfficeBasePriceUltimateMapper officeBasePriceUltimateMapper;
/**
* 查询【请填写功能名称】列表
*
* @param officeBasePriceUltimate 【请填写功能名称】
* @return 【请填写功能名称】
*/
@Override
public List<OfficeBasePriceUltimate> selectOfficeBasePriceUltimateList(OfficeBasePriceUltimate officeBasePriceUltimate) {
return officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
}
@Override
public int selectOfficeBasePriceUltimateListCount(OfficeBasePriceUltimate officeBasePriceUltimate) {
return officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
}
@Override
public OfficeBasePriceUltimate selectOfficeBasePriceUltimateById(String id) {
return officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateById(id);
}
@Override
public int updateOfficeBasePriceUltimate(OfficeBasePriceUltimate officeBasePriceUltimate) {
return officeBasePriceUltimateMapper.updateOfficeBasePriceUltimate(officeBasePriceUltimate);
}
@Override
public String batchImport(List<OfficeBasePriceUltimate> officeBasePriceUltimates, String operName) {
if (StringUtils.isNull(officeBasePriceUltimates) || officeBasePriceUltimates.size() == 0)
{
throw new CustomException("导入办公数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (OfficeBasePriceUltimate officeBasePriceUltimate : officeBasePriceUltimates)
{
try
{
// 验证是否存在这个用户
OfficeBasePriceUltimate officeBasePriceUltimateInDb = officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateById(officeBasePriceUltimate.getId());
if (StringUtils.isNotNull(officeBasePriceUltimateInDb))
{
this.updateOfficeBasePriceUltimate(officeBasePriceUltimate);
successNum++;
successMsg.append("<br/>" + successNum + "、ID= " + officeBasePriceUltimate.getId() + " 更新成功");
}
else
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、ID= " + officeBasePriceUltimate.getId() + " 已存在");
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、ID= " + officeBasePriceUltimate.getId() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new CustomException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}

View File

@ -0,0 +1,4 @@
package com.ruoyi.project.data.price.release.controller;
public class HomeController {
}

View File

@ -27,7 +27,7 @@ spring:
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
@ -43,7 +43,7 @@ spring:
wall:
config:
multi-statement-allow: true
primary: master
datasource:
# 主库数据源
master:
@ -52,12 +52,12 @@ spring:
username: root
password: LOLm2dI2UQF#RxOf
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 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

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.data.price.compute.mapper.OfficeBasePriceUltimateMapper">
<resultMap type="com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate"
id="OfficeBasePriceUltimateResult">
<result property="id" column="id"/>
<result property="yearMonth" column="ITEM_YEARMONTH"/>
<result property="buildingId" column="ITEM_BUILDINGID_P"/>
<result property="communityId" column="ITEM_PROJECTID_P"/>
<result property="mainPrice" column="ITEM_MAINPRICE"/>
<result property="mainPriceRent" column="ITEM_MAINPRICERENT"/>
<result property="mainPricePst" column="ITEM_MAINPRICEPST"/>
<result property="mainPriceRentPst" column="ITEM_MAINPRICERENTPST"/>
<result property="mainPriceType" column="ITEM_MAINPRICETYPE"/>
<result property="mainPriceRentType" column="ITEM_MAINPRICERENTTYPE"/>
<result property="updateDate" column="ITEM_MODIFYDATE"/>
<result property="status" column="ITEM_STATUS"/>
<result property="isStandardBuilding" column="ITEM_BUILDINGSTD"/>
<result property="adjustPriceComment" column="ITEM_ADJEVD"/>
</resultMap>
<sql id="selectOfficeBasePriceUltimateVo">
select ITEM_YEARMONTH,ITEM_BUILDINGID,ITEM_UNIFIEDID,ITEM_PROJECTID,ITEM_BUILDINGID_P,ITEM_PROJECTID_P,ITEM_MAINPRICE,ITEM_MAINPRICERENT,ITEM_MAINPRICEPST,ITEM_MAINPRICERENTPST,ITEM_MAINPRICETYPE,ITEM_MAINPRICERENTTYPE,ITEM_MODIFYDATE,ITEM_STATUS,ITEM_BUILDINGSTD,ITEM_ADJEVD,ID from TLK_计价办公核准基价
</sql>
<select id="selectOfficeBasePriceUltimateListCount" parameterType="OfficeBasePriceUltimate" resultType="int">
select count(1) from TLK_计价办公核准基价
<where>
<if test="yearMonth != null">
AND ITEM_YEARMONTH = #{yearMonth}
</if>
<if test="communityId != null">
AND ITEM_PROJECTID_P = #{communityId}
</if>
<if test="buildingId != null">
AND ITEM_BUILDINGID_P = #{buildingId}
</if>
<if test="status != null">
AND ITEM_STATUS = #{status}
</if>
</where>
</select>
<select id="selectOfficeBasePriceUltimateList" parameterType="OfficeBasePriceUltimate"
resultMap="OfficeBasePriceUltimateResult">
<include refid="selectOfficeBasePriceUltimateVo"/>
<where>
<if test="yearMonth != null">
AND ITEM_YEARMONTH = #{yearMonth}
</if>
<if test="communityId != null">
AND ITEM_PROJECTID_P = #{communityId}
</if>
<if test="buildingId != null">
AND ITEM_BUILDINGID_P = #{buildingId}
</if>
</where>
order by ITEM_YEARMONTH DESC,ID DESC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only;
</select>
<select id="selectOfficeBasePriceUltimateById" parameterType="String" resultMap="OfficeBasePriceUltimateResult">
<include refid="selectOfficeBasePriceUltimateVo"/>
where id = #{id}
</select>
<!-- <insert id="insertOfficeBasePriceUltimate" parameterType="OfficeBasePriceUltimate" useGeneratedKeys="true"-->
<!-- keyProperty="id">-->
<!-- insert into office_base_price_ultimate-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- </trim>-->
<!-- </insert>-->
<update id="updateOfficeBasePriceUltimate" parameterType="OfficeBasePriceUltimate">
update TLK_计价办公核准基价 set ITEM_YEARMONTH=ITEM_YEARMONTH
<trim prefix="SET" suffixOverrides=",">
</trim>
where id = #{id}
</update>
<!-- <delete id="deleteOfficeBasePriceUltimateById" parameterType="Integer">-->
<!-- delete from office_base_price_ultimate where id = #{id}-->
<!-- </delete>-->
<!-- <delete id="deleteOfficeBasePriceUltimateByIds" parameterType="String">-->
<!-- delete from office_base_price_ultimate where id in-->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
</mapper>