commit 16299374c600041ce0923351f991f70fbe935e76 Author: wu ming <569287825@qq.com> Date: Thu Aug 11 11:16:16 2016 +0800 java-console_v1.0 diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..a7e1c183 --- /dev/null +++ b/.classpath @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 00000000..68842c0a --- /dev/null +++ b/.project @@ -0,0 +1,36 @@ + + + data-aggregation-platform + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 00000000..3a28de0c --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..d1ff3f7e --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//WebContent/WEB-INF/config/config.properties=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..f42de363 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 00000000..b6c6e547 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..6f8fb94f --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 00000000..3bd5d0a4 --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 00000000..05bd71b6 --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/WebContent/META-INF/MANIFEST.MF b/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 00000000..254272e1 --- /dev/null +++ b/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/WebContent/WEB-INF/config/config.properties b/WebContent/WEB-INF/config/config.properties new file mode 100644 index 00000000..a4e32338 --- /dev/null +++ b/WebContent/WEB-INF/config/config.properties @@ -0,0 +1,39 @@ +#============================================================================================================= +# 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 连接配置 +#============================================================================================================= +# 驱动程序 +jdbc.oracle.driver=oracle.jdbc.driver.OracleDriver +# 连接url +jdbc.oracle.url=jdbc:oracle:thin:@localhost:1521:orcl; +# 用户名 +jdbc.oracle.username=system +# 密码 +jdbc.oracle.password=oracle + +#============================================================================================================= +# 数据库公共配置 +#============================================================================================================= +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 \ No newline at end of file diff --git a/WebContent/WEB-INF/config/log4j-config.xml b/WebContent/WEB-INF/config/log4j-config.xml new file mode 100644 index 00000000..1b1f2a1e --- /dev/null +++ b/WebContent/WEB-INF/config/log4j-config.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/config/mybatis-applicationConfig.xml b/WebContent/WEB-INF/config/mybatis-applicationConfig.xml new file mode 100644 index 00000000..ed1d5322 --- /dev/null +++ b/WebContent/WEB-INF/config/mybatis-applicationConfig.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/config/spring-applicationContext.xml b/WebContent/WEB-INF/config/spring-applicationContext.xml new file mode 100644 index 00000000..4eba9ce3 --- /dev/null +++ b/WebContent/WEB-INF/config/spring-applicationContext.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/config/springmvc-applicationContext.xml b/WebContent/WEB-INF/config/springmvc-applicationContext.xml new file mode 100644 index 00000000..2d119a71 --- /dev/null +++ b/WebContent/WEB-INF/config/springmvc-applicationContext.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + application/json;charset=UTF-8 + text/html;charset=UTF-8 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/lib/aspectjweaver-1.8.9.jar b/WebContent/WEB-INF/lib/aspectjweaver-1.8.9.jar new file mode 100644 index 00000000..87f5c8f3 Binary files /dev/null and b/WebContent/WEB-INF/lib/aspectjweaver-1.8.9.jar differ diff --git a/WebContent/WEB-INF/lib/commons-logging-1.2.jar b/WebContent/WEB-INF/lib/commons-logging-1.2.jar new file mode 100644 index 00000000..93a3b9f6 Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-logging-1.2.jar differ diff --git a/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar b/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar new file mode 100644 index 00000000..9d5fe16e Binary files /dev/null and b/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-annotations-2.7.3.jar b/WebContent/WEB-INF/lib/jackson-annotations-2.7.3.jar new file mode 100644 index 00000000..ced6d103 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-annotations-2.7.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-core-2.7.3.jar b/WebContent/WEB-INF/lib/jackson-core-2.7.3.jar new file mode 100644 index 00000000..9b20cee6 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-core-2.7.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-databind-2.7.3.jar b/WebContent/WEB-INF/lib/jackson-databind-2.7.3.jar new file mode 100644 index 00000000..29d90afe Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-databind-2.7.3.jar differ diff --git a/WebContent/WEB-INF/lib/junit-3.8.1.jar b/WebContent/WEB-INF/lib/junit-3.8.1.jar new file mode 100644 index 00000000..674d71e8 Binary files /dev/null and b/WebContent/WEB-INF/lib/junit-3.8.1.jar differ diff --git a/WebContent/WEB-INF/lib/junit-4.12.jar b/WebContent/WEB-INF/lib/junit-4.12.jar new file mode 100644 index 00000000..3a7fc266 Binary files /dev/null and b/WebContent/WEB-INF/lib/junit-4.12.jar differ diff --git a/WebContent/WEB-INF/lib/log4j-1.2.17.jar b/WebContent/WEB-INF/lib/log4j-1.2.17.jar new file mode 100644 index 00000000..1d425cf7 Binary files /dev/null and b/WebContent/WEB-INF/lib/log4j-1.2.17.jar differ diff --git a/WebContent/WEB-INF/lib/mybatis-3.2.8.jar b/WebContent/WEB-INF/lib/mybatis-3.2.8.jar new file mode 100644 index 00000000..99cdd68b Binary files /dev/null and b/WebContent/WEB-INF/lib/mybatis-3.2.8.jar differ diff --git a/WebContent/WEB-INF/lib/mybatis-spring-1.2.1.jar b/WebContent/WEB-INF/lib/mybatis-spring-1.2.1.jar new file mode 100644 index 00000000..95c031f7 Binary files /dev/null and b/WebContent/WEB-INF/lib/mybatis-spring-1.2.1.jar differ diff --git a/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar new file mode 100644 index 00000000..be09493c Binary files /dev/null and b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar differ diff --git a/WebContent/WEB-INF/lib/spring-aop-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-aop-4.3.1.RELEASE.jar new file mode 100644 index 00000000..d4903262 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-aop-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-aspects-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-aspects-4.3.1.RELEASE.jar new file mode 100644 index 00000000..b92dc264 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-aspects-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-beans-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-beans-4.3.1.RELEASE.jar new file mode 100644 index 00000000..062a39c9 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-beans-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-context-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-context-4.3.1.RELEASE.jar new file mode 100644 index 00000000..8c3f5f49 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-context-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-context-support-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-context-support-4.3.1.RELEASE.jar new file mode 100644 index 00000000..a0509dbb Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-context-support-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-core-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-core-4.3.1.RELEASE.jar new file mode 100644 index 00000000..fe9bd597 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-core-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-expression-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-expression-4.3.1.RELEASE.jar new file mode 100644 index 00000000..67076961 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-expression-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar b/WebContent/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar new file mode 100644 index 00000000..5fda62e8 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar b/WebContent/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar new file mode 100644 index 00000000..1688cf74 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-test-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-test-4.3.1.RELEASE.jar new file mode 100644 index 00000000..dba50419 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-test-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar b/WebContent/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar new file mode 100644 index 00000000..47542e4e Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-web-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-web-4.3.1.RELEASE.jar new file mode 100644 index 00000000..26273ec9 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-web-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-webmvc-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-webmvc-4.3.1.RELEASE.jar new file mode 100644 index 00000000..1bec7712 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-webmvc-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml new file mode 100644 index 00000000..3cefa1c6 --- /dev/null +++ b/WebContent/WEB-INF/web.xml @@ -0,0 +1,61 @@ + + + MyFirstTest + + /index.html + + + + CharacterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + + CharacterEncodingFilter + /* + + + + contextConfigLocation + WEB-INF/config/spring-applicationContext.xml + + + org.springframework.web.context.ContextLoaderListener + + + + + springmvc + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/config/springmvc-applicationContext.xml + + 1 + true + + + springmvc + /* + + + + + log4jConfigLocation + /WEB-INF/config/log4j-config.xml + + + org.springframework.web.util.Log4jConfigListener + + + + + org.springframework.web.util.IntrospectorCleanupListener + + \ No newline at end of file diff --git a/WebContent/index.html b/WebContent/index.html new file mode 100644 index 00000000..8acbab02 --- /dev/null +++ b/WebContent/index.html @@ -0,0 +1,23 @@ + + + + +Insert title here + + + + +
+ name: + +
+ + \ No newline at end of file diff --git a/build/classes/com/platform/controller/DefaultController.class b/build/classes/com/platform/controller/DefaultController.class new file mode 100644 index 00000000..0884c867 Binary files /dev/null and b/build/classes/com/platform/controller/DefaultController.class differ diff --git a/build/classes/com/platform/dao/EncodeInfoDao.class b/build/classes/com/platform/dao/EncodeInfoDao.class new file mode 100644 index 00000000..f6b44c7b Binary files /dev/null and b/build/classes/com/platform/dao/EncodeInfoDao.class differ diff --git a/build/classes/com/platform/entities/EncodedInfoEntity.class b/build/classes/com/platform/entities/EncodedInfoEntity.class new file mode 100644 index 00000000..ca2439bd Binary files /dev/null and b/build/classes/com/platform/entities/EncodedInfoEntity.class differ diff --git a/build/classes/com/platform/kubernetes/package-info.class b/build/classes/com/platform/kubernetes/package-info.class new file mode 100644 index 00000000..4f0993c8 Binary files /dev/null and b/build/classes/com/platform/kubernetes/package-info.class differ diff --git a/build/classes/com/platform/service/EncodeInfoService.class b/build/classes/com/platform/service/EncodeInfoService.class new file mode 100644 index 00000000..4e7ea229 Binary files /dev/null and b/build/classes/com/platform/service/EncodeInfoService.class differ diff --git a/build/classes/com/platform/service/EncodeInfoServiceImpl.class b/build/classes/com/platform/service/EncodeInfoServiceImpl.class new file mode 100644 index 00000000..e057d40e Binary files /dev/null and b/build/classes/com/platform/service/EncodeInfoServiceImpl.class differ diff --git a/build/classes/com/platform/test/SMBasedTest.class b/build/classes/com/platform/test/SMBasedTest.class new file mode 100644 index 00000000..e64ea7a7 Binary files /dev/null and b/build/classes/com/platform/test/SMBasedTest.class differ diff --git a/build/classes/com/platform/test/TestController.class b/build/classes/com/platform/test/TestController.class new file mode 100644 index 00000000..d61e98fd Binary files /dev/null and b/build/classes/com/platform/test/TestController.class differ diff --git a/build/classes/com/platform/test/TestEncodeInfoDao.class b/build/classes/com/platform/test/TestEncodeInfoDao.class new file mode 100644 index 00000000..bdfb87d9 Binary files /dev/null and b/build/classes/com/platform/test/TestEncodeInfoDao.class differ diff --git a/build/classes/com/platform/test/TestEncodeService.class b/build/classes/com/platform/test/TestEncodeService.class new file mode 100644 index 00000000..c4656f12 Binary files /dev/null and b/build/classes/com/platform/test/TestEncodeService.class differ diff --git a/build/classes/com/platform/test/User.class b/build/classes/com/platform/test/User.class new file mode 100644 index 00000000..a38adbfb Binary files /dev/null and b/build/classes/com/platform/test/User.class differ diff --git a/build/classes/spring-applicationContext-test.xml b/build/classes/spring-applicationContext-test.xml new file mode 100644 index 00000000..2bdabb7c --- /dev/null +++ b/build/classes/spring-applicationContext-test.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/platform/controller/DefaultController.java b/src/com/platform/controller/DefaultController.java new file mode 100644 index 00000000..113dfda3 --- /dev/null +++ b/src/com/platform/controller/DefaultController.java @@ -0,0 +1,18 @@ +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; + +@Controller +public class DefaultController { + @RequestMapping("/") + public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){ + //ƥ + System.out.println("index"); + return new ModelAndView("index"); + } +} diff --git a/src/com/platform/dao/EncodeInfoDao.java b/src/com/platform/dao/EncodeInfoDao.java new file mode 100644 index 00000000..69bfd819 --- /dev/null +++ b/src/com/platform/dao/EncodeInfoDao.java @@ -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 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 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); + +} \ No newline at end of file diff --git a/src/com/platform/entities/EncodedInfoEntity.java b/src/com/platform/entities/EncodedInfoEntity.java new file mode 100644 index 00000000..fa6b934c --- /dev/null +++ b/src/com/platform/entities/EncodedInfoEntity.java @@ -0,0 +1,41 @@ +package com.platform.entities; + +/** + * + * Ϣʵ + * /ϵͳϢ + * @author wuming + * + */ +public class EncodedInfoEntity { + private String name; // + private String code; // + + public EncodedInfoEntity() {} + + public EncodedInfoEntity(String name, String code) { + this.name = name; + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + @Override + public String toString(){ + return "code=" + this.code + ", name=" + this.name; + } +} diff --git a/src/com/platform/kubernetes/package-info.java b/src/com/platform/kubernetes/package-info.java new file mode 100644 index 00000000..a18279c9 --- /dev/null +++ b/src/com/platform/kubernetes/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author wuming + * + */ +package com.platform.kubernetes; \ No newline at end of file diff --git a/src/com/platform/service/EncodeInfoService.java b/src/com/platform/service/EncodeInfoService.java new file mode 100644 index 00000000..8ef13844 --- /dev/null +++ b/src/com/platform/service/EncodeInfoService.java @@ -0,0 +1,20 @@ +package com.platform.service; + +import java.util.List; + +import com.platform.entities.EncodedInfoEntity; + +/** + * ݿҵ߼ӿ + * + * @author wuming + * + */ +public interface EncodeInfoService { + + public List getAllEncodeInfo(String tableName); + + public int deleteEncodeByCode(String code, String tableName); + + public String getEncodeNameByCode(String code, String name); +} diff --git a/src/com/platform/service/EncodeInfoServiceImpl.java b/src/com/platform/service/EncodeInfoServiceImpl.java new file mode 100644 index 00000000..06770367 --- /dev/null +++ b/src/com/platform/service/EncodeInfoServiceImpl.java @@ -0,0 +1,52 @@ +package com.platform.service; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.platform.dao.EncodeInfoDao; +import com.platform.entities.EncodedInfoEntity; + +/** + * ҵ߼ľʵ + * + * @author wuming + * + */ +@Service("encodeInfoService") +public class EncodeInfoServiceImpl implements EncodeInfoService { + + @Resource(name = "encodeInfoDao") + private EncodeInfoDao eiDao; + + public void setEiDao(EncodeInfoDao eiDao) { + this.eiDao = eiDao; + } + + /** + * ݴݵtableNameȡӦʵϢ/ϵͳ + */ + @Override + public List getAllEncodeInfo(String tableName) { + return eiDao.getAllEntityInfo(tableName); + + } + + /** + * + */ + @Override + public int deleteEncodeByCode(String code, String tableName) { + // TODO Auto-generated method stub + int cursor = eiDao.deleteEncodeByCode(code, tableName); + cursor = cursor / 0; + return cursor; + } + + @Override + public String getEncodeNameByCode(String code, String tableName) { + return eiDao.getEncodeNameByCode(code, tableName); + } +} diff --git a/test/com/platform/test/SMBasedTest.java b/test/com/platform/test/SMBasedTest.java new file mode 100644 index 00000000..b0a77f9f --- /dev/null +++ b/test/com/platform/test/SMBasedTest.java @@ -0,0 +1,15 @@ +package com.platform.test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +public class SMBasedTest { + + public ApplicationContext applicationContext; + + public SMBasedTest() { + applicationContext = new FileSystemXmlApplicationContext( + "test/spring-applicationContext-test.xml"); + } + +} diff --git a/test/com/platform/test/TestController.java b/test/com/platform/test/TestController.java new file mode 100644 index 00000000..4b19c6ca --- /dev/null +++ b/test/com/platform/test/TestController.java @@ -0,0 +1,45 @@ +package com.platform.test; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; +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.bind.annotation.ResponseBody; + +import com.platform.service.EncodeInfoService; + +@Controller +public class TestController { + //private static Logger logger = Logger.getLogger(TestController.class); + @Resource(name = "encodeInfoService") + private EncodeInfoService eis; + + public void setEis(EncodeInfoService eis) { + this.eis = eis; + } + + @RequestMapping("/hello") + public String hello(String name, HttpServletResponse res) { + System.out.println(name); + return "index.html"; + } + + @RequestMapping("/json") + @ResponseBody + public List getJson(HttpServletRequest res, HttpServletResponse req) { + List list = new ArrayList(); + list.add(new User("lisi", 1, "")); + list.add(new User("zhansan", 2, "")); + return list; + } + + @RequestMapping("log") + public void testLog(HttpServletResponse res) { + System.out.println(eis.getEncodeNameByCode("1", "system_info")); + } +} diff --git a/test/com/platform/test/TestEncodeInfoDao.java b/test/com/platform/test/TestEncodeInfoDao.java new file mode 100644 index 00000000..8e729bf5 --- /dev/null +++ b/test/com/platform/test/TestEncodeInfoDao.java @@ -0,0 +1,64 @@ +package com.platform.test; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.platform.dao.EncodeInfoDao; +import com.platform.entities.EncodedInfoEntity; + +public class TestEncodeInfoDao extends SMBasedTest { + + private EncodeInfoDao eiDao; + private String testTableName; + + @Before + public void initBeforeFunction() { + eiDao = (EncodeInfoDao) this.applicationContext + .getBean("encodeInfoDao"); + testTableName = "system_info"; + } + + @Test + public void testGetAllEntityInfo() { + List allEntities = eiDao + .getAllEntityInfo(testTableName); + System.out.println(allEntities); + Assert.assertTrue(allEntities.size() > 0); + } + + @Test + public void testGetEncodeNameByCode() { + String result = eiDao.getEncodeNameByCode("1", testTableName); + Assert.assertTrue(result.equals("Ԥִϵͳ")); + } + + @Test + public void testGetEncodeCodeByName() { + List result = eiDao + .getEncodeCodeByName("Ԥִϵͳ", testTableName); + Assert.assertTrue(result.size() > 0); + } + + @Test + public void testUpdateEncodeNameByCode() { + int result = eiDao + .updateEncodeNameByCode("3", "һ廯ƽ̨", testTableName); + Assert.assertTrue(result > 0); + } + + @Test + public void testInsertEncodeEntity() { + int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("˰ϵͳ", + "4"), testTableName); + Assert.assertTrue(result == 1); + } + + @Test + public void testDeleteEncodeByCode() { + int result = eiDao.deleteEncodeByCode("5", testTableName); + Assert.assertTrue(result >= 1); + } +} diff --git a/test/com/platform/test/TestEncodeService.java b/test/com/platform/test/TestEncodeService.java new file mode 100644 index 00000000..3b4f40c6 --- /dev/null +++ b/test/com/platform/test/TestEncodeService.java @@ -0,0 +1,45 @@ +package com.platform.test; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.platform.entities.EncodedInfoEntity; +import com.platform.service.EncodeInfoService; + +public class TestEncodeService extends SMBasedTest { + + private EncodeInfoService eis; + private String testTableName; + + @Before + public void initBeforeFunction() { + eis = (EncodeInfoService) this.applicationContext + .getBean("encodeInfoService"); + testTableName = "system_info"; + } + + @Test + public void testGetEncodeNameByCode() { + String result = eis.getEncodeNameByCode("2", testTableName); + Assert.assertTrue(result.equals("Ԥ")); + } + + /** + * + */ + @Test + public void testDeleteEncodeByCode() { + eis.deleteEncodeByCode("4", testTableName); + } + + @Test + public void testGetAllEncodeInfo() { + List allEntities = eis + .getAllEncodeInfo(testTableName); + System.out.println(allEntities); + Assert.assertTrue(allEntities.size() >= 1); + } +} diff --git a/test/com/platform/test/User.java b/test/com/platform/test/User.java new file mode 100644 index 00000000..e96fbc11 --- /dev/null +++ b/test/com/platform/test/User.java @@ -0,0 +1,42 @@ +package com.platform.test; + +public class User { + private String name; + private int id; + private String sex; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public User(String name, int id, String sex) { + super(); + this.name = name; + this.id = id; + this.sex = sex; + } + + public User(){ + + } +} diff --git a/test/spring-applicationContext-test.xml b/test/spring-applicationContext-test.xml new file mode 100644 index 00000000..2bdabb7c --- /dev/null +++ b/test/spring-applicationContext-test.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file