汇总平台java后台V1版

glusterfs-api
wu ming 8 years ago
commit c66ba751a7

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>data_manager_backend</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//WebContent/WEB-INF/config/config.properties=UTF-8

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="data_manager_backend">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/test"/>
<property name="java-output-path" value="/data_manager_backend/build/classes"/>
<property name="context-root" value="/"/>
</wb-module>
</project-modules>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

@ -0,0 +1,50 @@
#=============================================================================================================
# MySQL
#=============================================================================================================
# 驱动程序
jdbc.mysql.driver=com.mysql.jdbc.Driver
# 连接url
jdbc.mysql.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
# 用户名
jdbc.mysql.username=root
# 密码
jdbc.mysql.password=root
#=============================================================================================================
# Oracle 连接配置
#=============================================================================================================
# hui用户名
gather-user-name=system
# 密码
gather-user-password=oracle
#
gather-port=1521
#
gather-service-name=orcl
#=============================================================================================================
# 数据库公共配置
#=============================================================================================================
jdbc.initialSize=5
jdbc.minIdle=5
jdbc.maxIdle=20
jdbc.maxActive=100
jdbc.maxWait=100000
jdbc.defaultAutoCommit=false
jdbc.removeAbandoned=true
jdbc.removeAbandonedTimeout=600
jdbc.testWhileIdle=true
jdbc.timeBetweenEvictionRunsMillis=60000
jdbc.numTestsPerEvictionRun=20
jdbc.minEvictableIdleTimeMillis=300000
#==============================================================================================================
#
#==============================================================================================================
table-suffix=_20152016
extract-log-localtion=/home/log/
gather-tablespace-name=TS_TTSSS
gather-tablespace-path=
gather-table-user-password=
kubeMasterUrl=http://192.168.0.116:8080/
collect-user-name=system
collect-password=oracle
collect-service-name=orcl

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- 根据需要进行添加 -->
<!-- 输出到控制台 -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="info"></param>
<layout class="org.apache.log4j.TTCCLayout">
<param name="ConversionPattern" value="TTCCLayout"></param>
</layout>
</appender>
<!-- 输出日志到文件 每天一个文件 -->
<appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Threshold" value="info"></param>
<param name="ImmediateFlush" value="true"></param>
<param name="File" value="d:/logs/dailyRollingFile.log"></param>
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'"></param>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
</layout>
</appender>
<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->
<appender name="railyFile" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="d:/logs/railyFile.log"></param>
<param name="ImmediateFlush" value="true" />
<param name="Threshold" value="info"></param>
<param name="Append" value="true"></param>
<param name="MaxFileSize" value="30KB"></param>
<param name="MaxBackupIndex" value="100"></param>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
</layout>
</appender>
<logger name="com.ibatis" additivity="true">
<level value="DEBUG" />
</logger>
<logger name="java.sql.Connection" additivity="true">
<level value="DEBUG" />
</logger>
<logger name="java.sql.Statement" additivity="true">
<level value="DEBUG" />
</logger>
<logger name="java.sql.PreparedStatement" additivity="true">
<level value="DEBUG" />
<appender-ref ref="IBatis" />
</logger>
<logger name="java.sql.ResultSet" additivity="true">
<level value="DEBUG" />
<appender-ref ref="IBatis" />
</logger>
<!-- 定义全局的日志输出级别,但是在输出目的地的配置中配置的具体输出级别优先级高于全局定义的优先级。 如果在railyFile中定义<param
name="Threshold" value="info"></param>那么将会把info以上级别的信息输出 -->
<root>
<priority value="debug" />
<appender-ref ref="console" />
<appender-ref ref="dailyRollingFile" />
<appender-ref ref="railyFile" />
<appender-ref ref="file" />
</root>
</log4j:configuration>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC
"-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
<typeAlias alias="EncodedInfoEntity" type="com.platform.entities.EncodedInfoEntity" />
<typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" />
<typeAlias alias="PagerOptions" type="com.platform.entities.PagerOptions"/>
</typeAliases>
<mappers>
<mapper resource="com/dao/mapper/data-detaisl-mapper.xml" />
</mappers>
</configuration>

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 读取db.properties中的属性值 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="WEB-INF/config/config.properties"></property>
</bean>
<!-- 连接MySQL数据库 -->
<bean id="mySQLDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.mysql.driver}" />
<property name="url" value="${jdbc.mysql.url}" />
<property name="username" value="${jdbc.mysql.username}" />
<property name="password" value="${jdbc.mysql.password}" />
</bean>
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="WEB-INF/config/mybatis-applicationConfig.xml" />
<property name="dataSource" ref="mySQLDataSource" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.platform.dao,com.dao.mapper" />
</bean>
<!-- 配置声明式事物 事物管理器 -->
<!-- 配置声明式事物 -->
<bean id="mySQLTxManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="mySQLDataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
<tx:attributes>
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="select*" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.platform.service.*.*(..))"
id="pointcut" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" />
</aop:config>
<!-- 连接oracle数据库 -->
<!-- <bean id="oracleDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
destroy-method="close"> <property name="driverClassName" value="${jdbc.oracle.driver}"
/> <property name="url" value="${jdbc.oracle.url}" /> <property name="username"
value="${jdbc.oracle.username}" /> <property name="password" value="${jdbc.oracle.password}"
/> <property name="initialSize" value="${jdbc.initialSize}" /> <property
name="minIdle" value="${jdbc.minIdle}" /> <property name="maxIdle" value="${jdbc.maxIdle}"
/> <property name="maxActive" value="${jdbc.maxActive}" /> <property name="maxWait"
value="${jdbc.maxWait}" /> <property name="defaultAutoCommit" value="${jdbc.defaultAutoCommit}"
/> <property name="removeAbandoned" value="${jdbc.removeAbandoned}" /> <property
name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}" /> <property
name="testWhileIdle" value="${jdbc.testWhileIdle}" /> <property name="timeBetweenEvictionRunsMillis"
value="${jdbc.timeBetweenEvictionRunsMillis}" /> <property name="numTestsPerEvictionRun"
value="${jdbc.numTestsPerEvictionRun}" /> <property name="minEvictableIdleTimeMillis"
value="${jdbc.minEvictableIdleTimeMillis}" /> </bean> -->
<context:component-scan base-package="com.platform.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
</beans>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.platform.controller,com.platform.test;" >
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>
</context:component-scan>
<!-- 用于将对象转换为JSON -->
<bean id="stringConverter"
class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>
<bean id="jsonConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="stringConverter" />
<ref bean="jsonConverter" />
</list>
</property>
</bean>
</beans>

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>javaBackend</display-name>
<welcome-file-list>
<welcome-file>/index.html</welcome-file>
</welcome-file-list>
<!-- 设置post请求字符编码:utf-8,get编码设置tomcat -->
<filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- spring配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/config/spring-applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.platform.utils.ConfigsLoader</listener-class>
</listener>
<!-- springmv的配置文件 -->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/springmvc-applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<!-- log4j配置文件 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/config/log4j-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- 防止Spring内存溢出监听器 -->
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
</web-app>

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.platform.dao.DataInfoDao">
<resultMap id="getEntityByText" type="DataInfoEntity">
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
<result property="regionalismCode" column="regionalism_code"
javaType="string" jdbcType="VARCHAR" />
<result property="cityName" column="city_name" javaType="string"
jdbcType="VARCHAR" />
<result property="districtName" column="district_name"
javaType="string" jdbcType="VARCHAR" />
<result property="systemCode" column="system_code" javaType="int"
jdbcType="INTEGER" />
<result property="systemName" column="system_name" javaType="string"
jdbcType="VARCHAR" />
<result property="dataType" column="data_type" javaType="string"
jdbcType="VARCHAR" />
<result property="dataVersion" column="data_version" javaType="int"
jdbcType="INTEGER" />
<result property="submittedBatch" column="submitted_batch"
javaType="string" jdbcType="VARCHAR" />
<result property="dataPath" column="data_path" javaType="string"
jdbcType="VARCHAR" />
<result property="charset" column="data_charset" javaType="string"
jdbcType="VARCHAR" />
<result property="collectingTime" column="collection_time"
javaType="string" jdbcType="DATE" />
<result property="collectorContacts" column="collector_contacts"
javaType="string" jdbcType="VARCHAR" />
<result property="collectorName" column="collector_name"
javaType="string" jdbcType="VARCHAR" />
<result property="year" column="data_year" javaType="string"
jdbcType="VARCHAR" />
</resultMap>
<sql id="conditionsFilters">
<if test="PagerOptions.dataType!=null">
and data_details.data_type=#{PagerOptions.dataType}
</if>
<if test="PagerOptions.submittedBatch!=null">
and
data_details.submitted_batch=#{PagerOptions.submittedBatch}
</if>
<if test="PagerOptions.cityName!=null">
and data_details.city_name=#{PagerOptions.cityName}
</if>
<if test="PagerOptions.districtName!=null">
and
data_details.district_name=#{PagerOptions.districtName}
</if>
<if test="PagerOptions.dataVersion !=null">
and data_details.data_version=#{PagerOptions.dataVersion}
</if>
<if test="PagerOptions.systemName !=null">
and data_details=#{PagerOptions.systemName}
</if>
<if test="PagerOptions.dataYear !=null">
and data_details.data_year=#{PagerOptions.dataYear}
</if>
</sql>
<!-- 获取数据符合筛选条件的全部记录信息 -->
<select id="getLimitedDataInfoEntities" parameterType="PagerOptions"
resultMap="getEntityByText">
SELECT
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,data_year
FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
<choose>
<when test="PagerOptions.offset > 0">
and data_details.id>= #{PagerOptions.offset}
</when>
<otherwise>
and data_details.id>=0
</otherwise>
</choose>
</where>
ORDER BY data_details.id
<if test="PagerOptions.limit > 0">
LIMIT #{PagerOptions.limit}
</if>
</if>
</select>
<!-- 获取数据符合筛选条件的总记录条数 -->
<select id="getLimitedDataCount" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT COUNT(id) FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
</where>
</if>
</select>
<!-- 获取数据查询的起始di -->
<select id="getLimitedBeginId" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT MAX(idx) FROM (SELECT id idx FROM data_details
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select>
</mapper>

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 读取db.properties中的属性值 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WebContent/WEB-INF/config/config.properties"></property>
</bean>
<!-- 连接MySQL数据库 -->
<bean id="mySQLDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.mysql.driver}" />
<property name="url" value="${jdbc.mysql.url}" />
<property name="username" value="${jdbc.mysql.username}" />
<property name="password" value="${jdbc.mysql.password}" />
</bean>
<bean id="mySQLSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="/WebContent/WEB-INF/config/mybatis-applicationConfig.xml" />
<property name="dataSource" ref="mySQLDataSource" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.platform.dao" />
</bean>
<!-- 配置声明式事物 -->
<bean id="mySQLTxManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="mySQLDataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="mySQLTxManager">
<tx:attributes>
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="get*" read-only="true" />
<tx:method name="select*" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.platform.service.*.*(..))"
id="pointcut" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" />
</aop:config>
<bean id="user" class="com.platform.test.User">
<property name="name" value="伍名" />
<property name="id" value="1" />
<property name="sex" value="男" />
</bean>
<context:component-scan base-package="com.platform.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
</beans>

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.platform.dao.DataInfoDao">
<resultMap id="getEntityByText" type="DataInfoEntity">
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
<result property="regionalismCode" column="regionalism_code"
javaType="string" jdbcType="VARCHAR" />
<result property="cityName" column="city_name" javaType="string"
jdbcType="VARCHAR" />
<result property="districtName" column="district_name"
javaType="string" jdbcType="VARCHAR" />
<result property="systemCode" column="system_code" javaType="int"
jdbcType="INTEGER" />
<result property="systemName" column="system_name" javaType="string"
jdbcType="VARCHAR" />
<result property="dataType" column="data_type" javaType="string"
jdbcType="VARCHAR" />
<result property="dataVersion" column="data_version" javaType="int"
jdbcType="INTEGER" />
<result property="submittedBatch" column="submitted_batch"
javaType="string" jdbcType="VARCHAR" />
<result property="dataPath" column="data_path" javaType="string"
jdbcType="VARCHAR" />
<result property="charset" column="data_charset" javaType="string"
jdbcType="VARCHAR" />
<result property="collectingTime" column="collection_time"
javaType="string" jdbcType="DATE" />
<result property="collectorContacts" column="collector_contacts"
javaType="string" jdbcType="VARCHAR" />
<result property="collectorName" column="collector_name"
javaType="string" jdbcType="VARCHAR" />
<result property="year" column="data_year" javaType="string"
jdbcType="VARCHAR" />
</resultMap>
<sql id="conditionsFilters">
<if test="PagerOptions.dataType!=null">
and data_details.data_type=#{PagerOptions.dataType}
</if>
<if test="PagerOptions.submittedBatch!=null">
and
data_details.submitted_batch=#{PagerOptions.submittedBatch}
</if>
<if test="PagerOptions.cityName!=null">
and data_details.city_name=#{PagerOptions.cityName}
</if>
<if test="PagerOptions.districtName!=null">
and
data_details.district_name=#{PagerOptions.districtName}
</if>
<if test="PagerOptions.dataVersion !=null">
and data_details.data_version=#{PagerOptions.dataVersion}
</if>
<if test="PagerOptions.systemName !=null">
and data_details=#{PagerOptions.systemName}
</if>
<if test="PagerOptions.dataYear !=null">
and data_details.data_year=#{PagerOptions.dataYear}
</if>
</sql>
<!-- 获取数据符合筛选条件的全部记录信息 -->
<select id="getLimitedDataInfoEntities" parameterType="PagerOptions"
resultMap="getEntityByText">
SELECT
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,data_year
FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
<choose>
<when test="PagerOptions.offset > 0">
and data_details.id>= #{PagerOptions.offset}
</when>
<otherwise>
and data_details.id>=0
</otherwise>
</choose>
</where>
ORDER BY data_details.id
<if test="PagerOptions.limit > 0">
LIMIT #{PagerOptions.limit}
</if>
</if>
</select>
<!-- 获取数据符合筛选条件的总记录条数 -->
<select id="getLimitedDataCount" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT COUNT(id) FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
</where>
</if>
</select>
<!-- 获取数据查询的起始di -->
<select id="getLimitedBeginId" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT MAX(idx) FROM (SELECT id idx FROM data_details
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select>
</mapper>

@ -0,0 +1,99 @@
package com.platform.controller;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.platform.entities.PagerOptions;
import com.platform.service.DataInfoService;
import com.platform.service.OracleStatusService;
import com.platform.utils.Configs;
import com.platform.utils.UtilsHelper;
@Controller
public class DataModelController {
@Resource(name = "dataInfoService")
private DataInfoService dfs;
public void setDfsImp(DataInfoService dfs) {
this.dfs = dfs;
}
@RequestMapping("/data.json")
@ResponseBody
public ModelMap getAllDataToJson(HttpServletRequest res,
HttpServletResponse req) {
Map<String, String[]> paramMap = res.getParameterMap();
Set<String> keySet = paramMap.keySet();
Map<String, String> params = new HashMap<String, String>();
StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
for (String str : keySet) {
String value = paramMap.get(str)[0];
if (StringUtils.isNotEmpty(value)){
params.put(str, value);
sb.append(str).append(":").append(value).append(",");
}else {
sb.append(str).append(":").append("null").append(",");
}
}
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1)
.append("}").toString());
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
.newObjAndSetAttrsByClass(PagerOptions.class, params);
return dfs.getPagerTableData(pagerOptions);
}
@RequestMapping("/delete/data")
public void deleteData(HttpServletRequest res, HttpServletResponse req) {
Map<String, String[]> paramMap = res.getParameterMap();
String[] data = paramMap.get("data");
dfs.deleteData(data);
}
@RequestMapping("/connectOracle")
public void connectOracle(HttpServletRequest res, HttpServletResponse req) {
Map<String, String[]> paramMap = res.getParameterMap();
String[] oraclesName = paramMap.get("oracleName");
if (oraclesName != null)
for (String rcName : oraclesName) {
Configs.CONSOLE_LOGGER.info("执行后台数据库连接\t" + rcName);
new OracleStatusService().connectToOracle(rcName);
}
}
@RequestMapping("/cancelOracleConection")
public void cancelOracleConnection(HttpServletRequest res,
HttpServletResponse req) {
Map<String, String[]> paramMap = res.getParameterMap();
String[] oraclesName = paramMap.get("oracleName");
String operate = paramMap.get("operation")[0];
if (null != oraclesName) {
for (String rcName : oraclesName) {
Configs.CONSOLE_LOGGER.info("取消后台数据库连接:\t" + rcName);
new OracleStatusService().cancelToOracle(rcName, operate);
}
}
}
@RequestMapping("/extractOracleData")
public void extractOracleData(HttpServletRequest res,
HttpServletResponse req) {
}
@RequestMapping("/getFolder")
public void getFolder(HttpServletRequest res, HttpServletResponse req) {
System.out.println("ooooooooo");
}
}

@ -0,0 +1,28 @@
package com.platform.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.platform.utils.Configs;
@Controller
public class DefaultController {
@RequestMapping("/")
public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){
//´¦Àí²»Æ¥ÅäµÄÇëÇó
System.out.println("index");
return new ModelAndView("index");
}
@RequestMapping("/test")
public void test(HttpServletRequest req, HttpServletResponse res){
//System.out.println(Class.class.getClass().getResource("/").getPath());
System.out.println(Configs.EXTRACT_LOG_LOCALTION);
}
}

@ -0,0 +1,20 @@
package com.platform.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.PagerOptions;
public interface DataInfoDao {
int getLimitedDataCount(@Param("PagerOptions")PagerOptions pagerOptions);
int getLimitedBeginId(@Param("PagerOptions")PagerOptions pagerOptions);
List<DataInfoEntity> getLimitedDataInfoEntities(@Param("PagerOptions")PagerOptions pagerOptions);
List<String> getIdIsExist(int parseInt);
}

@ -0,0 +1,99 @@
package com.platform.dao;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import com.platform.entities.EncodedInfoEntity;
/**
* :
*
* @author wuming
*
*/
@Repository(value = "encodeInfoDao")
public interface EncodeInfoDao {
/**
* /
*
* @param tableName
*
* @return :
*/
@Select("SELECT code, name FROM ${tableName}")
public List<EncodedInfoEntity> getAllEntityInfo(
@Param("tableName") String tableName);
/**
* /
*
* @param code
*
* @param tableName
*
* @return
*/
@Select("SELECT name FROM ${tableName} WHERE code = #{code}")
public String getEncodeNameByCode(@Param("code") String code,
@Param("tableName") String tableName);
/**
* /
*
* @param name
*
* @param tableName
*
* @return
*/
@Select("SELECT code FROM ${tableName} WHERE name = #{name}")
public List<String> getEncodeCodeByName(@Param("name") String name,
@Param("tableName") String tableName);
/**
* /
*
* @param code
*
* @param tableName
*
* @return
*/
@Update("UPDATE ${tableName} SET name = #{name} WHERE code = #{code}")
public int updateEncodeNameByCode(@Param("code") String code,
@Param("name") String name, @Param("tableName") String tableName);
/**
* /
*
* @param efe
*
* @param tableName
*
* @return
*/
@Insert("INSERT INTO ${tableName} (code, name) VALUES (#{efe.code}, #{efe.name})")
public int insertEncodeEntity(@Param("efe") EncodedInfoEntity efe,
@Param("tableName") String tableName);
/**
* /
*
* @param code
*
* @param tableName
*
* @return
*/
@Delete("DELETE FROM ${tableName} WHERE code = #{code}")
public int deleteEncodeByCode(@Param("code") String code,
@Param("tableName") String tableName);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save