Browse Source

first commit

xusonglin 4 years ago
parent
commit
b7287009e1
100 changed files with 6653 additions and 0 deletions
  1. 3 0
      .gitattributes
  2. 201 0
      LICENSE
  3. BIN
      doc/项目结构技术选项开发说明.pdf
  4. BIN
      doc/项目部署说明文档必读.pdf
  5. 277 0
      pom.xml
  6. BIN
      screenshots/addarticle.png
  7. BIN
      screenshots/addlanmu.png
  8. BIN
      screenshots/articlelist.png
  9. BIN
      screenshots/book.jpg
  10. BIN
      screenshots/gateway/columnlist.png
  11. BIN
      screenshots/gateway/detail.png
  12. BIN
      screenshots/gateway/h5/columnlist.png
  13. BIN
      screenshots/gateway/h5/detail.png
  14. BIN
      screenshots/gateway/h5/index.png
  15. BIN
      screenshots/gateway/help/help.png
  16. BIN
      screenshots/gateway/index.png
  17. BIN
      screenshots/lanmulist.png
  18. BIN
      screenshots/login.png
  19. BIN
      screenshots/menulist.png
  20. BIN
      screenshots/red/addarticle.png
  21. BIN
      screenshots/red/addlanmu.png
  22. BIN
      screenshots/red/articlelist.png
  23. BIN
      screenshots/red/lanmulist.png
  24. BIN
      screenshots/red/menulist.png
  25. BIN
      screenshots/red/roleSet.png
  26. BIN
      screenshots/red/rolelist.png
  27. BIN
      screenshots/red/skin.png
  28. BIN
      screenshots/red/updatePwd.png
  29. BIN
      screenshots/red/userlist.png
  30. BIN
      screenshots/rolelist.png
  31. BIN
      screenshots/roleset.png
  32. BIN
      screenshots/skin.png
  33. BIN
      screenshots/tianti_dashang_erweima.png
  34. BIN
      screenshots/tianti_gongzhonghao.png
  35. BIN
      screenshots/tiantiframework.png
  36. BIN
      screenshots/updatePwd.png
  37. BIN
      screenshots/userlist.png
  38. 1 0
      tianti-cms/.gitignore
  39. 22 0
      tianti-cms/pom.xml
  40. 37 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/GenCodeTest.java
  41. 13 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ArticleDao.java
  42. 27 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ArticleDaoCustom.java
  43. 194 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ArticleDaoImpl.java
  44. 13 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ColumnInfoDao.java
  45. 20 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ColumnInfoDaoCustom.java
  46. 88 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ColumnInfoDaoImpl.java
  47. 133 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dto/ArticleQueryDTO.java
  48. 44 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dto/ColumnInfoDTO.java
  49. 78 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dto/ColumnInfoQueryDTO.java
  50. 56 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/dto/CurrentArticleInfoDTO.java
  51. 200 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/entity/Article.java
  52. 129 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/entity/ColumnInfo.java
  53. 62 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/service/ArticleService.java
  54. 36 0
      tianti-cms/src/main/java/com/jeff/tianti/cms/service/ColumnInfoService.java
  55. 1 0
      tianti-common/.gitignore
  56. 16 0
      tianti-common/pom.xml
  57. 17 0
      tianti-common/src/main/java/com/jeff/tianti/common/dao/CommonDao.java
  58. 527 0
      tianti-common/src/main/java/com/jeff/tianti/common/dao/CustomBaseSqlDaoImpl.java
  59. 35 0
      tianti-common/src/main/java/com/jeff/tianti/common/dto/AjaxResult.java
  60. 59 0
      tianti-common/src/main/java/com/jeff/tianti/common/dto/CommonQueryDTO.java
  61. 132 0
      tianti-common/src/main/java/com/jeff/tianti/common/entity/BaseEntity.java
  62. 13 0
      tianti-common/src/main/java/com/jeff/tianti/common/entity/IdEntity.java
  63. 29 0
      tianti-common/src/main/java/com/jeff/tianti/common/entity/MysqlLongIdEntity.java
  64. 31 0
      tianti-common/src/main/java/com/jeff/tianti/common/entity/MysqlSequenceIdEntity.java
  65. 31 0
      tianti-common/src/main/java/com/jeff/tianti/common/entity/OracleLongEntity.java
  66. 82 0
      tianti-common/src/main/java/com/jeff/tianti/common/entity/PageModel.java
  67. 162 0
      tianti-common/src/main/java/com/jeff/tianti/common/service/CommonService.java
  68. 60 0
      tianti-common/src/main/java/com/jeff/tianti/common/util/CommonUtils.java
  69. 267 0
      tianti-common/src/main/java/com/jeff/tianti/common/util/DateUtils.java
  70. 256 0
      tianti-common/src/main/java/com/jeff/tianti/common/util/ExcelUtils.java
  71. 472 0
      tianti-common/src/main/java/com/jeff/tianti/common/util/GenCodeUtil.java
  72. 79 0
      tianti-common/src/main/java/com/jeff/tianti/common/util/Md5Util.java
  73. 17 0
      tianti-modules/pom.xml
  74. 7 0
      tianti-modules/tianti-module-admin/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch
  75. 1 0
      tianti-modules/tianti-module-admin/.gitignore
  76. 71 0
      tianti-modules/tianti-module-admin/pom.xml
  77. 584 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/CmsController.java
  78. 23 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/IndexController.java
  79. 89 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/LoginController.java
  80. 109 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/UploadController.java
  81. 657 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/UserController.java
  82. 22 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/shiro/RememberAuthenticationFilter.java
  83. 157 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/shiro/ShiroDBRealm.java
  84. 19 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/util/Constants.java
  85. 77 0
      tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/util/WebHelper.java
  86. 9 0
      tianti-modules/tianti-module-admin/src/main/resources/application.development.properties
  87. 9 0
      tianti-modules/tianti-module-admin/src/main/resources/application.production.properties
  88. 50 0
      tianti-modules/tianti-module-admin/src/main/resources/applicationContext-cache.xml
  89. 101 0
      tianti-modules/tianti-module-admin/src/main/resources/applicationContext-shiro.xml
  90. 148 0
      tianti-modules/tianti-module-admin/src/main/resources/applicationContext.xml
  91. 24 0
      tianti-modules/tianti-module-admin/src/main/resources/ehcache.xml
  92. 7 0
      tianti-modules/tianti-module-admin/src/main/resources/log4j.properties
  93. 7 0
      tianti-modules/tianti-module-admin/src/main/resources/log4jdbc.properties
  94. BIN
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/pager-taglib.jar
  95. BIN
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/springside-core-4.2.2.GA.jar
  96. BIN
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/statistics-1.0.2.jar
  97. BIN
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/ueditor-1.1.1.jar
  98. 47 0
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/springmvc-servlet.xml
  99. 515 0
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/views/cms/article_default_list.jsp
  100. 0 0
      tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/views/cms/article_edit.jsp

+ 3 - 0
.gitattributes

@@ -0,0 +1,3 @@
+*.css linguist-language=java
+*.js linguist-language=java
+*.jsp linguist-language=java

+ 201 - 0
LICENSE

@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

BIN
doc/项目结构技术选项开发说明.pdf


BIN
doc/项目部署说明文档必读.pdf


+ 277 - 0
pom.xml

@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.jeff</groupId>
+  <artifactId>tianti</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <modules>
+  	<module>tianti-common</module>
+  	<module>tianti-org</module>
+  	<module>tianti-modules</module>
+    <module>tianti-cms</module>
+  </modules>
+  <!-- 主要依赖库的版本定义 -->
+  <properties>
+    <!-- 定义资源文件的编码格式-->
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <!-- 依赖库版本定义-->
+    <tianti.version>1.0.0</tianti.version>
+    <junit.version>4.12</junit.version>
+    <spring.version>4.2.5.RELEASE</spring.version>
+    <hibernate.version>4.3.5.Final</hibernate.version>
+    <hibernate.annotations.version>4.0.4.Final</hibernate.annotations.version>
+    <mysql.driver.version>5.1.22</mysql.driver.version>
+    <shiro.version>1.3.2</shiro.version>
+    <jackson.version>1.9.2</jackson.version>
+	<fastjson.version>1.2.20</fastjson.version>
+    <log4j2.version>2.7</log4j2.version>
+    <slf4j.version>1.7.21</slf4j.version>
+    <poi.version>3.15</poi.version>
+    <commons-io.version>2.4</commons-io.version>
+	<commons-fileupload.version>1.3.1</commons-fileupload.version>
+	
+	<servlet.version>4.0.0-b01</servlet.version>
+	<jstl.version>1.2</jstl.version>
+  </properties>
+  
+  <!-- 描述项目的所有依赖包-->
+  <dependencies>
+    <!-- Spring相关项目依赖 start -->
+      <!-- Spring核心依赖 start -->
+      <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-core</artifactId><!-- 包含Spring框架基本的核心工具类 -->
+			<version>${spring.version}</version>
+	  </dependency>
+	  <dependency>
+	        <groupId>org.springframework</groupId>
+	        <artifactId>spring-beans</artifactId><!-- springIoC(依赖注入)的基础工具类-->
+	        <version>${spring.version}</version>
+	  </dependency>
+	  <dependency>
+	        <groupId>org.springframework</groupId>
+	        <artifactId>spring-context</artifactId><!-- spring 提供在基于IoC 功能上的扩展服务 -->
+	        <version>${spring.version}</version>
+	  </dependency>
+	  <!-- Spring核心依赖 end -->
+	  <!-- spring 持久层依赖start -->
+	   <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-tx</artifactId><!-- 封装了spring对于事物的控制 -->
+			<version>${spring.version}</version>
+	   </dependency>
+	   <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-jdbc</artifactId><!-- 包含对Spring对JDBC数据访问进行封装的所有类  -->
+			<version>${spring.version}</version>
+	   </dependency>
+	  <!-- spring 持久层依赖end -->
+	  <!-- Spring web相关依赖 start -->
+	   <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-web</artifactId>
+			<version>${spring.version}</version>
+	   </dependency>
+	   <dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId><!-- Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架 -->
+			<version>${spring.version}</version>
+	   </dependency>
+	   <!-- Spring web相关依赖 end -->
+	   <!-- Spring 其它依赖 -->
+		<dependency>
+			<groupId>org.springframework</groupId><!-- spring面向切面编程,提供AOP(面向切面编程) -->
+			<artifactId>spring-aop</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context-support</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-oxm</artifactId>
+			<version>${spring.version}</version>
+		</dependency>	
+		<dependency>
+		    <groupId>org.aspectj</groupId>
+		    <artifactId>aspectjweaver</artifactId>
+		    <version>1.8.10</version>
+		</dependency>
+		<dependency>
+		    <groupId>org.springframework.data</groupId>
+		    <artifactId>spring-data-jpa</artifactId>
+		    <version>1.5.2.RELEASE</version>
+		</dependency>
+		<!-- Spring其他依赖  end-->
+    <!-- Spring相关项目依赖 end -->
+    <!-- hibernate相关项目依赖 start -->
+    <dependency>
+        <groupId>org.hibernate</groupId>
+        <artifactId>hibernate-core</artifactId>
+        <version>${hibernate.version}</version>
+    </dependency>
+    <dependency>
+        <groupId>org.hibernate</groupId>
+        <artifactId>hibernate-entitymanager</artifactId>
+        <version>${hibernate.version}</version>
+    </dependency>
+    <dependency>
+        <groupId>org.hibernate.common</groupId>
+        <artifactId>hibernate-commons-annotations</artifactId>
+        <version>${hibernate.annotations.version}</version>
+    </dependency>
+    <dependency>
+       <groupId>org.hibernate.javax.persistence</groupId>
+       <artifactId>hibernate-jpa-2.1-api</artifactId>
+       <version>1.0.0.Final</version>
+    </dependency>
+    <!-- hibernate相关项目依赖 end -->
+    <!-- mysql数据库相关依赖start -->
+    <dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId><!-- 导入Mysql数据库驱动包 -->
+			<version>${mysql.driver.version}</version>
+	</dependency>
+	<!-- mysql数据库相关依赖end -->
+	<!-- log日志相关依赖 start -->
+	<dependency>
+	    <groupId>log4j</groupId>
+	    <artifactId>log4j</artifactId>
+	    <version>1.2.17</version>
+	</dependency>
+	<dependency>
+		<groupId>org.slf4j</groupId>
+		<artifactId>slf4j-api</artifactId><!-- slf4j -->
+		<version>${slf4j.version}</version>
+	</dependency>
+	<!-- log日志相关依赖 end -->
+	<!-- servlet atart -->
+	<dependency>
+		<groupId>javax.servlet</groupId>
+		<artifactId>javax.servlet-api</artifactId><!-- j2ee web spec -->
+		<version>${servlet.version}</version>
+	</dependency>
+	<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>jstl</artifactId><!-- JSTL标签依赖-->
+			<version>${jstl.version}</version>
+    </dependency>
+    <dependency>
+		    <groupId>javax.validation</groupId>
+		    <artifactId>validation-api</artifactId>
+		    <version>1.1.0.Final</version>
+    </dependency>
+    <dependency>
+	    <groupId>javax.servlet.jsp</groupId>
+	    <artifactId>jsp-api</artifactId>
+	    <version>2.2</version>
+	</dependency>
+	<!-- servlet end -->
+	<!-- shiro start -->
+	<dependency>
+	    <groupId>org.apache.shiro</groupId>
+	    <artifactId>shiro-core</artifactId>
+	    <version>${shiro.version}</version>
+    </dependency>
+    <dependency>
+	    <groupId>org.apache.shiro</groupId>
+	    <artifactId>shiro-spring</artifactId>
+	    <version>${shiro.version}</version>
+    </dependency>
+    <dependency>
+	    <groupId>org.apache.shiro</groupId>
+	    <artifactId>shiro-web</artifactId>
+	    <version>${shiro.version}</version>
+	</dependency>
+    <!-- shiro end -->
+    <!-- jackson start -->
+    <dependency>
+	    <groupId>com.fasterxml.jackson.core</groupId>
+	    <artifactId>jackson-core</artifactId>
+	    <version>2.8.5</version>
+	</dependency>
+	<dependency>
+	    <groupId>com.fasterxml.jackson.core</groupId>
+	    <artifactId>jackson-databind</artifactId>
+	    <version>2.8.5</version>
+	</dependency>
+   <!-- jackson end -->
+	<!-- POI start -->
+	<dependency>
+	    <groupId>org.apache.poi</groupId>
+	    <artifactId>poi</artifactId>
+	    <version>${poi.version}</version>
+    </dependency>
+    <dependency>
+	    <groupId>org.apache.poi</groupId>
+	    <artifactId>poi-ooxml</artifactId>
+	    <version>${poi.version}</version>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.poi</groupId>
+	    <artifactId>poi-ooxml-schemas</artifactId>
+	    <version>${poi.version}</version>
+	</dependency>
+    <!-- POI end -->
+	<!-- commons-lang start -->
+	<dependency>
+	    <groupId>org.apache.commons</groupId>
+	    <artifactId>commons-lang3</artifactId>
+	    <version>3.4</version>
+    </dependency>
+    <dependency>
+	    <groupId>commons-fileupload</groupId>
+	    <artifactId>commons-fileupload</artifactId>
+	    <version>1.3</version>
+	</dependency>
+    <!-- commons-lang end -->
+    <!-- tomcat jdbc start -->
+    <dependency>
+	    <groupId>org.apache.tomcat</groupId>
+	    <artifactId>tomcat-jdbc</artifactId>
+	    <version>8.0.33</version>
+    </dependency>
+    <dependency>
+	    <groupId>org.apache.tomcat</groupId>
+	    <artifactId>tomcat-juli</artifactId>
+	    <version>8.0.33</version>
+    </dependency>
+    <!-- tomcat jdbc end -->
+    <!-- ehcache start -->
+    <dependency>
+	    <groupId>net.sf.ehcache.internal</groupId>
+	    <artifactId>ehcache-core</artifactId>
+	    <version>2.10.0</version>
+	</dependency>
+	<dependency>
+	    <groupId>net.sf.ehcache</groupId>
+	    <artifactId>ehcache-web</artifactId>
+	    <version>2.0.4</version>
+	</dependency>
+	<!-- ehcache end -->
+    <!-- 单元测试框架 start -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- 单元测试框架 end -->
+  </dependencies>
+  
+  <build>  
+	    <plugins>  
+	        <plugin>  
+	            <groupId>org.apache.maven.plugins</groupId>  
+	            <artifactId>maven-compiler-plugin</artifactId>  
+	            <configuration>  
+	                <source>1.7</source>  
+	                <target>1.7</target>  
+	            </configuration>  
+	        </plugin>  
+	    </plugins>  
+  </build>  
+</project>

BIN
screenshots/addarticle.png


BIN
screenshots/addlanmu.png


BIN
screenshots/articlelist.png


BIN
screenshots/book.jpg


BIN
screenshots/gateway/columnlist.png


BIN
screenshots/gateway/detail.png


BIN
screenshots/gateway/h5/columnlist.png


BIN
screenshots/gateway/h5/detail.png


BIN
screenshots/gateway/h5/index.png


BIN
screenshots/gateway/help/help.png


BIN
screenshots/gateway/index.png


BIN
screenshots/lanmulist.png


BIN
screenshots/login.png


BIN
screenshots/menulist.png


BIN
screenshots/red/addarticle.png


BIN
screenshots/red/addlanmu.png


BIN
screenshots/red/articlelist.png


BIN
screenshots/red/lanmulist.png


BIN
screenshots/red/menulist.png


BIN
screenshots/red/roleSet.png


BIN
screenshots/red/rolelist.png


BIN
screenshots/red/skin.png


BIN
screenshots/red/updatePwd.png


BIN
screenshots/red/userlist.png


BIN
screenshots/rolelist.png


BIN
screenshots/roleset.png


BIN
screenshots/skin.png


BIN
screenshots/tianti_dashang_erweima.png


BIN
screenshots/tianti_gongzhonghao.png


BIN
screenshots/tiantiframework.png


BIN
screenshots/updatePwd.png


BIN
screenshots/userlist.png


+ 1 - 0
tianti-cms/.gitignore

@@ -0,0 +1 @@
+/target/

+ 22 - 0
tianti-cms/pom.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>com.jeff</groupId>
+    <artifactId>tianti</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <groupId>com.jeff.tianti.cms</groupId>
+  <artifactId>tianti-cms</artifactId>
+  <version>${tianti.version}</version>
+  <name>tianti-cms</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+      <dependency>
+			<groupId>com.jeff.tianti.common</groupId>
+			<artifactId>tianti-common</artifactId>
+			<version>${tianti.version}</version>
+	 </dependency>
+  </dependencies>
+</project>

+ 37 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/GenCodeTest.java

@@ -0,0 +1,37 @@
+package com.jeff.tianti.cms;
+
+import java.io.IOException;
+
+import com.jeff.tianti.cms.entity.Article;
+import com.jeff.tianti.cms.entity.ColumnInfo;
+import com.jeff.tianti.common.util.GenCodeUtil;
+
+public class GenCodeTest {
+	
+	public static void main(String[] args) throws IOException{
+		//基本包目录(不用到entity那一层级)
+		String s = "com.jeff.tianti.cms";
+		//作者
+		String writer = "xujianfang";
+		//Demo为Entity类(放上自己新增的实体类即可)
+		GenCodeTest.autoGenAllCode(ColumnInfo.class,s,writer);
+		GenCodeTest.autoGenAllCode(Article.class,s,writer);
+	}
+	
+	/**
+	 * 组装所有生成类
+	 * @param c
+	 * @param commonPackage
+	 * @param writer
+	 * @throws IOException
+	 */
+	public static void autoGenAllCode(Class c,String commonPackage,String writer) throws IOException{
+		GenCodeUtil.createQueryDTO(c, commonPackage, writer);
+//		GenCodeUtil.createFrontQueryDTO(c, commonPackage, writer);
+		GenCodeUtil.createDaoCustomInterface(c,commonPackage,writer);
+		GenCodeUtil.createDaoInterface(c,commonPackage,writer);
+		GenCodeUtil.createDaoClass(c,commonPackage,writer);
+		GenCodeUtil.createServiceClass(c,commonPackage,writer);
+	}
+
+}

+ 13 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ArticleDao.java

@@ -0,0 +1,13 @@
+package com.jeff.tianti.cms.dao;
+
+import com.jeff.tianti.cms.entity.Article;
+import com.jeff.tianti.common.dao.CommonDao;
+
+/**
+ * @author xujianfang
+ * @desc ArticleDao接口 
+ * @date 2017-03-16
+ */
+public interface ArticleDao extends ArticleDaoCustom,CommonDao<Article,String>{
+
+}

+ 27 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ArticleDaoCustom.java

@@ -0,0 +1,27 @@
+package com.jeff.tianti.cms.dao;
+
+import com.jeff.tianti.common.entity.PageModel;
+import java.util.List;
+import java.util.Map;
+
+import com.jeff.tianti.cms.entity.Article;
+import com.jeff.tianti.cms.dto.ArticleQueryDTO;
+import com.jeff.tianti.cms.dto.CurrentArticleInfoDTO;
+/**
+ * @author xujianfang
+ * @desc ArticleDaoCustom接口 
+ * @date 2017-03-16
+ */
+public interface ArticleDaoCustom {
+
+      PageModel<Article> queryArticlePage(ArticleQueryDTO articleQueryDTO);
+
+      List<Article> queryArticleList(ArticleQueryDTO articleQueryDTO);
+
+      List<Map<String, Object>> queryStatisMapList(ArticleQueryDTO articleQueryDTO);
+      
+      List<Article> queryNextArticleList(CurrentArticleInfoDTO currentArticleInfoDTO);
+      
+      List<Article> queryPreArticleList(CurrentArticleInfoDTO currentArticleInfoDTO);
+
+}

+ 194 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ArticleDaoImpl.java

@@ -0,0 +1,194 @@
+package com.jeff.tianti.cms.dao;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.jeff.tianti.cms.dto.ArticleQueryDTO;
+import com.jeff.tianti.cms.dto.CurrentArticleInfoDTO;
+import com.jeff.tianti.cms.entity.Article;
+import com.jeff.tianti.common.dao.CustomBaseSqlDaoImpl;
+import com.jeff.tianti.common.entity.PageModel;
+/**
+ * @author xujianfang
+ * @desc ArticleDaoImpl类 
+ * @date 2017-03-16
+ */
+
+public class ArticleDaoImpl extends CustomBaseSqlDaoImpl implements ArticleDaoCustom  {
+
+    public PageModel<Article> queryArticlePage(ArticleQueryDTO articleQueryDTO){
+    	 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+         Map<String,Object> map = new HashMap<String,Object>();
+         StringBuilder hql = new StringBuilder();
+         hql.append("select t from Article t where 1=1 ");
+         if(articleQueryDTO != null){
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getRootColumnId())){
+        		 hql.append(" and t.rootColumnInfo.id = :rootColumnId ");
+        		 map.put("rootColumnId", articleQueryDTO.getRootColumnId());        		 
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getColumnId())){
+        		 hql.append(" and t.columnInfo.id = :columnId ");
+            	 map.put("columnId", articleQueryDTO.getColumnId());
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getTitle())){
+        		 hql.append(" and t.title like  :title ");
+        		 map.put("title", "%"+articleQueryDTO.getTitle()+"%");
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getPublisher())){
+        		 hql.append(" and t.publisher like  :publisher ");
+        		 map.put("publisher", "%"+articleQueryDTO.getPublisher()+"%");
+        	 }
+		     if(StringUtils.isNotBlank(articleQueryDTO.getDeleteFlag())){
+        		 hql.append(" and t.deleteFlag = :deleteFlag ");
+            	         map.put("deleteFlag", articleQueryDTO.getDeleteFlag());
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getStartDate())){
+        		 hql.append(" and t.createDate  >= :startDate ");
+        		 try {
+					map.put("startDate",sdf.parse(articleQueryDTO.getStartDate()));
+				} catch (ParseException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getEndDate())){
+        		 hql.append(" and t.createDate  <= :endDate ");
+        		 try {
+					map.put("endDate",sdf.parse(articleQueryDTO.getEndDate()));
+				} catch (ParseException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+        	 }
+        	 if(articleQueryDTO.getIsFront() != null && articleQueryDTO.getIsFront()){
+        		 //前端默认查询审核通过的且未删除的记录,且按照置顶和时间降序排序
+                 hql.append(" and t.isAudit =1  order by t.isTop desc,t.createDate desc ");
+        	 }else{
+        		 if(StringUtils.isNotBlank(articleQueryDTO.getType())){
+            		 if(articleQueryDTO.getType().equals("laji")){
+            			 hql.append(" and t.deleteFlag =1 ");
+            		 }else if(articleQueryDTO.getType().equals("zhiding")){
+            			 hql.append(" and t.isTop =1 ");
+            		 }
+                     hql.append(" order by t.createDate desc ");
+            	 }
+        	 }
+         }
+         return this.queryForPageWithParams(hql.toString(),map,articleQueryDTO.getCurrentPage(),articleQueryDTO.getPageSize());
+    }
+
+    public List<Article> queryArticleList(ArticleQueryDTO articleQueryDTO){
+    	 List<Article> articleList = null;
+         Map<String,Object> map = new HashMap<String,Object>();
+         StringBuilder hql = new StringBuilder();
+         hql.append("select t from Article t where 1=1 ");
+         if(articleQueryDTO != null){
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getColumnId())){
+        		 hql.append(" and t.columnInfo.id = :columnId ");
+        		 map.put("columnId", articleQueryDTO.getColumnId());
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getTitle())){
+        		 hql.append(" and t.title like = :title ");
+        		 map.put("title", "%"+articleQueryDTO.getTitle()+"%");
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getPublisher())){
+        		 hql.append(" and t.publisher like = :publisher ");
+        		 map.put("publisher", "%"+articleQueryDTO.getPublisher()+"%");
+        	 }
+		     if(StringUtils.isNotBlank(articleQueryDTO.getDeleteFlag())){
+        		 hql.append(" and t.deleteFlag = :deleteFlag ");
+            	         map.put("deleteFlag", articleQueryDTO.getDeleteFlag());
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getStartDate())){
+        		 hql.append(" and t.createDate  >= :startDate ");
+        		 map.put("startDate",articleQueryDTO.getStartDate());
+        	 }
+        	 if(StringUtils.isNotBlank(articleQueryDTO.getEndDate())){
+        		 hql.append(" and t.createDate  <= :endDate ");
+        		 map.put("endDate",articleQueryDTO.getEndDate());
+        	 }
+        	 if(articleQueryDTO.getIsFront() != null && articleQueryDTO.getIsFront()){
+        		 //前端默认查询审核通过的且未删除的记录,且按照置顶和时间降序排序
+                 hql.append(" and t.isAudit =1  order by t.isTop desc,t.createDate desc ");
+        	 }else{
+        		 if(StringUtils.isNotBlank(articleQueryDTO.getType())){
+            		 if(articleQueryDTO.getType().equals("laji")){
+            			 hql.append(" and t.deleteFlag =1 ");
+            		 }else if(articleQueryDTO.getType().equals("zhiding")){
+            			 hql.append(" and t.isTop =1 ");
+            		 }
+                     hql.append(" order by t.createDate desc ");
+            	 }
+        	 }
+         }
+         if(articleQueryDTO.getTop() != null){
+        	 PageModel pageModel = this.queryForPageWithParams(hql.toString(),map,0, articleQueryDTO.getTop());
+        	 if(pageModel != null){
+        		 articleList = pageModel.getList();
+        	 }
+         }else{
+        	 articleList = this.queryByMapParams(hql.toString(),map);
+         }
+         return articleList;
+    }
+    
+    public List<Map<String, Object>> queryStatisMapList(ArticleQueryDTO articleQueryDTO){
+    	String sql = " select count(1) as totalCount,(select count(1) from cms_article where is_top=1 and delete_flag = '0') as zhidingCount,(select count(1) from cms_article where is_audit=1 and delete_flag = '0') as shenheCount,(select count(1) from cms_article where delete_flag='1') as deleteCount from cms_article a  ";
+    	return this.querySqlObjects(sql);
+    }
+    
+    public List<Article> queryNextArticleList(CurrentArticleInfoDTO currentArticleInfoDTO){
+    	Map<String,Object> map = new HashMap<String,Object>();
+    	StringBuilder hql = new StringBuilder();
+    	hql.append(" select a from Article a where 1=1  ");
+    	if(StringUtils.isNotBlank(currentArticleInfoDTO.getArticleId())){
+    		hql.append(" and a.id <> :articleId ");
+    		map.put("articleId", currentArticleInfoDTO.getArticleId());
+    	}
+    	if(StringUtils.isNotBlank(currentArticleInfoDTO.getColumnId())){
+    		hql.append(" and a.columnInfo.id = :columnInfoId ");
+    		map.put("columnInfoId", currentArticleInfoDTO.getColumnId());
+    	}
+    	if(currentArticleInfoDTO.getArticleDate() != null){
+    		hql.append(" and a.createDate < :date ");
+    		map.put("date", currentArticleInfoDTO.getArticleDate());
+    		hql.append(" order by a.createDate desc ");
+    	}else if(currentArticleInfoDTO.getOrderNo() != null){
+    		hql.append(" and a.orderNo < :orderNo ");
+    		map.put("orderNo", currentArticleInfoDTO.getOrderNo());
+    		hql.append(" order by a.orderNo desc ");
+    	}
+    	return this.queryByMapParams(hql.toString(), map);
+    }
+    
+    public List<Article> queryPreArticleList(CurrentArticleInfoDTO currentArticleInfoDTO){
+    	Map<String,Object> map = new HashMap<String,Object>();
+    	StringBuilder hql = new StringBuilder();
+    	hql.append(" select a from Article a where 1=1  ");
+    	if(StringUtils.isNotBlank(currentArticleInfoDTO.getArticleId())){
+    		hql.append(" and a.id <> :articleId ");
+    		map.put("articleId", currentArticleInfoDTO.getArticleId());
+    	}
+    	if(StringUtils.isNotBlank(currentArticleInfoDTO.getColumnId())){
+    		hql.append(" and a.columnInfo.id = :columnInfoId ");
+    		map.put("columnInfoId", currentArticleInfoDTO.getColumnId());
+    	}
+    	if(currentArticleInfoDTO.getArticleDate() != null){
+    		hql.append(" and a.createDate > :date ");
+    		map.put("date", currentArticleInfoDTO.getArticleDate());
+    		hql.append(" order by a.createDate asc ");
+    	}else if(currentArticleInfoDTO.getOrderNo() != null){
+    		hql.append(" and a.orderNo > :orderNo ");
+    		map.put("orderNo", currentArticleInfoDTO.getOrderNo());
+    		hql.append(" order by a.orderNo asc ");
+    	}
+    	return this.queryByMapParams(hql.toString(), map);
+    }
+
+
+}

+ 13 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ColumnInfoDao.java

@@ -0,0 +1,13 @@
+package com.jeff.tianti.cms.dao;
+
+import com.jeff.tianti.cms.entity.ColumnInfo;
+import com.jeff.tianti.common.dao.CommonDao;
+
+/**
+ * @author xujianfang
+ * @desc ColumnInfoDao接口 
+ * @date 2017-03-16
+ */
+public interface ColumnInfoDao extends ColumnInfoDaoCustom,CommonDao<ColumnInfo,String>{
+
+}

+ 20 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ColumnInfoDaoCustom.java

@@ -0,0 +1,20 @@
+package com.jeff.tianti.cms.dao;
+
+import com.jeff.tianti.common.entity.PageModel;
+import java.util.List;
+import com.jeff.tianti.cms.entity.ColumnInfo;
+import com.jeff.tianti.cms.dto.ColumnInfoQueryDTO;
+/**
+ * @author xujianfang
+ * @desc ColumnInfoDaoCustom接口 
+ * @date 2017-03-16
+ */
+public interface ColumnInfoDaoCustom {
+
+      PageModel<ColumnInfo> queryColumnInfoPage(ColumnInfoQueryDTO columnInfoQueryDTO);
+
+      List<ColumnInfo> queryColumnInfoList(ColumnInfoQueryDTO columnInfoQueryDTO);
+
+
+
+}

+ 88 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dao/ColumnInfoDaoImpl.java

@@ -0,0 +1,88 @@
+package com.jeff.tianti.cms.dao;
+
+import com.jeff.tianti.common.dao.CustomBaseSqlDaoImpl;
+import com.jeff.tianti.common.entity.PageModel;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.jeff.tianti.cms.entity.ColumnInfo;
+import com.jeff.tianti.cms.dto.ColumnInfoQueryDTO;
+/**
+ * @author xujianfang
+ * @desc ColumnInfoDaoImpl类 
+ * @date 2017-03-16
+ */
+
+public class ColumnInfoDaoImpl extends CustomBaseSqlDaoImpl implements ColumnInfoDaoCustom  {
+
+    public PageModel<ColumnInfo> queryColumnInfoPage(ColumnInfoQueryDTO columnInfoQueryDTO){
+         Map<String,Object> map = new HashMap<String,Object>();
+         StringBuilder hql = new StringBuilder();
+         hql.append("select t from ColumnInfo t where 1=1 ");
+         if(columnInfoQueryDTO != null){
+        	 if(StringUtils.isNotBlank(columnInfoQueryDTO.getCode())){
+        		 hql.append(" and t.code like :code ");
+        		 map.put("code", "%"+columnInfoQueryDTO.getCode()+"%");
+        	 }
+        	 
+        	 if(StringUtils.isNotBlank(columnInfoQueryDTO.getName())){
+        		 hql.append(" and t.name like :name ");
+        		 map.put("name", "%"+columnInfoQueryDTO.getName()+"%");
+        	 }
+        	 
+        	 if(columnInfoQueryDTO.getLevel() != null){
+        		 hql.append(" and t.level = :level ");
+        		 map.put("level", columnInfoQueryDTO.getLevel());
+        	 }
+         }
+         hql.append(" order by t.orderNo asc ");
+         return this.queryForPageWithParams(hql.toString(),map,columnInfoQueryDTO.getCurrentPage(),columnInfoQueryDTO.getPageSize());
+    }
+
+    public List<ColumnInfo> queryColumnInfoList(ColumnInfoQueryDTO columnInfoQueryDTO){
+         Map<String,Object> map = new HashMap<String,Object>();
+         StringBuilder hql = new StringBuilder();
+         hql.append("select t from ColumnInfo t where 1=1 and t.deleteFlag = 0 ");
+         if(columnInfoQueryDTO != null){
+        	 if(columnInfoQueryDTO.getIsRootColumnLike() != null && !columnInfoQueryDTO.getIsRootColumnLike()){
+        		 if(StringUtils.isNotBlank(columnInfoQueryDTO.getRootColumnId())){
+            		 hql.append(" and t.parent.id = :rootColumnId ");
+            		 map.put("rootColumnId", columnInfoQueryDTO.getRootColumnId());
+            	 }
+        	 }else{
+        		 if(StringUtils.isNotBlank(columnInfoQueryDTO.getRootColumnId())){
+            		 hql.append(" and t.path like :rootColumnId ");
+            		 map.put("rootColumnId", "%"+columnInfoQueryDTO.getRootColumnId()+"%");
+            	 }
+        	 }
+        	 
+        	 if(StringUtils.isNotBlank(columnInfoQueryDTO.getCode())){
+        		 if(columnInfoQueryDTO.getIsCodeLike() != null && columnInfoQueryDTO.getIsCodeLike().equals(false)){
+        			 hql.append(" and t.code = :code ");
+            		 map.put("code", columnInfoQueryDTO.getCode());
+        		 }else{
+        			 hql.append(" and t.code like :code ");
+            		 map.put("code", "%"+columnInfoQueryDTO.getCode()+"%");
+        		 }
+        	 }
+        	 
+        	 if(StringUtils.isNotBlank(columnInfoQueryDTO.getName())){
+        		 hql.append(" and t.name like :name ");
+        		 map.put("name", "%"+columnInfoQueryDTO.getName()+"%");
+        	 }
+        	 
+        	 if(columnInfoQueryDTO.getLevel() != null){
+        		 hql.append(" and t.level = :level ");
+        		 map.put("level", columnInfoQueryDTO.getLevel());
+        	 }
+         }
+         hql.append(" order by t.orderNo asc ");
+         return this.queryByMapParams(hql.toString(),map);
+    }
+
+
+}

+ 133 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dto/ArticleQueryDTO.java

@@ -0,0 +1,133 @@
+package com.jeff.tianti.cms.dto;
+
+import com.jeff.tianti.common.dto.CommonQueryDTO;
+
+/**
+ * @author xujianfang
+ * @desc ArticleQueryDTO 
+ * @date 2017-03-16
+ */
+public class ArticleQueryDTO extends CommonQueryDTO{
+	
+	//是否前端查询
+	private Boolean isFront;
+	
+	//数据获取类型(如全部、已审核等)
+	private String type;
+	
+	//根栏目ID
+	private String rootColumnId;
+	
+	//栏目ID(叶子节点)
+	private String columnId;
+
+	//标题
+	private String title;
+	
+	//发布者
+	private String publisher;
+	
+	//开始时间
+	private String startDate;
+	
+	//结束时间
+	private String endDate;
+	
+	//前N条数据
+	private Integer top;
+	
+	// 逻辑删除
+	private String deleteFlag;
+	
+	//按发布日期排序样式:up为升序,down为降序
+	private String createDateSortCss;
+
+	public Boolean getIsFront() {
+		return isFront;
+	}
+
+	public void setIsFront(Boolean isFront) {
+		this.isFront = isFront;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getRootColumnId() {
+		return rootColumnId;
+	}
+
+	public void setRootColumnId(String rootColumnId) {
+		this.rootColumnId = rootColumnId;
+	}
+
+	public String getColumnId() {
+		return columnId;
+	}
+
+	public void setColumnId(String columnId) {
+		this.columnId = columnId;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getPublisher() {
+		return publisher;
+	}
+
+	public void setPublisher(String publisher) {
+		this.publisher = publisher;
+	}
+
+	public String getStartDate() {
+		return startDate;
+	}
+
+	public void setStartDate(String startDate) {
+		this.startDate = startDate;
+	}
+
+	public String getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(String endDate) {
+		this.endDate = endDate;
+	}
+
+	public String getDeleteFlag() {
+		return deleteFlag;
+	}
+
+	public void setDeleteFlag(String deleteFlag) {
+		this.deleteFlag = deleteFlag;
+	}
+
+	public String getCreateDateSortCss() {
+		return createDateSortCss;
+	}
+
+	public void setCreateDateSortCss(String createDateSortCss) {
+		this.createDateSortCss = createDateSortCss;
+	}
+
+	public Integer getTop() {
+		return top;
+	}
+
+	public void setTop(Integer top) {
+		this.top = top;
+	}
+
+}

+ 44 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dto/ColumnInfoDTO.java

@@ -0,0 +1,44 @@
+package com.jeff.tianti.cms.dto;
+
+import java.util.List;
+
+import com.jeff.tianti.cms.entity.ColumnInfo;
+
+/**
+ * 栏目信息封装DTO
+ * @author Jeff Xu
+ *
+ */
+public class ColumnInfoDTO {
+	
+	private String id;
+		
+	private String name;
+	
+	private List<ColumnInfoDTO> childColumnInfoList;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public List<ColumnInfoDTO> getChildColumnInfoList() {
+		return childColumnInfoList;
+	}
+
+	public void setChildColumnInfoList(List<ColumnInfoDTO> childColumnInfoList) {
+		this.childColumnInfoList = childColumnInfoList;
+	}
+ 
+}

+ 78 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dto/ColumnInfoQueryDTO.java

@@ -0,0 +1,78 @@
+package com.jeff.tianti.cms.dto;
+
+import com.jeff.tianti.common.dto.CommonQueryDTO;
+
+/**
+ * @author xujianfang
+ * @desc ColumnInfoQueryDTO 
+ * @date 2017-03-16
+ */
+public class ColumnInfoQueryDTO extends CommonQueryDTO{
+	
+	//是否根据根节点模糊查询
+	private Boolean isRootColumnLike;
+	
+	//父级栏目ID
+	private String rootColumnId;
+	
+	//所属层级
+	private Integer level;
+	
+	//栏目编码
+	private String code;
+	
+	//code是否模糊搜索
+	private Boolean isCodeLike;
+	
+	//栏目名称
+	private String name;
+	
+	public Boolean getIsRootColumnLike() {
+		return isRootColumnLike;
+	}
+
+	public void setIsRootColumnLike(Boolean isRootColumnLike) {
+		this.isRootColumnLike = isRootColumnLike;
+	}
+
+	public String getRootColumnId() {
+		return rootColumnId;
+	}
+
+	public void setRootColumnId(String rootColumnId) {
+		this.rootColumnId = rootColumnId;
+	}
+
+	public Integer getLevel() {
+		return level;
+	}
+
+	public void setLevel(Integer level) {
+		this.level = level;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Boolean getIsCodeLike() {
+		return isCodeLike;
+	}
+
+	public void setIsCodeLike(Boolean isCodeLike) {
+		this.isCodeLike = isCodeLike;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+}

+ 56 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/dto/CurrentArticleInfoDTO.java

@@ -0,0 +1,56 @@
+package com.jeff.tianti.cms.dto;
+
+import java.util.Date;
+
+/**
+ * 当前文章信息封装
+ * @author Jeff Xu
+ * @since 2017-04-10
+ */
+public class CurrentArticleInfoDTO {
+	
+	//文章ID
+	private String articleId;
+	
+	//文章所属栏目ID
+	private String columnId;
+	
+	//时间
+	private Date articleDate;
+	
+	//当前文章的排序
+	private Integer orderNo;
+
+	public String getArticleId() {
+		return articleId;
+	}
+
+	public void setArticleId(String articleId) {
+		this.articleId = articleId;
+	}
+
+	public String getColumnId() {
+		return columnId;
+	}
+
+	public void setColumnId(String columnId) {
+		this.columnId = columnId;
+	}
+
+	public Date getArticleDate() {
+		return articleDate;
+	}
+
+	public void setArticleDate(Date articleDate) {
+		this.articleDate = articleDate;
+	}
+
+	public Integer getOrderNo() {
+		return orderNo;
+	}
+
+	public void setOrderNo(Integer orderNo) {
+		this.orderNo = orderNo;
+	}
+
+}

+ 200 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/entity/Article.java

@@ -0,0 +1,200 @@
+package com.jeff.tianti.cms.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import com.jeff.tianti.common.entity.BaseEntity;
+/**
+ * 文章信息实体
+ * @author Jeff Xu
+ */
+@Entity
+@Table(name = "cms_article")
+public class Article extends BaseEntity{
+
+	private static final long serialVersionUID = -2268477115365746554L;
+	
+	//普通文章(内容自己发布,可以选择封面图片)
+	public static final Integer ARTICLE_TYPE_COMMON = 0;
+	
+	//外链文章(内容直接跳走)
+    public static final Integer ARTICLE_TYPE_HREF = 1;
+    
+    //广告位文章
+    public static final Integer ARTICLE_TYPE_AD =2;
+		
+	//所属栏目(叶子栏目)
+	private ColumnInfo columnInfo;
+	
+	//所属栏目(根栏目)
+	private ColumnInfo rootColumnInfo;
+	
+	//文章类型
+	private Integer type;
+	
+	//标题
+	private String title;
+	
+	//内容
+	private String content;
+	
+	//摘要
+	private String summary;
+	
+	//来源
+	private String sourceFrom;
+	
+	//发布者
+	private String publisher;
+	
+	//外链
+	private String href;
+	
+	//封面
+	private String coverImageUrl;
+	
+	//是否置顶
+	private Boolean isTop;
+	
+	//是否审核
+	private Boolean isAudit;
+	
+	//阅读数
+	private Integer viewCount;
+	
+	//排序
+	private Integer orderNo;
+
+	@ManyToOne
+	@JoinColumn(name = "column_info_id")
+	public ColumnInfo getColumnInfo() {
+		return columnInfo;
+	}
+
+	public void setColumnInfo(ColumnInfo columnInfo) {
+		this.columnInfo = columnInfo;
+	}
+
+	@ManyToOne
+	@JoinColumn(name = "root_column_info_id")
+	public ColumnInfo getRootColumnInfo() {
+		return rootColumnInfo;
+	}
+
+	public void setRootColumnInfo(ColumnInfo rootColumnInfo) {
+		this.rootColumnInfo = rootColumnInfo;
+	}
+
+	@Column(name = "type")
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	@Column(length = 256)
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	@Lob
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	@Column(length = 512)
+	public String getSummary() {
+		return summary;
+	}
+
+	public void setSummary(String summary) {
+		this.summary = summary;
+	}
+
+	@Column(name = "source_from",length = 64)
+	public String getSourceFrom() {
+		return sourceFrom;
+	}
+
+	public void setSourceFrom(String sourceFrom) {
+		this.sourceFrom = sourceFrom;
+	}
+
+	@Column(length = 64)
+	public String getPublisher() {
+		return publisher;
+	}
+
+	public void setPublisher(String publisher) {
+		this.publisher = publisher;
+	}
+
+	@Column(length = 128)
+	public String getHref() {
+		return href;
+	}
+
+	public void setHref(String href) {
+		this.href = href;
+	}
+
+	@Column(name = "cover_image_url",length = 128)
+	public String getCoverImageUrl() {
+		return coverImageUrl;
+	}
+
+	public void setCoverImageUrl(String coverImageUrl) {
+		this.coverImageUrl = coverImageUrl;
+	}
+
+	@Column(name = "is_top")
+	public Boolean getIsTop() {
+		return isTop;
+	}
+
+	public void setIsTop(Boolean isTop) {
+		this.isTop = isTop;
+	}
+
+	@Column(name = "is_audit")
+	public Boolean getIsAudit() {
+		return isAudit;
+	}
+
+	public void setIsAudit(Boolean isAudit) {
+		this.isAudit = isAudit;
+	}
+
+	@Column(name = "view_count")
+	public Integer getViewCount() {
+		return viewCount;
+	}
+
+	public void setViewCount(Integer viewCount) {
+		this.viewCount = viewCount;
+	}
+
+	@Column(name = "order_no")
+	public Integer getOrderNo() {
+		return orderNo;
+	}
+
+	public void setOrderNo(Integer orderNo) {
+		this.orderNo = orderNo;
+	}
+
+}

+ 129 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/entity/ColumnInfo.java

@@ -0,0 +1,129 @@
+package com.jeff.tianti.cms.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import com.jeff.tianti.common.entity.BaseEntity;
+/**
+ * 栏目信息实体
+ * @author Jeff Xu
+ */
+@Entity
+@Table(name = "cms_column_info")
+public class ColumnInfo extends BaseEntity{
+
+	private static final long serialVersionUID = 8427391463279205799L;
+	
+	//用于PC渠道
+	public static final Integer CHANNEL_PC = 0;
+	
+	//用于H5渠道
+	public static final Integer CHANNEL_H5 = 1;
+	
+	//顶级
+	public static final Integer LEVEL_ROOT = 0;
+	
+	//叶子级
+	public static final Integer LEVEL_LEAF = 1;
+	
+	//编码(一个机构里面必须是唯一的)
+	private String code;
+	
+	//栏目icon
+	private String icon;
+	
+	//名称
+	private String name;
+	
+	//所属层级
+	private Integer level;
+	
+	//绝对路径
+	private String path;
+	
+	//父级栏目
+	private ColumnInfo parent;
+	
+	//渠道
+	private Integer channel;
+	
+	//排序
+	private Integer orderNo;
+
+	@Column(length = 20)
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	@Column(length = 128)
+	public String getIcon() {
+		return icon;
+	}
+
+	public void setIcon(String icon) {
+		this.icon = icon;
+	}
+
+	@Column(length = 32)
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	@Column(name = "level")
+	public Integer getLevel() {
+		return level;
+	}
+
+	public void setLevel(Integer level) {
+		this.level = level;
+	}
+
+	@Column(length = 512)
+	public String getPath() {
+		return path;
+	}
+
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	@ManyToOne
+	@JoinColumn(name = "parent_id")
+	public ColumnInfo getParent() {
+		return parent;
+	}
+
+	public void setParent(ColumnInfo parent) {
+		this.parent = parent;
+	}
+
+	@Column(name = "channel")
+	public Integer getChannel() {
+		return channel;
+	}
+
+	public void setChannel(Integer channel) {
+		this.channel = channel;
+	}
+
+	@Column(name = "order_no")
+	public Integer getOrderNo() {
+		return orderNo;
+	}
+
+	public void setOrderNo(Integer orderNo) {
+		this.orderNo = orderNo;
+	}
+
+}

+ 62 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/service/ArticleService.java

@@ -0,0 +1,62 @@
+package com.jeff.tianti.cms.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.jeff.tianti.cms.dao.ArticleDao;
+import com.jeff.tianti.cms.dto.ArticleQueryDTO;
+import com.jeff.tianti.cms.dto.CurrentArticleInfoDTO;
+import com.jeff.tianti.cms.entity.Article;
+import com.jeff.tianti.common.entity.PageModel;
+import com.jeff.tianti.common.service.CommonService;
+/**
+ * @author xujianfang
+ * @desc ArticleService类 
+ * @date 2017-03-16
+ */
+@Service
+public class ArticleService extends CommonService< Article,String >  {
+
+    @Autowired
+    private ArticleDao articleDao;
+
+    @Autowired
+    public void setArticleDao(ArticleDao articleDao){
+      super.setCommonDao(articleDao);
+    }
+
+    public PageModel<Article> queryArticlePage(ArticleQueryDTO articleQueryDTO){
+           return this.articleDao.queryArticlePage(articleQueryDTO);
+    }
+
+    public List<Article> queryArticleList(ArticleQueryDTO articleQueryDTO){
+           return this.articleDao.queryArticleList(articleQueryDTO);
+    }
+    
+    public List<Map<String, Object>> queryStatisMapList(ArticleQueryDTO articleQueryDTO){
+    	   return this.articleDao.queryStatisMapList(articleQueryDTO);
+    }
+    
+    public Article queryNextArticle(CurrentArticleInfoDTO currentArticleInfoDTO){
+    	   Article article = null;
+    	   List<Article> articleList = this.articleDao.queryNextArticleList(currentArticleInfoDTO);
+    	   if(articleList != null && articleList.size() > 0){
+    		   article = articleList.get(0);
+    	   }
+    	   return article;
+    }
+    
+    public Article queryPreArticle(CurrentArticleInfoDTO currentArticleInfoDTO){
+           Article article = null;
+           List<Article> articleList = this.articleDao.queryPreArticleList(currentArticleInfoDTO);
+           if(articleList != null && articleList.size() > 0){
+    		   article = articleList.get(0);
+    	   }
+    	   return article;
+    }
+
+
+}

+ 36 - 0
tianti-cms/src/main/java/com/jeff/tianti/cms/service/ColumnInfoService.java

@@ -0,0 +1,36 @@
+package com.jeff.tianti.cms.service;
+
+import com.jeff.tianti.cms.entity.ColumnInfo;
+import com.jeff.tianti.cms.dao.ColumnInfoDao;
+import com.jeff.tianti.cms.dto.ColumnInfoQueryDTO;
+import com.jeff.tianti.common.service.CommonService;
+import com.jeff.tianti.common.entity.PageModel;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+/**
+ * @author xujianfang
+ * @desc ColumnInfoService类 
+ * @date 2017-03-16
+ */
+@Service
+public class ColumnInfoService extends CommonService< ColumnInfo,String >  {
+
+    @Autowired
+    private ColumnInfoDao columnInfoDao;
+
+    @Autowired
+    public void setColumnInfoDao(ColumnInfoDao columnInfoDao){
+      super.setCommonDao(columnInfoDao);
+    }
+
+    public PageModel<ColumnInfo> queryColumnInfoPage(ColumnInfoQueryDTO columnInfoQueryDTO){
+           return this.columnInfoDao.queryColumnInfoPage(columnInfoQueryDTO);
+    }
+
+    public List<ColumnInfo> queryColumnInfoList(ColumnInfoQueryDTO columnInfoQueryDTO){
+           return this.columnInfoDao.queryColumnInfoList(columnInfoQueryDTO);
+    }
+
+
+}

+ 1 - 0
tianti-common/.gitignore

@@ -0,0 +1 @@
+/target/

+ 16 - 0
tianti-common/pom.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>com.jeff</groupId>
+    <artifactId>tianti</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <groupId>com.jeff.tianti.common</groupId>
+  <artifactId>tianti-common</artifactId>
+  <version>${tianti.version}</version>
+  <name>tianti-common</name>
+  <url>http://maven.apache.org</url>
+  
+</project>

+ 17 - 0
tianti-common/src/main/java/com/jeff/tianti/common/dao/CommonDao.java

@@ -0,0 +1,17 @@
+package com.jeff.tianti.common.dao;
+
+import java.io.Serializable;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.NoRepositoryBean;
+
+/**
+ * 基础Dao接口定义
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+@NoRepositoryBean
+public interface CommonDao<E,ID extends Serializable>  extends JpaRepository<E,ID>, JpaSpecificationExecutor<E> {
+
+}

+ 527 - 0
tianti-common/src/main/java/com/jeff/tianti/common/dao/CustomBaseSqlDaoImpl.java

@@ -0,0 +1,527 @@
+package com.jeff.tianti.common.dao;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.hibernate.SQLQuery;
+import org.hibernate.criterion.CriteriaSpecification;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.jeff.tianti.common.entity.PageModel;
+
+public class CustomBaseSqlDaoImpl {
+	
+	@Autowired
+	private EntityManager em;
+	
+	public List<Map<String, Object>> querySqlObjects(String sql, Integer currentPage,Integer rowsInPage){
+		return this.querySqlObjects(sql, null, currentPage, rowsInPage);
+	}
+	
+	public List<Map<String, Object>> querySqlObjects(String sql){
+		return this.querySqlObjects(sql, null, null, null);
+	}
+	
+	public List<Map<String, Object>> querySqlObjects(String sql, List<Object> params){
+		return this.querySqlObjects(sql, params, null, null);
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List<Map<String, Object>> querySqlObjects(String sql, Object params, Integer currentPage,Integer rowsInPage){
+		Query qry = em.createNativeQuery(sql);
+		SQLQuery s = qry.unwrap(SQLQuery.class);
+		
+		//设置参数
+		if(params != null){
+			if(params instanceof List){
+				List<Object> paramList = (List<Object>) params;
+				for(int i = 0, size = paramList.size(); i < size; i++){
+					qry.setParameter(i+1, paramList.get(i));
+				}
+			}else if(params instanceof Map){
+				Map<String, Object> paramMap = (Map<String, Object>) params;
+				for(String key : paramMap.keySet()){
+					qry.setParameter(key, paramMap.get(key));
+				}
+			}
+		}
+		
+		if (currentPage != null && rowsInPage != null) {//判断是否有分页
+			// 起始对象位置
+			qry.setFirstResult(rowsInPage * (currentPage - 1));
+			// 查询对象个数
+			qry.setMaxResults(rowsInPage);
+		}
+		s.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
+		List<Map<String, Object>> resultList=new ArrayList<Map<String, Object>>();
+		try {
+			resultList=s.list();
+		} catch (Exception e) {
+		}finally{
+			em.close();
+		}
+		return resultList;
+	}
+	
+	public PageModel<Map<String, Object>> querySqlObjects(String sql,
+			String sbCount, Map<String, Object> params, Integer currentPage,Integer rowsInPage){
+		PageModel<Map<String, Object>> pageModel = new PageModel<Map<String, Object>>();
+		
+		List<Map<String, Object>> list = this.querySqlObjects(sql, params, currentPage, rowsInPage);
+
+		pageModel.setList(list);
+		
+		if(currentPage == null || rowsInPage == null){
+			pageModel.setTotalCount(list == null ? 0 : list.size());
+		}else{
+			Integer count = this.queryCountBySql(sbCount, params);
+			
+			pageModel.setCurrentPage(currentPage);
+			pageModel.setTotalCount(count);
+			pageModel.setPageSize(rowsInPage);
+			
+			int totalPage = 0;
+			if(count%rowsInPage == 0){
+				totalPage = count / rowsInPage;
+			}else{
+				totalPage = count / rowsInPage + 1;
+			}
+			
+			pageModel.setTotalPage(totalPage);
+		}
+		
+		
+		return pageModel;
+	}
+	
+	
+	public int getCount(String sql){
+		String sqlCount="select count(0) count_num from ("+sql+") as total";
+		List<Map<String, Object>> list = this.querySqlObjects(sqlCount);
+		if(list.size() > 0){
+			int countNum=((BigInteger) list.get(0).get("count_num")).intValue();
+			return countNum;
+		}else{
+			return 0;
+		}
+	}
+	
+	/**
+	 * 处理sql语句
+	 * 
+	 * @param _strSql
+	 * @return
+	 */
+	public String toSql(String _strSql) {
+		String strNewSql = _strSql;
+
+		if (strNewSql != null) {
+			strNewSql = regReplace("'", "''", strNewSql);
+		} else {
+			strNewSql = "";
+		}
+
+		return strNewSql;
+	}
+
+	private String regReplace(String strFind, String strReplacement, String strOld) {
+		String strNew = strOld;
+		Pattern p = null;
+		Matcher m = null;
+		try {
+			p = Pattern.compile(strFind);
+			m = p.matcher(strOld);
+			strNew = m.replaceAll(strReplacement);
+		} catch (Exception e) {
+		}
+
+		return strNew;
+	}
+	
+	/**
+	 * 根据hql语句查询数据
+	 * @param hql
+	 * @return
+	 */
+	@SuppressWarnings("rawtypes")
+	public List queryForList(String hql, List<Object> params){
+		Query query = em.createQuery(hql);
+		List list = null;
+		try {
+			if(params != null && !params.isEmpty()){
+				for(int i=0,size=params.size();i<size;i++){
+					query.setParameter(i+1, params.get(i));
+				}
+			}
+			list = query.getResultList();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}
+		return list;
+	}
+	
+	@SuppressWarnings("rawtypes")
+	public List queryByMapParams(String hql, Map<String, Object> params, Integer currentPage,Integer pageSize){
+		//EntityManager em = this.emf.createEntityManager();
+		Query query = em.createQuery(hql);
+		List list = null;
+		try {
+			if(params != null && !params.isEmpty()){
+				for(Map.Entry<String,Object> entry: params.entrySet()){
+					query.setParameter(entry.getKey(), entry.getValue());
+				}
+			}
+			
+			if(currentPage != null && pageSize != null){
+				query.setFirstResult((currentPage-1)*pageSize);
+				query.setMaxResults(pageSize);
+			}
+			list = query.getResultList();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}
+		
+		return list;
+	}
+	
+	@SuppressWarnings("rawtypes")
+	public List queryByMapParams(String hql, Map<String, Object> params){
+		return queryByMapParams(hql, params, null, null);
+	}
+	
+	@SuppressWarnings("rawtypes")
+	public List queryForList(String hql){
+		return queryForList(hql, null);
+	}
+	
+	/**
+	 * 根据hql语句和分页条件查找分页数据
+	 * @param hql
+	 * @param currentPage
+	 * @param pageSize
+	 * @return
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public PageModel queryForPage(String hql,int currentPage,int pageSize){
+		PageModel page = new PageModel();
+		List list = null;
+		Integer totalCount = 0;
+		Integer totalPage = 0; //总页数
+		try {
+			int firstResult = (currentPage-1)*pageSize;
+			Query query = em.createQuery(hql);
+			query.setMaxResults(pageSize);
+			query.setFirstResult(firstResult);
+			list = query.getResultList();
+			
+			Query query2 = em.createQuery(hql);
+			List list2 = query2.getResultList();
+			totalCount = (list2 == null) ? 0 : list2.size();
+			if(totalCount % pageSize == 0){
+				totalPage = totalCount/pageSize;
+			}else{
+				totalPage = totalCount/pageSize + 1;
+			}
+			
+			page.setCurrentPage(currentPage);
+			page.setList(list);
+			page.setPageSize(pageSize);
+			page.setTotalCount(totalCount);
+			page.setTotalPage(totalPage);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}		
+		return page;
+	}
+	
+	/**
+	 * 
+	 * @param hql
+	 * @param hqlCount  查询所有数据的hql
+	 * @param params
+	 * @param currentPage
+	 * @param pageSize
+	 * @return
+	 */
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public PageModel queryForPageWithParams(String hql, String hqlCount, Map<String,Object> params, int currentPage,int pageSize){
+		PageModel page = new PageModel();
+		List<Object> list = null;
+		Integer totalCount = 0;
+		Integer totalPage = 0;
+		
+		//EntityManager em = this.emf.createEntityManager();
+		Query query = em.createQuery(hql);
+		
+		try {
+			
+			if(params != null){
+				for(Map.Entry<String,Object> entry: params.entrySet()){
+					query.setParameter(entry.getKey(), entry.getValue());
+				}
+			}
+			
+			query.setMaxResults(pageSize);
+			query.setFirstResult((currentPage-1)*pageSize);
+			list = query.getResultList();
+			
+			
+			totalCount = this.queryCount(hqlCount, params).intValue();
+			if(totalCount % pageSize == 0){
+				totalPage = totalCount/pageSize;
+			}else{
+				totalPage = totalCount/pageSize + 1;
+			}
+			
+			page.setCurrentPage(currentPage);
+			page.setPageSize(pageSize);
+			page.setList(list);
+			page.setTotalCount(totalCount);
+			page.setTotalPage(totalPage);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}			
+		return page;
+	}
+	
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	public PageModel queryForPageWithParams(String hql,Map<String,Object> params, int currentPage,int pageSize){
+		PageModel page = new PageModel();
+		List<Object> list = null;
+		Integer totalCount = 0;
+		Integer totalPage = 0;
+		
+		//EntityManager em = this.emf.createEntityManager();
+		Query query = em.createQuery(hql);
+		
+		try {
+			
+			if(params != null){
+				for(Map.Entry<String,Object> entry: params.entrySet()){
+					query.setParameter(entry.getKey(), entry.getValue());
+				}
+			}
+			
+			query.setMaxResults(pageSize);
+			query.setFirstResult((currentPage-1)*pageSize);
+			list = query.getResultList();
+			
+			Query queryTotal = em.createQuery(hql);
+			
+			if(params != null){
+				for(Map.Entry<String,Object> entry: params.entrySet()){
+					queryTotal.setParameter(entry.getKey(), entry.getValue());
+				}
+			}
+			
+			List<Object> totlaList = queryTotal.getResultList(); 
+			totalCount = (totlaList == null) ? 0 : totlaList.size();
+			if(totalCount % pageSize == 0){
+				totalPage = totalCount/pageSize;
+			}else{
+				totalPage = totalCount/pageSize + 1;
+			}
+			
+			page.setCurrentPage(currentPage);
+			page.setPageSize(pageSize);
+			page.setList(list);
+			page.setTotalCount(totalCount);
+			page.setTotalPage(totalPage);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}			
+		return page;
+	}
+
+        /**
+	 * 根据SQL语句查询分页
+	 * @param sql
+	 * @param currentPage
+	 * @param pageSize
+	 * @return
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public PageModel queryForPageBySql(String sql,Integer currentPage,Integer pageSize){
+		PageModel page = new PageModel();
+		Integer totalCount = 0;
+		Integer totalPage = 0;
+		
+		//EntityManager em = this.emf.createEntityManager();
+		Query qry = em.createNativeQuery(sql);
+		Query qry2 = em.createNativeQuery(sql);
+		SQLQuery s = qry.unwrap(SQLQuery.class);
+		if (currentPage != null && pageSize != null) {//判断是否有分页
+			// 起始对象位置
+			qry.setFirstResult(pageSize * (currentPage - 1));
+			// 查询对象个数
+			qry.setMaxResults(pageSize);
+		}
+		s.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
+		List<Map> resultList=new ArrayList<Map>();
+		List list = qry2.getResultList();
+		totalCount = (list == null ? 0 : list.size());
+		if(totalCount % pageSize == 0){
+			totalPage = totalCount/pageSize;
+		}else{
+			totalPage = totalCount/pageSize + 1;
+		}
+		try {
+			resultList=s.list();
+			page.setCurrentPage(currentPage);
+			page.setPageSize(pageSize);
+			page.setList(resultList);
+			page.setTotalCount(totalCount);
+			page.setTotalPage(totalPage);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}		
+		return page;
+	}
+	
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public PageModel queryForPageBySql(String sql,Map<String,Object> params,Integer currentPage,Integer pageSize){
+		PageModel page = new PageModel();
+		Integer totalCount = 0;
+		Integer totalPage = 0;
+		
+		Query qry = em.createNativeQuery(sql);
+		Query qry2 = em.createNativeQuery(sql);
+		
+		for(Map.Entry<String,Object> entry: params.entrySet()){
+			qry.setParameter(entry.getKey(), entry.getValue());
+			qry2.setParameter(entry.getKey(), entry.getValue());
+		}
+		
+		SQLQuery s = qry.unwrap(SQLQuery.class);
+		if (currentPage != null && pageSize != null) {//判断是否有分页
+			// 起始对象位置
+			qry.setFirstResult(pageSize * (currentPage - 1));
+			// 查询对象个数
+			qry.setMaxResults(pageSize);
+		}
+		s.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
+		List<Map> resultList=new ArrayList<Map>();
+		List list = qry2.getResultList();
+		totalCount = (list == null ? 0 : list.size());
+		if(totalCount % pageSize == 0){
+			totalPage = totalCount/pageSize;
+		}else{
+			totalPage = totalCount/pageSize + 1;
+		}
+		try {
+			resultList=s.list();
+			page.setCurrentPage(currentPage);
+			page.setPageSize(pageSize);
+			page.setList(resultList);
+			page.setTotalCount(totalCount);
+			page.setTotalPage(totalPage);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}		
+		return page;
+	}
+	
+	/**
+	 * 查询总数
+	 * @param hql
+	 * @param params
+	 * @return
+	 */
+	public Long queryCount(String hql, Map<String, Object> params){
+		//EntityManager em = this.emf.createEntityManager();
+		Query query = em.createQuery(hql);
+		Long count = null;
+		try{
+			if(params != null && !params.isEmpty()){
+				for(Map.Entry<String,Object> entry: params.entrySet()){
+					query.setParameter(entry.getKey(), entry.getValue());
+				}
+			}
+			count = (Long) query.getSingleResult();
+		}catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			em.close();
+		}
+		
+		return count;
+	}
+	
+	/**
+	 * 查询总数
+	 * @param hql
+	 * @param params
+	 * @return
+	 */
+	public Integer queryCountBySql(String sql, Map<String, Object> params){
+		Integer count = null;
+		try {
+			Query query = em.createNativeQuery(sql);
+			if(params != null && !params.isEmpty()){
+				for(Map.Entry<String,Object> entry: params.entrySet()){
+					query.setParameter(entry.getKey(), entry.getValue());
+				}
+			}
+			
+			Object obj = query.getSingleResult();
+			if(obj instanceof BigInteger){
+				count = ((BigInteger) obj).intValue();
+			}else{
+				count = (Integer) obj;
+			}
+			 
+		} finally {
+			if(em != null){
+				em.close();
+			}
+		}
+		return count;
+	}
+	
+	/**
+	 * select count(*) from table 
+	 * @param sql
+	 * @param params
+	 * @return
+	 */
+	public int executeSql(String sql, List<Object> params){
+		try {
+			Query query = em.createNativeQuery(sql);
+			if(params != null && !params.isEmpty()){
+				for(int i = 0, size = params.size(); i < size; i++){
+					query.setParameter(i+1, params.get(i));
+				}
+			}
+			return query.executeUpdate();
+		} finally {
+			if(em != null){
+				em.close();
+			}
+		}
+	}
+	
+
+}

+ 35 - 0
tianti-common/src/main/java/com/jeff/tianti/common/dto/AjaxResult.java

@@ -0,0 +1,35 @@
+package com.jeff.tianti.common.dto;
+
+public class AjaxResult {
+
+	private boolean success;
+
+	private String msg;
+
+	private Object data;
+
+	public boolean isSuccess() {
+		return success;
+	}
+
+	public void setSuccess(boolean success) {
+		this.success = success;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	public Object getData() {
+		return data;
+	}
+
+	public void setData(Object data) {
+		this.data = data;
+	}
+
+}

+ 59 - 0
tianti-common/src/main/java/com/jeff/tianti/common/dto/CommonQueryDTO.java

@@ -0,0 +1,59 @@
+package com.jeff.tianti.common.dto;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 公共信息查询封装DTO
+ * 
+ * @author Jeff Xu
+ * @since 2015-12-28
+ */
+public class CommonQueryDTO {
+
+	private Integer currentPage;
+
+	private Integer pageSize;
+
+	/**
+	 * 查询条件
+	 */
+	private Map<String, String> condition = new HashMap<String, String>();
+
+	public void addParam(String name, String value) {
+		condition.put(name, value);
+	}
+
+	public void addParams(Map<String, String> map) {
+		condition.putAll(map);
+	}
+
+	public void removeParam(String key) {
+		condition.remove(key);
+	}
+
+	public Map<String, String> getCondition() {
+		return condition;
+	}
+
+	public void setCondition(Map<String, String> condition) {
+		this.condition = condition;
+	}
+
+	public Integer getCurrentPage() {
+		return currentPage;
+	}
+
+	public void setCurrentPage(Integer currentPage) {
+		this.currentPage = currentPage;
+	}
+
+	public Integer getPageSize() {
+		return pageSize;
+	}
+
+	public void setPageSize(Integer pageSize) {
+		this.pageSize = pageSize;
+	}
+
+}

+ 132 - 0
tianti-common/src/main/java/com/jeff/tianti/common/entity/BaseEntity.java

@@ -0,0 +1,132 @@
+package com.jeff.tianti.common.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 定义实体的基础公共属性,所有实体都会继承.
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+@MappedSuperclass
+public class BaseEntity extends MysqlSequenceIdEntity implements Serializable{
+
+	private static final long serialVersionUID = -4498233384948128317L;
+
+	//逻辑删除标识位—已删除状态
+	public static final String DELETE_FLAG_DELETED = "1";
+	
+	//逻辑删除标识位—未删除状态
+	public static final String DELETE_FLAG_NORMAL = "0";
+	
+	//审核状态标识位—未审核
+	public static final String AUDIT_FLAG_NOT = "0";
+	
+	//审核状态标识位—审核通过
+	public static final String AUDIT_FLAG_PASS = "1";
+	
+	//审核状态标识位—审核通不过
+	public static final String AUDIT_FLAG_FAIL = "2";
+	
+	/**
+	 * 创建日期
+	 */
+	protected Date createDate;
+	/**
+	 * 修改日期
+	 */
+	protected Date updateDate;
+	
+	/**
+	 * 删除标志(0-正常,1-删除)
+	 * @return
+	 */
+	protected String deleteFlag;
+	
+	/**
+	 * 审核状态(0-未审核,1-审核通过,2-审核不通过)
+	 * @return
+	 */
+	protected String auditFlag;
+	
+	@Column(name = "create_date", updatable = false)
+	public Date getCreateDate() {
+		return createDate;
+	}
+	
+	public void setCreateDate(Date createDate) {
+		this.createDate = createDate;
+	}
+	
+	@Column(name = "update_date")
+	public Date getUpdateDate() {
+		return updateDate;
+	}
+	
+	public void setUpdateDate(Date updateDate) {
+		this.updateDate = updateDate;
+	}
+	
+	@Column(name = "delete_flag",length=1)
+	public String getDeleteFlag() {
+		return deleteFlag;
+	}
+	
+	public void setDeleteFlag(String deleteFlag) {
+		this.deleteFlag = deleteFlag;
+	}
+
+	@Column(name = "audit_flag",length=2)
+	public String getAuditFlag() {
+		return auditFlag;
+	}
+
+	public void setAuditFlag(String auditFlag) {
+		this.auditFlag = auditFlag;
+	}
+
+	@Override
+	public boolean equals(Object object) {
+		if (object == null) {
+			return false;
+		}
+		if (object instanceof BaseEntity) {
+			BaseEntity baseEntity = (BaseEntity) object;
+			if (this.getId() == null || baseEntity.getId() == null) {
+				return false;
+			} else {
+				return (this.getId().equals(baseEntity.getId()));
+			}
+		}
+		return false;
+	}
+	
+	@Override
+	public int hashCode() {
+		return id == null ? System.identityHashCode(this) : (this.getClass().getName() + this.getId()).hashCode();
+	}
+	
+	@PrePersist
+    public void prePersist() {
+		if(this.createDate == null){
+			this.setCreateDate(new Date());
+		}
+		this.setUpdateDate(new Date());
+		if(StringUtils.isBlank(this.getDeleteFlag())){
+			this.setDeleteFlag(BaseEntity.DELETE_FLAG_NORMAL);	
+		}
+    }
+ 
+    @PreUpdate
+    public void preUpdate() {
+    	this.setUpdateDate(new Date());
+    }
+	
+}

+ 13 - 0
tianti-common/src/main/java/com/jeff/tianti/common/entity/IdEntity.java

@@ -0,0 +1,13 @@
+package com.jeff.tianti.common.entity;
+
+import javax.persistence.MappedSuperclass;
+
+/**
+ * 统一定义实体的ID抽象类
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+@MappedSuperclass
+public class IdEntity {
+
+}

+ 29 - 0
tianti-common/src/main/java/com/jeff/tianti/common/entity/MysqlLongIdEntity.java

@@ -0,0 +1,29 @@
+package com.jeff.tianti.common.entity;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+
+/**
+ * Mysql数据库的主键生成定义:系统生成自增长整数型数据作为主键
+ * 
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+@MappedSuperclass
+public class MysqlLongIdEntity extends IdEntity {
+
+	protected Long id;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+}

+ 31 - 0
tianti-common/src/main/java/com/jeff/tianti/common/entity/MysqlSequenceIdEntity.java

@@ -0,0 +1,31 @@
+package com.jeff.tianti.common.entity;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+
+import org.hibernate.annotations.GenericGenerator;
+/**
+ * Mysql数据库的主键生成定义:系统自动生成32位不同的字符序列
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+@MappedSuperclass
+public class MysqlSequenceIdEntity extends IdEntity{
+	
+	protected String id;
+
+	@Id
+	@Column(length = 32, nullable = true)
+	@GenericGenerator(name = "sys_uuid", strategy = "uuid")
+	@GeneratedValue(generator = "sys_uuid")
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+}

+ 31 - 0
tianti-common/src/main/java/com/jeff/tianti/common/entity/OracleLongEntity.java

@@ -0,0 +1,31 @@
+package com.jeff.tianti.common.entity;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.SequenceGenerator;
+/**
+ * Oracle数据库的主键生成定义:系统生成自增长整数型数据作为主键
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+@MappedSuperclass
+public class OracleLongEntity extends IdEntity{
+	
+	protected Long id;
+
+	@Id
+	@SequenceGenerator(name = "ID_SEQ")
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_SEQ")
+	@Column(name = "ID", nullable = false)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+}

+ 82 - 0
tianti-common/src/main/java/com/jeff/tianti/common/entity/PageModel.java

@@ -0,0 +1,82 @@
+package com.jeff.tianti.common.entity;
+
+import java.io.Serializable;
+import java.util.List;
+/**
+ * 分页模型
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+public class PageModel<E> implements Serializable {
+	
+	private static final long serialVersionUID = 3265524976080127173L;
+
+	private int totalCount; //总记录数
+	
+	private int pageSize = 10; //每页显示的数量
+	
+	private int totalPage; //总页数
+	
+	private int currentPage = 1; //当前页数
+	
+	private List<E> list; //分页集合列表
+	
+	private String url; //分页跳转的URL
+	
+	public PageModel() {
+	}
+	
+	public PageModel(int pageSize) {
+		this.pageSize = pageSize;
+	}
+
+	public int getTotalCount() {
+		return totalCount;
+	}
+
+	public void setTotalCount(int totalCount) {
+		this.totalCount = totalCount;
+	}
+
+	public int getPageSize() {
+		return pageSize;
+	}
+
+	public void setPageSize(int pageSize) {
+		this.pageSize = pageSize;
+	}
+
+	public int getTotalPage() {
+		return totalPage;
+	}
+
+	public void setTotalPage(int totalPage) {
+		this.totalPage = totalPage;
+	}
+
+	public int getCurrentPage() {
+		return currentPage;
+	}
+
+	public void setCurrentPage(int currentPage) {
+		this.currentPage = currentPage;
+	}
+
+	public List<E> getList() {
+		return list;
+	}
+
+	public void setList(List<E> list) {
+		this.list = list;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+
+}

+ 162 - 0
tianti-common/src/main/java/com/jeff/tianti/common/service/CommonService.java

@@ -0,0 +1,162 @@
+package com.jeff.tianti.common.service;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+
+import com.jeff.tianti.common.dao.CommonDao;
+/**
+ * 基础Service的定义
+ * @author Jeff Xu
+ * @since 2015-12-09
+ * @param <E>
+ * @param <ID>
+ */
+public abstract class CommonService<E,ID extends Serializable>  {
+	
+	protected CommonDao<E,ID> commonDao;
+
+	public void setCommonDao(CommonDao<E, ID> commonDao) {
+		this.commonDao = commonDao;
+	}
+
+	public CommonDao<E, ID> getCommonDao() {
+		return commonDao;
+	}
+	
+	/**
+	 * 根据ID获取某个Entity
+	 * @param id
+	 * @return
+	 */
+	public E get(ID id) {
+		return commonDao.getOne(id);
+	}
+
+	/**
+	 * 根据ID查找某个Entity(建议使用)
+	 * @param id
+	 * @return
+	 */
+	public E find(ID id) {
+		return commonDao.findOne(id);
+	}
+
+	/**
+	 * 获取所有的Entity列表
+	 * @return
+	 */
+	public List<E> getAll() {
+		return commonDao.findAll();
+	}
+	
+	/**
+	 * 获取Entity的总数
+	 * @return
+	 */
+	public Long getTotalCount() {
+		return commonDao.count();
+	}
+
+	/**
+	 * 保存Entity
+	 * @param entity
+	 * @return
+	 */
+	public E save(E entity) {
+		return commonDao.save(entity);
+	}
+
+	/**
+	 * 修改Entity
+	 * @param entity
+	 * @return
+	 */
+	public E update(E entity) {
+		return commonDao.save(entity);
+	}
+	
+	/**
+	 * 删除Entity
+	 * @param entity
+	 */
+	public void delete(E entity) {
+		commonDao.delete(entity);
+	}
+
+	/**
+	 * 根据Id删除某个Entity
+	 * @param id
+	 */
+	public void delete(ID id) {
+		commonDao.delete(id);
+	}
+
+	/**
+	 * 删除Entity的集合类
+	 * @param entities
+	 */
+	public void delete(Collection<E> entities) {
+		commonDao.delete(entities);
+	}
+
+	/**
+	 * 清空缓存,提交持久化
+	 */
+	public void flush() {
+		commonDao.flush();
+	}
+	
+	/**
+	 * 根据查询信息获取某个Entity的列表
+	 * @param spec
+	 * @return
+	 */
+	public List<E> findAll(Specification<E> spec) {
+		return commonDao.findAll(spec);
+	}
+	
+	/**
+	 * 获取Entity的分页信息
+	 * @param pageable
+	 * @return
+	 */
+	public Page<E> findAll(Pageable pageable){
+		return commonDao.findAll(pageable);
+	}
+	
+	/**
+	 * 根据查询条件和分页信息获取某个结果的分页信息
+	 * @param spec
+	 * @param pageable
+	 * @return
+	 */
+	public Page<E> findAll(Specification<E> spec, Pageable pageable) {
+		return commonDao.findAll(spec, pageable);
+	}
+	
+	/**
+	 * 根据查询条件和排序条件获取某个结果集列表
+	 * @param spec
+	 * @param sort
+	 * @return
+	 */
+	public List<E> findAll(Specification<E> spec, Sort sort) {
+		return commonDao.findAll(spec);
+	}
+	
+	/**
+	 * 查询某个条件的结果数集
+	 * @param spec
+	 * @return
+	 */
+	public long count(Specification<E> spec) {
+		return commonDao.count(spec);
+	}
+
+}

+ 60 - 0
tianti-common/src/main/java/com/jeff/tianti/common/util/CommonUtils.java

@@ -0,0 +1,60 @@
+package com.jeff.tianti.common.util;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class CommonUtils {
+	
+	public static String obj2Str(Object obj){
+		if(obj == null){
+			return "";
+		}
+		return obj.toString().trim();
+	}
+	
+	public static Integer obj2Int(Object obj){
+		String str = String.valueOf(obj);
+		if(StringUtils.isNotBlank(str) && StringUtils.isNumeric(str)){
+			try {
+				return Integer.parseInt(str);
+			} catch (Exception e) {
+			}
+		}
+		return null;
+	}
+	
+	public static Boolean obj2Boolean(Object obj){
+		if(obj == null){
+			return null;
+		}
+		if("0".equals(obj.toString().trim())){
+			return false;
+		}else if("1".equals(obj.toString().trim())){
+			return true;
+		}
+		return null;
+	}
+	
+	public static Date obj2Date(Object obj){
+		Date date = null;
+		if(obj != null && obj instanceof Timestamp){
+			Timestamp timestamp = (Timestamp) obj;
+			date = new Date(timestamp.getTime());
+		}
+		return date;
+	}
+	
+	public static boolean isMobile(String mobiles){  
+	  
+		Pattern p = Pattern.compile("^((13[0-9])|(14[0-9])|(15[^4,\\D])|(17[0-9])|(18[0-9]))\\d{8}$");
+		
+		Matcher m = p.matcher(mobiles); 
+		
+		return m.matches();
+	}
+
+}

+ 267 - 0
tianti-common/src/main/java/com/jeff/tianti/common/util/DateUtils.java

@@ -0,0 +1,267 @@
+package com.jeff.tianti.common.util;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class DateUtils extends org.apache.commons.lang3.time.DateUtils{
+	
+private final static Log LOG = LogFactory.getLog(DateUtils.class);
+	
+	public final static DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd");
+	
+	public final static DateFormat dfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	
+	public final static DateFormat serialFormatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+	
+	public final static DateFormat dfLessonDate = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+	
+	public final static DateFormat dfHm = new SimpleDateFormat("HH:mm");
+	
+	public final static DateFormat dfYMD = new SimpleDateFormat("yyyyMMdd");
+	
+	public final static DateFormat dfYMDHMS = new SimpleDateFormat("yyyyMMddHHmmss");
+	
+	/**
+	 * 查询开始时间
+	 * @param source
+	 * @return
+	 */
+	public static Date getStartDate(String source){
+		if(StringUtils.isNotBlank(source)){
+			source = source.trim() + " 00:00:00";
+			return parseDateTime(source);
+		}
+		return null;
+	}
+	
+	public static Date getStartDate(Date date){
+		String source = dfDate.format(date);
+		return getStartDate(source);
+	}
+	
+	/**
+	 * 查询结束时间
+	 * @param source
+	 * @return
+	 */
+	public static Date getEndDate(String source){
+		if(StringUtils.isNotBlank(source)){
+			source = source.trim() + " 23:59:59";
+			return parseDateTime(source);
+		}
+		return null;
+	}
+	
+	public static Date getEndDate(Date date){
+		String source = dfDate.format(date);
+		return getEndDate(source);
+	}
+	
+	/**
+	 * 
+	 * @param source
+	 * @return
+	 */
+	public static Date parseDateTime(String source){
+		if(StringUtils.isBlank(source)){
+			return null;
+		}
+		Date date = null;
+		try {
+			date = dfDateTime.parse(source.trim());
+		} catch (ParseException e) {
+			LOG.error("解析时间异常:["+source+"] " + e.getMessage());
+		}
+		return date;
+	}
+	
+	/**
+	 * 
+	 * @param source
+	 * @return
+	 */
+	public static Date parseDate(String source){
+		if(StringUtils.isBlank(source)){
+			return null;
+		}
+		Date date = null;
+		try {
+			date = dfDate.parse(source.trim());
+		} catch (ParseException e) {
+			LOG.error("解析时间异常:["+source+"] " + e.getMessage());
+		}
+		return date;
+	}
+	
+	/**
+	 * 
+	 * @param source
+	 * @param pattern
+	 * @return
+	 */
+	public static Date parseDate(String source, String pattern){
+		if(StringUtils.isBlank(source)){
+			return null;
+		}
+		Date date = null;
+		try {
+			DateFormat dateFormat = new SimpleDateFormat(pattern);
+			date = dateFormat.parse(source.trim());
+		} catch (ParseException e) {
+			LOG.error("解析时间异常:["+source+"] " + e.getMessage());
+		}
+		return date;
+	}
+	
+	/**
+	 * 根据当前时间生成序列号
+	 * @return
+	 */
+	public synchronized static String serialNumber(){
+		return serialFormatter.format(new Date());
+	}
+
+	/**
+	 * 月第一天
+	 * @param date
+	 * @return
+	 */
+	public static Date getMonthStartDate(Date date){
+		Date d = new Date(date.getTime());
+		d = setHours(d, 0);
+		d = setMinutes(d, 0);
+		d = setSeconds(d, 1);
+		return setDays(d, 1);
+	}
+	
+	/**
+	 * 月最后一天
+	 * @param date
+	 * @return
+	 */
+	public static Date getMonthEndDate(Date date){
+		GregorianCalendar c = new GregorianCalendar();
+		c.setTime(date);
+		int maxMonth = c.getActualMaximum(Calendar.DAY_OF_MONTH);
+		c.set(Calendar.DAY_OF_MONTH, maxMonth);
+		c.set(Calendar.HOUR_OF_DAY, 23);
+		c.set(Calendar.MINUTE, 59);
+		c.set(Calendar.SECOND, 59);
+		return c.getTime();
+	}
+	
+	/**
+	 * 当前星期的第一天
+	 * @param date
+	 * @return
+	 */
+	public static Date getWeekStartDate(Date date){
+		GregorianCalendar c = new GregorianCalendar(Locale.CHINA);
+		c.setTime(date);
+		c.setFirstDayOfWeek(RANGE_WEEK_MONDAY);
+		c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
+		c.set(Calendar.HOUR_OF_DAY, 00);
+		c.set(Calendar.MINUTE, 00);
+		c.set(Calendar.SECOND, 00);
+		return c.getTime();
+	}
+	
+	/**
+	 * 当前星期的最后一天
+	 * @param date
+	 * @return
+	 */
+	public static Date getWeekEndDate(Date date){
+		GregorianCalendar c = new GregorianCalendar(Locale.CHINA);
+		c.setTime(date);
+		c.setFirstDayOfWeek(RANGE_WEEK_MONDAY);
+		c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
+		c.set(Calendar.HOUR_OF_DAY, 23);
+		c.set(Calendar.MINUTE, 59);
+		c.set(Calendar.SECOND, 59);
+		return c.getTime();
+	}
+	
+	public static Date getLessonDate(String source){
+		if(StringUtils.isBlank(source)){
+			return null;
+		}
+		Date date = null;
+		try {
+			date = dfLessonDate.parse(source);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return date;
+	}
+	
+	/**
+	 * 两个时间之间相差的月
+	 * @param date1
+	 * @param date2
+	 * @return
+	 * @throws ParseException
+	 */
+	public static int getMonthSpace(Date startDate, Date endDate){
+
+        int result = 0;
+
+        Calendar c1 = Calendar.getInstance();
+        Calendar c2 = Calendar.getInstance();
+
+        c1.setTime(startDate);
+        c2.setTime(endDate);
+
+        result = c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH);
+
+        return result;
+
+    }
+	
+	/**
+	 * 日期间隔多少天
+	 * @param early
+	 * @param late
+	 * @return
+	 */
+	public static final int daysBetween(Date early, Date late) { 
+	     
+        java.util.Calendar calst = java.util.Calendar.getInstance();   
+        java.util.Calendar caled = java.util.Calendar.getInstance();   
+        calst.setTime(early);   
+        caled.setTime(late);   
+         //设置时间为0时   
+         calst.set(java.util.Calendar.HOUR_OF_DAY, 0);   
+         calst.set(java.util.Calendar.MINUTE, 0);   
+         calst.set(java.util.Calendar.SECOND, 0);   
+         caled.set(java.util.Calendar.HOUR_OF_DAY, 0);   
+         caled.set(java.util.Calendar.MINUTE, 0);   
+         caled.set(java.util.Calendar.SECOND, 0);   
+        //得到两个日期相差的天数   
+         int days = ((int) (caled.getTime().getTime() / 1000) - (int) (calst   
+                .getTime().getTime() / 1000)) / 3600 / 24;   
+         
+        return days;   
+   } 
+
+	public static void main(String [] args){
+		try {
+			Date currentDate = dfDateTime.parse("2016-10-16 14:19:40");
+			Date startDate = DateUtils.getWeekStartDate(currentDate);
+			Date endDate = DateUtils.getWeekEndDate(currentDate);
+			System.out.println(startDate + "--" + endDate);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+	}
+
+}

+ 256 - 0
tianti-common/src/main/java/com/jeff/tianti/common/util/ExcelUtils.java

@@ -0,0 +1,256 @@
+package com.jeff.tianti.common.util;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+/**
+ * Excel工具类
+ * @author JeffXu
+ * @since 2015-02-02
+ */
+public class ExcelUtils {
+	
+	/**
+	 * 
+	 * @param response
+	 * @param fileName			文件名称
+	 * @param headNameMap		表头
+	 * @param list				DTO数据
+	 */
+	public static <T> void exportXlsxByBean(HttpServletResponse response, String fileName, 
+			Map<String, String> headNameMap, List<T> list){
+		
+		List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
+		
+		try {
+			for(T t: list){
+				Map<String, Object> map = new HashMap<String, Object>();
+				Field[] fields = t.getClass().getDeclaredFields();
+				if(fields != null){
+					for(Field field : fields){
+						field.setAccessible(true);
+						map.put(field.getName(), field.get(t));
+					}
+				}
+				dataList.add(map);
+			}
+		} catch (SecurityException e) {
+			e.printStackTrace();
+		} catch (IllegalArgumentException e) {
+			e.printStackTrace();
+		} catch (IllegalAccessException e) {
+			e.printStackTrace();
+		}
+		
+		exportXlsx(response, fileName, headNameMap, dataList);
+		
+	}
+	
+	/**
+	 * 
+	 * @param response
+	 * @param fileName
+	 * @param headNameMap
+	 * @param dataList
+	 */
+	public static void exportXlsx(HttpServletResponse response, String fileName, 
+			Map<String, String> headNameMap, List<Map<String, Object>> dataList){
+		
+		Workbook workbook = exportXlsx(fileName, headNameMap, dataList);
+		
+		response.setContentType("application/binary;charset=ISO8859_1");
+		
+		OutputStream outputStream = null;
+		
+		try {
+			outputStream = response.getOutputStream();
+			String fn = new String(fileName.getBytes(), "ISO8859_1");
+			response.setHeader("Content-disposition", "attachment; filename=" + fn  + ".xlsx");
+			workbook.write(outputStream);
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			if(outputStream != null){
+				try {
+					outputStream.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		
+	}
+	
+	/**
+	 * 导出数据
+	 * @param headNameMap
+	 * @param dataList
+	 */
+	public static Workbook exportXlsx(String sheetName, Map<String, String> headNameMap, List<Map<String, Object>> dataList){
+		
+		Workbook workbook = new XSSFWorkbook();
+		
+		Sheet sheet = workbook.createSheet(sheetName);
+		
+		Set<String> keys = headNameMap.keySet();
+		
+		int i = 0, j = 0;
+		Row row = sheet.createRow(i++);
+		//表头
+		for(String key : keys){
+			Cell cell = row.createCell(j++);
+			cell.setCellValue(headNameMap.get(key));
+		}
+		
+		//内容
+		if(dataList != null && !dataList.isEmpty()){
+			for(Map<String, Object> map : dataList){
+				row = sheet.createRow(i++);
+				j = 0;
+				for(String key : keys){
+					Cell cell = row.createCell(j++);
+					setCellValue(cell, map.get(key));
+				}
+			}
+		}
+		
+		return workbook;
+	}
+	
+	private static void setCellValue(Cell cell, Object obj){
+		if(obj == null){
+		}else if(obj instanceof String){
+			cell.setCellValue((String) obj);
+		}else if(obj instanceof Date){
+			Date date = (Date) obj;
+			if(date != null){
+				cell.setCellValue(DateUtils.dfDateTime.format(date));
+			}
+		}else if(obj instanceof Calendar){
+			Calendar calendar = (Calendar) obj;
+			if(calendar != null){
+				cell.setCellValue(DateUtils.dfDateTime.format(calendar.getTime()));
+			}
+		}else if(obj instanceof Timestamp){
+			Timestamp timestamp = (Timestamp) obj;
+			if(timestamp != null){
+				cell.setCellValue(DateUtils.dfDateTime.format(new Date(timestamp.getTime())));	
+			}
+		}else if(obj instanceof Double){
+			cell.setCellValue((Double) obj);
+		}else{
+			cell.setCellValue(obj.toString());
+		}
+	}
+	
+	/**
+	 * 读取excel
+	 * @param path
+	 * @param startIdx
+	 * @return
+	 */
+	public static List<List<String>> readXlsx(String path, int startIdx){
+		
+		try {
+			InputStream is = new FileInputStream(path);
+			
+			return readXlsx(is, startIdx);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+		return null;
+	}
+	
+	@SuppressWarnings("resource")
+	public static List<List<String>> readXlsx(InputStream is, int startIdx){
+		
+		List<List<String>> list = new ArrayList<List<String>>();
+		
+		try {
+			
+			XSSFWorkbook xssfWorkbook = new XSSFWorkbook(is);
+			
+			XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
+			if(xssfSheet == null){
+				return list;
+			}
+			
+			int endIdx = xssfSheet.getLastRowNum() + 1;
+			if(endIdx > startIdx){
+				for(; startIdx < endIdx; startIdx++){
+					XSSFRow xssfRow = xssfSheet.getRow(startIdx);
+					if(xssfRow != null){
+						List<String> rowList = new ArrayList<String>();
+						int colNum = xssfRow.getLastCellNum();
+						boolean isAdd = false;
+						for(int i=0; i<colNum; i++){
+							XSSFCell cell = xssfRow.getCell(i);
+							String str = getValue(cell);
+							rowList.add(str);
+							if(StringUtils.isNotBlank(str)){
+								isAdd = true;
+							}
+						}
+						if(isAdd){
+							list.add(rowList);	
+						}
+					}
+				}
+			}
+			
+		} catch (IOException e) {
+			e.printStackTrace();
+		} finally {
+			if(is != null){
+				try {
+					is.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		
+		return list;
+	}
+	
+	 private static String getValue(XSSFCell xssFCell) {
+		 String str = null;
+		 if(xssFCell == null){
+			 return str;
+		 }
+		 if (xssFCell.getCellType() == XSSFCell.CELL_TYPE_BOOLEAN) {
+			 str = String.valueOf(xssFCell.getBooleanCellValue());
+		 } else if (xssFCell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) {
+			 str = String.valueOf(new DecimalFormat("#").format(xssFCell.getNumericCellValue()));
+		 } else {
+			 str = String.valueOf(xssFCell.getStringCellValue());
+		 }
+		 return StringUtils.trim(str);
+	}
+
+}

+ 472 - 0
tianti-common/src/main/java/com/jeff/tianti/common/util/GenCodeUtil.java

@@ -0,0 +1,472 @@
+package com.jeff.tianti.common.util;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Dao、Service层代码自动生成工具类
+ * @author JeffXu 
+ * @since 2015-12-09
+ */
+public class GenCodeUtil {
+	
+	//公共部分
+		private static final String RT_1 = "\r\n";
+		private static final String RT_2 = RT_1+RT_1;
+		private static final String BLANK_1 =" ";
+		
+		//注释部分
+		private static final String ANNOTATION_AUTHOR_PARAMTER = "@author ";
+		private static final String ANNOTATION_DESC = "@desc ";
+		private static final String ANNOTATION_DATE = "@date ";
+		
+		/**
+		 * 创建查询信息封装DTO(用于后台的查询信息封装)
+		 * @param c实体类
+		 * @param commonPackage 基础包:如com.jeff.tianti.info
+		 * @param author 作者
+		 * @param desc 描述
+		 * @throws IOException
+		 */
+		public static void createQueryDTO(Class c,String commonPackage,String author) throws IOException{
+			String cName = c.getName();
+			String dtoPath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				dtoPath = commonPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + dtoPath+"/dto"
+						+ "/" + getLastChar(cName) + "QueryDTO.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				fw.write("package "+commonPackage+".dto"+";"+RT_2+"import com.jeff.tianti.common.dto.CommonQueryDTO;"+RT_2
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"QueryDTO"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+						+"public class " +getLastChar(cName) +"QueryDTO extends CommonQueryDTO{"+RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建"+getLastChar(cName)+"QueryDTO失败,原因是commonPackage为空!");
+			}
+		}
+		
+		/**
+		 * 创建查询信息封装DTO(用于前台的查询信息封装)
+		 * @param c实体类
+		 * @param commonPackage 基础包:如com.jeff.tianti.info
+		 * @param author 作者
+		 * @param desc 描述
+		 * @throws IOException
+		 */
+		public static void createFrontQueryDTO(Class c,String commonPackage,String author) throws IOException{
+			String cName = c.getName();
+			String dtoPath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				dtoPath = commonPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + dtoPath+"/dto"
+						+ "/" + getLastChar(cName) + "FrontQueryDTO.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				fw.write("package "+commonPackage+".dto"+";"+RT_2+"import com.jeff.tianti.common.dto.CommonQueryDTO;"+RT_2
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"QueryDTO"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+						+"public class " +getLastChar(cName) +"FrontQueryDTO extends CommonQueryDTO{"+RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建"+getLastChar(cName)+"FrontQueryDTO失败,原因是commonPackage为空!");
+			}
+		}
+
+		/**
+		 * 创建Dao接口
+		 * @param c实体类
+		 * @param commonPackage 基础包:如com.jeff.tianti.info
+		 * @param author 作者
+		 * @param desc 描述
+		 * @throws IOException
+		 */
+		public static void createDaoInterface(Class c,String commonPackage,String author) throws IOException{
+			String cName = c.getName();
+			String daoPath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				daoPath = commonPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + daoPath+"/dao"
+						+ "/" + getLastChar(cName) + "Dao.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				fw.write("package "+commonPackage+".dao"+";"+RT_2+"import "+commonPackage+".entity"+"."+getLastChar(cName)+";"+RT_1+"import com.jeff.tianti.common.dao.CommonDao;"+RT_2
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"Dao接口"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+						+"public interface " +getLastChar(cName) +"Dao extends "+getLastChar(cName)+"DaoCustom,CommonDao<"+getLastChar(cName)+",String>{"+RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建Dao接口失败,原因是commonPackage为空!");
+			}
+		}
+		
+		/**
+		 * 创建DaoCustom接口
+		 * @param c实体类
+		 * @param commonPackage 基础包:如com.jeff.tianti.info
+		 * @throws IOException
+		 */
+		public static void createDaoCustomInterface(Class c,String commonPackage,String author) throws IOException{
+			String cName = c.getName();
+			String daoPath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				daoPath = commonPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + daoPath+"/dao"
+						+ "/" + getLastChar(cName) + "DaoCustom.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				fw.write("package "+commonPackage+".dao"+";"+RT_2
+						+"import com.jeff.tianti.common.entity.PageModel;"+RT_1
+						+"import java.util.List;"+RT_1
+						+"import "+commonPackage+".entity"+"."+getLastChar(cName)+";"+RT_1
+						+"import "+commonPackage+".dto"+"."+getLastChar(cName)+"QueryDTO;"+RT_1
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"DaoCustom接口"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+						+"public interface " +getLastChar(cName) +"DaoCustom {"+RT_2
+						+"      PageModel<"+getLastChar(cName)+"> query"+getLastChar(cName)+"Page("+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO);"+RT_2
+						+"      List<"+getLastChar(cName)+"> query"+getLastChar(cName)+"List("+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO);"+RT_2
+						+RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建DaoCustom接口失败,原因是commonPackage为空!");
+			}
+			
+		}
+		
+		/**
+		 * 创建Dao类
+		 * @param c实体类
+		 * @param commonPackage 基础包:如com.jeff.tianti.info
+		 * @throws IOException
+		 */
+		public static void createDaoClass(Class c,String commonPackage,String author) throws IOException{
+			String cName = c.getName();
+			String daoPath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				daoPath = commonPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + daoPath+"/dao"
+						+ "/" + getLastChar(cName) + "DaoImpl.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				fw.write("package "+commonPackage+".dao"+";"+RT_2+"import com.jeff.tianti.common.dao.CustomBaseSqlDaoImpl;"+RT_1
+						+"import com.jeff.tianti.common.entity.PageModel;"+RT_1
+						+"import java.util.HashMap;"+RT_1
+						+"import java.util.List;"+RT_1
+						+"import java.util.Map;"+RT_1
+						+"import "+commonPackage+".entity"+"."+getLastChar(cName)+";"+RT_1
+						+"import "+commonPackage+".dto"+"."+getLastChar(cName)+"QueryDTO;"+RT_1
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"DaoImpl类"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_2
+						+"public class " +getLastChar(cName) +"DaoImpl extends CustomBaseSqlDaoImpl implements " +getLastChar(cName) +"DaoCustom  {"+RT_2
+						+"    public PageModel<"+getLastChar(cName)+"> query"+getLastChar(cName)+"Page("+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO){"+RT_1
+						+"         Map<String,Object> map = new HashMap<String,Object>();"+RT_1
+						+"         StringBuilder hql = new StringBuilder();"+RT_1
+						+"         hql.append(\"select t from "+getLastChar(cName)+" t \");"+RT_1
+						+"         return this.queryForPageWithParams(hql.toString(),map,"+getFirstLowercase(cName)+"QueryDTO.getCurrentPage(),"+getFirstLowercase(cName)+"QueryDTO.getPageSize());"+RT_1
+						+"    }"+RT_2
+						+"    public List<"+getLastChar(cName)+"> query"+getLastChar(cName)+"List("+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO){"+RT_1
+						+"         Map<String,Object> map = new HashMap<String,Object>();"+RT_1
+						+"         StringBuilder hql = new StringBuilder();"+RT_1
+						+"         hql.append(\"select t from "+getLastChar(cName)+" t \");"+RT_1
+						+"         return this.queryByMapParams(hql.toString(),map);"+RT_1
+						+"    }"+RT_1
+						+RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建DaoImpl接口失败,原因是commonPackage为空!");
+			}
+		}
+		
+		/**
+		 * 创建service类
+		 * @param c实体类
+		 * @param commonPackage 基础包:如com.jeff.tianti.info
+		 * @throws IOException
+		 */
+		public static void createServiceClass(Class c,String commonPackage,String author) throws IOException{
+			String cName = c.getName();
+			String servicePath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				servicePath = commonPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + servicePath+"/service"
+						+ "/" + getLastChar(cName) + "Service.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				fw.write("package "+commonPackage+".service"+";"+RT_2+"import "+commonPackage+".entity"+"."+getLastChar(cName)+";"+RT_1
+						+"import "+commonPackage+".dao"+"."+getLastChar(cName)+"Dao;"+RT_1
+						+"import "+commonPackage+".dto"+"."+getLastChar(cName)+"QueryDTO;"+RT_1
+						+"import com.jeff.tianti.common.service.CommonService;"+RT_1
+						+"import com.jeff.tianti.common.entity.PageModel;"+RT_1
+						+"import org.springframework.stereotype.Service;"+RT_1
+						+"import java.util.List;"+RT_1
+						+"import org.springframework.beans.factory.annotation.Autowired;"+RT_1
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"Service类"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+						+"@Service"+RT_1+"public class " +getLastChar(cName) +"Service extends CommonService< " +getLastChar(cName) +",String >  {"+
+						RT_2+
+						"    @Autowired"+RT_1+"    private "+getLastChar(cName)+"Dao "+getFirstLowercase(cName)+"Dao;"+RT_2+
+						"    @Autowired"+RT_1+"    public void set"+getLastChar(cName)+"Dao("+getLastChar(cName)+"Dao "+getFirstLowercase(cName)+"Dao){"+RT_1+
+						"      super.setCommonDao("+getFirstLowercase(cName)+"Dao);"+RT_1+"    }"+RT_2+
+						"    public PageModel<"+getLastChar(cName)+"> query"+getLastChar(cName)+"Page("+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO){"+RT_1+
+						"           return this."+getFirstLowercase(cName)+"Dao.query"+getLastChar(cName)+"Page("+getFirstLowercase(cName)+"QueryDTO);"+RT_1+
+						"    }"+RT_2+
+						"    public List<"+getLastChar(cName)+"> query"+getLastChar(cName)+"List("+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO){"+RT_1+
+						"           return this."+getFirstLowercase(cName)+"Dao.query"+getLastChar(cName)+"List("+getFirstLowercase(cName)+"QueryDTO);"+RT_1+
+						"    }"+RT_1+
+						RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建Service接口失败,原因是commonPackage为空!");
+			}
+		}
+		
+		/**
+		 * 创建Controller层的代码
+		 * @param c实体类
+		 * @param commonPackage  基础包:如com.jeff.tianti.info
+		 * @param controllerPackage Controller包如com.jeff.tianti.kaoyan.web
+		 * @param author 作者
+		 * @param isBackground 是否后台
+		 * @throws IOException
+		 */
+		public static void createControllerClass(Class c,String commonPackage,String controllerPackage,String author,Boolean isBackground) throws IOException{
+			String cName = c.getName();
+			String controllerPath = "";
+			if(author == null || author.equals("")){
+				author = "Administrator";
+			}
+			if(commonPackage != null && !commonPackage.equals("")){
+				//引入包字符串
+				String importStr = "";
+				//查询字符串
+				String queryInfoStr = "";
+				//UrlMapping定义
+				String requestMappingStr = "";
+				if(isBackground){
+					importStr = "import "+commonPackage+".dto"+"."+getLastChar(cName)+"QueryDTO;"+RT_1;
+					queryInfoStr = "       "+getLastChar(cName)+"QueryDTO "+getFirstLowercase(cName)+"QueryDTO = new "+getLastChar(cName)+"QueryDTO(); "+RT_1
+							+"       "+getFirstLowercase(cName)+"QueryDTO.setCurrentPage(currentPage);"+RT_1
+							+"       "+getFirstLowercase(cName)+"QueryDTO.setPageSize(pageSize);"+RT_1
+							+"       PageModel<"+getLastChar(cName)+"> page = this."+getFirstLowercase(cName)+"Service.query"+getLastChar(cName)+"Page("+getFirstLowercase(cName)+"QueryDTO);"+RT_1;
+					requestMappingStr = "@RequestMapping(\"/boss/"+getFirstLowercase(cName)+"\")"+RT_1;
+				}else{
+					importStr = "import "+commonPackage+".dto"+"."+getLastChar(cName)+"FrontQueryDTO;"+RT_1;
+					queryInfoStr = "       "+getLastChar(cName)+"FrontQueryDTO "+getFirstLowercase(cName)+"FrontQueryDTO = new "+getLastChar(cName)+"FrontQueryDTO(); "+RT_1
+							+"       "+getFirstLowercase(cName)+"FrontQueryDTO.setCurrentPage(currentPage);"+RT_1
+							+"       "+getFirstLowercase(cName)+"FrontQueryDTO.setPageSize(pageSize);"+RT_1
+							+"       PageModel<"+getLastChar(cName)+"> page = this."+getFirstLowercase(cName)+"Service.query"+getLastChar(cName)+"FrontPage("+getFirstLowercase(cName)+"FrontQueryDTO);"+RT_1;
+					requestMappingStr = "@RequestMapping(\"/"+getFirstLowercase(cName)+"\")"+RT_1;
+				}
+				controllerPath = controllerPackage.replace(".", "/");
+				String fileName = System.getProperty("user.dir") + "/src/main/java/" + controllerPath+""
+						+ "/" + getLastChar(cName) + "Controller.java";
+				File f = new File(fileName);
+				FileWriter fw = new FileWriter(f);
+				
+				fw.write("package "+controllerPackage+";"+RT_2
+						+"import "+commonPackage+".entity"+"."+getLastChar(cName)+";"+RT_1
+						+"import "+commonPackage+".service"+"."+getLastChar(cName)+"Service;"+RT_1
+						+"import javax.servlet.http.HttpServletRequest; "+RT_1
+						+"import org.apache.commons.lang3.StringUtils; "+RT_1
+						+"import java.util.Date; "+RT_1
+						+"import org.springframework.beans.factory.annotation.Autowired; "+RT_1
+						+"import org.springframework.stereotype.Controller; "+RT_1
+						+"import org.springframework.ui.Model; "+RT_1
+						+"import org.springframework.web.bind.annotation.RequestMapping; "+RT_1
+						+"import com.jeff.tianti.common.entity.PageModel; "+RT_1
+						+importStr
+						+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"Controller"+BLANK_1+RT_1
+						+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+						+"@Controller"+RT_1
+						+requestMappingStr
+						+"public class " +getLastChar(cName) +"Controller{"+RT_2
+						+"    @Autowired"+RT_1
+						+"    private "+getLastChar(cName)+"Service "+getFirstLowercase(cName)+"Service;"+RT_2
+						+"    @RequestMapping(\"/list\")"+RT_1
+						+"    public String list(HttpServletRequest request,Model model){"+RT_1
+						+"       String currentPageStr = request.getParameter(\"currentPage\");"+RT_1
+						+"       String pageSizeStr = request.getParameter(\"pageSize\");"+RT_1
+						+"       int currentPage = 1;"+RT_1
+						+"       int pageSize = 10;"+RT_1
+						+"       if(StringUtils.isNotBlank(currentPageStr)){"+RT_1
+						+"             currentPage = Integer.parseInt(currentPageStr);"+RT_1
+						+"       }"+RT_1
+						+"       if(StringUtils.isNotBlank(pageSizeStr)){"+RT_1
+						+"             pageSize = Integer.parseInt(pageSizeStr);"+RT_1
+						+"       }"+RT_1
+						+queryInfoStr
+						+"       model.addAttribute(\"page\", page);"+RT_2
+						+"       return \"/"+getFirstLowercase(cName)+"/list\";"+RT_1
+						+"    }"+RT_2
+						+"    @RequestMapping(\"/add\")"+RT_1
+						+"    public String add(HttpServletRequest request,Model model){"+RT_1
+						+"        String id = request.getParameter(\"id\");"+RT_1
+						+"        "+getLastChar(cName)+" "+getFirstLowercase(cName)+" = null;"+RT_1
+						+"        if(StringUtils.isNotBlank(id)){"+RT_1
+						+"             "+getFirstLowercase(cName)+" = this."+getFirstLowercase(cName)+"Service.find(id);"+RT_1
+						+"        }"+RT_1
+						+"        model.addAttribute(\""+getFirstLowercase(cName)+"\", "+getFirstLowercase(cName)+");"+RT_1
+						+"        model.addAttribute(\"id\", id);"+RT_1
+						+"        return \"/"+getFirstLowercase(cName)+"/add\";"+RT_1
+						+"    }"+RT_2
+						+"    @RequestMapping(\"/saveorupdate\")"+RT_1
+						+"    public String doSaveOrUpdate(HttpServletRequest request){"+RT_1
+						+"        String id = request.getParameter(\"id\");"+RT_1
+						+"        "+getLastChar(cName)+" "+getFirstLowercase(cName)+" = null;"+RT_1
+						+"        if(StringUtils.isNotBlank(id)){"+RT_1
+						+"             "+getFirstLowercase(cName)+" = this."+getFirstLowercase(cName)+"Service.find(id);"+RT_1
+						+"             "+getFirstLowercase(cName)+".setUpdateDate(new Date());"+RT_1
+						+"             this."+getFirstLowercase(cName)+"Service.update("+getFirstLowercase(cName)+");"+RT_1
+						+"        }else{"+RT_1
+						+"             "+getFirstLowercase(cName)+" = new "+getLastChar(cName)+"();"+RT_1
+						+"             "+getFirstLowercase(cName)+".setCreateDate(new Date());"+RT_1
+						+"             this."+getFirstLowercase(cName)+"Service.save("+getFirstLowercase(cName)+");"+RT_1
+						+"        }"+RT_1
+						+"        return \"redirect:/"+getFirstLowercase(cName)+"/list\";"+RT_1
+						+"    }"+RT_2
+						+"    @RequestMapping(\"/doDelete\")"+RT_1
+						+"    public String doDelete(HttpServletRequest request){"+RT_1
+						+"        String id = request.getParameter(\"id\");"+RT_1
+						+"        "+getLastChar(cName)+" "+getFirstLowercase(cName)+" = this."+getFirstLowercase(cName)+"Service.find(id);"+RT_1
+						+"        if("+getFirstLowercase(cName)+" != null){"+RT_1
+						+"           "+getFirstLowercase(cName)+".setDeleteFlag(\"1\");"+RT_1
+						+"           this."+getFirstLowercase(cName)+"Service.update("+getFirstLowercase(cName)+");"+RT_1
+						+"        }"+RT_1
+						+"        return \"redirect:/"+getFirstLowercase(cName)+"/list\";"+RT_1
+						+"    }"+RT_2
+						+RT_2+"}");
+				fw.flush();
+				fw.close();
+				showInfo(fileName);
+			}else{
+				System.out.println("创建Controller失败,原因是commonPackage为空!");
+			}
+		}
+		
+		/**
+		 *生成标准的Add Jsp文件
+		 * @param jspPath jsp路径(从views开始,不包括jsp文件名)
+		 * @throws IOException 
+		 */
+		public static void createStandardAddJsp(String jspPath) throws IOException{
+			String fileName = System.getProperty("user.dir") + "/WebRoot/WEB_INF/" + jspPath+""
+					+ "/add.jsp";
+			File f = new File(fileName);
+			FileWriter fw = new FileWriter(f);
+			fw.write("<%@ page contentType=\"text/html; charset=UTF-8\"%>"+RT_1
+					+"<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\"%>"+RT_2
+					+"<!DOCTYPE html>"+RT_1
+					+"<html>"+RT_1
+					+"<head>"+RT_1
+					+"<%@ include file=\"../common/common.jsp\"%>"+RT_1
+					+"<%@ include file=\"../common/common_html_validator.jsp\"%>"+RT_1
+					+"<title>添加</title>"+RT_1
+					+"</head>"+RT_2
+					+"<body>"+RT_1
+					+"<form action=\"\" method=\"POST\" id=\"form\">"+RT_1
+					);
+			fw.flush();
+			fw.close();
+			showInfo(fileName);
+		}
+
+		/**
+		 * 显示信息
+		 * 
+		 * @param info
+		 */
+		public static void showInfo(String info) {
+			System.out.println("创建文件:" + info + "成功!");
+		}
+
+		/**
+		 * 获取系统时间
+		 * 
+		 * @return
+		 */
+		public static String getDate() {
+			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+			return simpleDateFormat.format(new Date());
+		}
+		
+
+		/**
+		 * 获取路径的最后面字符串<br>
+		 * 如:<br>
+		 * <code>str = "com.gen.entity.User"</code><br>
+		 * <code> return "User";<code>
+		 * 
+		 * @param str
+		 * @return
+		 */
+		public static String getLastChar(String str) {
+			if ((str != null) && (str.length() > 0)) {
+				int dot = str.lastIndexOf('.');
+				if ((dot > -1) && (dot < (str.length() - 1))) {
+					return str.substring(dot + 1);
+				}
+			}
+			return str;
+		}
+		
+		/**
+		 * 返回第一个字母小写
+		 * 如:传入User,返回user
+		 * @param str
+		 * @return
+		 */
+		public static String getFirstLowercase(String str){
+			String s = "";
+			if(str != null && !"".equals(str)){
+				str = getLastChar(str);
+				s = str.substring(0, 1).toLowerCase();
+				if(str.length() > 1){
+					s+=str.substring(1, str.length());
+				}
+			}
+			return s;
+		}
+		
+
+}

+ 79 - 0
tianti-common/src/main/java/com/jeff/tianti/common/util/Md5Util.java

@@ -0,0 +1,79 @@
+package com.jeff.tianti.common.util;
+
+import java.security.MessageDigest;
+
+/**
+ * md5加密工具类
+ * @author Jeff Xu
+ * @since 2015-12-09
+ */
+public class Md5Util {
+	
+	//十六进制下数字到字符的映射数组  
+    private final static String[] hexDigits = {"0", "1", "2", "3", "4",  
+        "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};  
+      
+    /** * 把inputString加密     */  
+    public static String generatePassword(String inputString){  
+        return encodeByMD5(inputString);  
+    }  
+      
+      /** 
+       * 验证输入的密码是否正确 
+     * @param password    加密后的密码 
+     * @param inputString    输入的字符串 
+     * @return    验证结果,TRUE:正确 FALSE:错误 
+     */  
+    public static boolean validatePassword(String password, String inputString){  
+        if(password.equalsIgnoreCase(encodeByMD5(inputString))){  
+            return true;  
+        } else{  
+            return false;  
+        }  
+    }  
+    /**  对字符串进行MD5加密     */  
+    private static String encodeByMD5(String originString){  
+        if (originString != null){  
+            try{  
+                //创建具有指定算法名称的信息摘要  
+                MessageDigest md = MessageDigest.getInstance("MD5");  
+                //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算  
+                byte[] results = md.digest(originString.getBytes());  
+                //将得到的字节数组变成字符串返回  
+                String resultString = byteArrayToHexString(results);  
+                return resultString.toUpperCase();  
+            } catch(Exception ex){  
+                ex.printStackTrace();  
+            }  
+        }  
+        return null;  
+    }  
+      
+    /**  
+     * 转换字节数组为十六进制字符串 
+     * @param     字节数组 
+     * @return    十六进制字符串 
+     */  
+    private static String byteArrayToHexString(byte[] b){  
+        StringBuffer resultSb = new StringBuffer();  
+        for (int i = 0; i < b.length; i++){  
+            resultSb.append(byteToHexString(b[i]));  
+        }  
+        return resultSb.toString();  
+    }  
+      
+    /** 将一个字节转化成十六进制形式的字符串     */  
+    private static String byteToHexString(byte b){  
+        int n = b;  
+        if (n < 0)  
+            n = 256 + n;  
+        int d1 = n / 16;  
+        int d2 = n % 16;  
+        return hexDigits[d1] + hexDigits[d2];  
+    } 
+    
+    public static void main(String[] args){
+    	System.out.println(Md5Util.validatePassword("454E908651395FB737E9B8048993C95D", "zhangdanfeng"));
+    }
+
+}

+ 17 - 0
tianti-modules/pom.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>com.jeff</groupId>
+    <artifactId>tianti</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <groupId>com.jeff.tianti.modules</groupId>
+  <artifactId>tianti-modules</artifactId>
+  <packaging>pom</packaging>
+  <modules>
+    <module>tianti-module-admin</module>
+    <module>tianti-module-interface</module>
+    <module>tianti-module-gateway</module>
+  </modules>
+</project>

+ 7 - 0
tianti-modules/tianti-module-admin/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
+<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>

+ 1 - 0
tianti-modules/tianti-module-admin/.gitignore

@@ -0,0 +1 @@
+/target/

+ 71 - 0
tianti-modules/tianti-module-admin/pom.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>com.jeff.tianti.modules</groupId>
+    <artifactId>tianti-modules</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <groupId>com.jeff.tianti.module.admin</groupId>
+  <artifactId>tianti-module-admin</artifactId>
+  <version>${tianti.version}</version>
+  <packaging>war</packaging>
+  <name>tianti-module-admin Maven Webapp</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+      <dependency>
+			<groupId>com.jeff.tianti.common</groupId>
+			<artifactId>tianti-common</artifactId>
+			<version>${tianti.version}</version>
+	  </dependency>
+      <dependency>
+			<groupId>com.jeff.tianti.org</groupId>
+			<artifactId>tianti-org</artifactId>
+			<version>${tianti.version}</version>
+	  </dependency>
+	  
+	  <dependency>
+			<groupId>com.jeff.tianti.cms</groupId>
+			<artifactId>tianti-cms</artifactId>
+			<version>${tianti.version}</version>
+	  </dependency>
+      <dependency>
+		    <groupId>org.json</groupId>
+		    <artifactId>json</artifactId>
+		    <version>20160810</version>
+	  </dependency>
+    <!-- 该jar包引入自本地项目 -->
+    <dependency>
+	  <groupId>org.springside</groupId>  
+	  <artifactId>springside-core</artifactId>  
+	  <version>4.2.2.GA</version>  
+	  <scope>system</scope>  
+	  <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/springside-core-4.2.2.GA.jar</systemPath>  
+	</dependency>
+	<dependency>
+	  <groupId>org.terracotta</groupId>  
+	  <artifactId>statistics</artifactId>  
+	  <version>1.0.2</version>  
+	  <scope>system</scope>  
+	  <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/statistics-1.0.2.jar</systemPath>  
+	</dependency>
+	<dependency>
+	  <groupId>com.jsptags</groupId>  
+	  <artifactId>taglib</artifactId>  
+	  <version>1.0.0</version>  
+	  <scope>system</scope>  
+	  <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/pager-taglib.jar</systemPath>  
+	</dependency>
+	<dependency>
+			<groupId>com.baidu</groupId>
+			<artifactId>ueditor</artifactId>
+			<version>1.1.1</version>
+			<scope>system</scope>
+			<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ueditor-1.1.1.jar</systemPath>
+	</dependency>
+  </dependencies>
+  <build>
+    <finalName>tianti-module-admin</finalName>
+  </build>
+</project>

+ 584 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/CmsController.java

@@ -0,0 +1,584 @@
+package com.jeff.tianti.controller;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.jeff.tianti.cms.dto.ArticleQueryDTO;
+import com.jeff.tianti.cms.dto.ColumnInfoDTO;
+import com.jeff.tianti.cms.dto.ColumnInfoQueryDTO;
+import com.jeff.tianti.cms.entity.Article;
+import com.jeff.tianti.cms.entity.ColumnInfo;
+import com.jeff.tianti.cms.service.ArticleService;
+import com.jeff.tianti.cms.service.ColumnInfoService;
+import com.jeff.tianti.common.dto.AjaxResult;
+import com.jeff.tianti.common.entity.PageModel;
+import com.jeff.tianti.util.Constants;
+/**
+ * CMS的Controller
+ * @author Jeff Xu
+ */
+@Controller
+@RequestMapping("/cms")
+public class CmsController {
+	
+	@Autowired
+	private ColumnInfoService columnInfoService;
+	
+	@Autowired
+	private ArticleService articleService;
+	
+	/**
+	 * 获取栏目列表
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/column/list")
+	public String columnList(HttpServletRequest request, Model model){
+		String code = request.getParameter("code");
+		String name = request.getParameter("name");
+		String rootColumnId = request.getParameter("rootColumnId");		
+		
+		ColumnInfoQueryDTO cDTO =new ColumnInfoQueryDTO();
+		cDTO.setLevel(ColumnInfo.LEVEL_ROOT);
+		List<ColumnInfo> rootCoulumnInfoList = this.columnInfoService.queryColumnInfoList(cDTO);
+		if(StringUtils.isBlank(rootColumnId) && rootCoulumnInfoList != null && rootCoulumnInfoList.size() > 0){
+			rootColumnId = rootCoulumnInfoList.get(0).getId();
+		}
+		ColumnInfoQueryDTO columnInfoQueryDTO = new ColumnInfoQueryDTO();
+		columnInfoQueryDTO.setRootColumnId(rootColumnId);
+		columnInfoQueryDTO.setIsRootColumnLike(false);
+		columnInfoQueryDTO.setCode(code);
+		columnInfoQueryDTO.setName(name);
+		List<ColumnInfo> list = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+		
+		model.addAttribute("list", list);
+		model.addAttribute("columnInfoQueryDTO", columnInfoQueryDTO);
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_COLUMN_LIST);
+		model.addAttribute("rootCoulumnInfoList", rootCoulumnInfoList);
+		
+		return "/cms/column_default_list";
+	}
+	
+	/**
+	 * 校验栏目编码是否存在
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/column/ajax/validator/code")
+	@ResponseBody
+	public Map<String, Object> ajaxValidatorUsername(HttpServletRequest request){
+		Map<String, Object> map = new HashMap<String, Object>();
+		String code = request.getParameter("code");
+		ColumnInfoQueryDTO columnInfoQueryDTO = new ColumnInfoQueryDTO();
+		columnInfoQueryDTO.setCode(code);
+		columnInfoQueryDTO.setIsCodeLike(false);
+		List<ColumnInfo> columnInfoList = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+		if(columnInfoList != null && columnInfoList.size() > 0){
+			map.put("error", "编码已经存在");
+		}else{
+			map.put("ok", "");
+		}
+		return map;
+	} 
+	
+	/**
+	 * 栏目修改
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/column/edit")
+	public String edit(HttpServletRequest request, Model model){
+		ColumnInfo columnInfo = null;
+		String id = request.getParameter("id");
+		String columnLevel = request.getParameter("columnLevel");
+		String rootColumnId = request.getParameter("rootColumnId");
+		ColumnInfoQueryDTO columnInfoQueryDTO =new ColumnInfoQueryDTO();
+		columnInfoQueryDTO.setLevel(ColumnInfo.LEVEL_ROOT);
+		List<ColumnInfo> rootCoulumnInfoList = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+		if(StringUtils.isNotBlank(id)){
+			columnInfo = this.columnInfoService.find(id);
+		}
+		model.addAttribute("columnInfo", columnInfo);
+		model.addAttribute("columnLevel", columnLevel);
+		model.addAttribute("rootColumnId", rootColumnId);
+		model.addAttribute("rootCoulumnInfoList", rootCoulumnInfoList);
+		return "/cms/dialog/column_default_edit";
+	}
+	
+	/**
+	 * 栏目保存操作
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/column/ajax/save")
+	@ResponseBody
+	public AjaxResult doColumnajaxSave(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		try {
+			String id = request.getParameter("id");
+			String code = request.getParameter("code");
+			String name = request.getParameter("name");
+			String columnLevel = request.getParameter("columnLevel");
+			String parentId = request.getParameter("parentId");
+			String orderNoStr = request.getParameter("orderNo");
+		    Integer orderNo = null;
+		    if(StringUtils.isNotBlank(orderNoStr)){
+		    	orderNo = Integer.parseInt(orderNoStr);
+		    }
+			ColumnInfo columnInfo = null;
+			if(StringUtils.isNotBlank(id)){
+				columnInfo = this.columnInfoService.find(id);
+				columnInfo.setName(name);
+				if(columnLevel.equals("level0")){
+					columnInfo.setLevel(ColumnInfo.LEVEL_ROOT);
+					columnInfo.setPath(columnInfo.getId());
+				}else{
+					columnInfo.setLevel(ColumnInfo.LEVEL_LEAF);
+					if(StringUtils.isNotBlank(parentId)){
+						ColumnInfo parentColumnInfo = this.columnInfoService.find(parentId);
+						columnInfo.setParent(parentColumnInfo);
+					}
+				}
+				columnInfo.setChannel(ColumnInfo.CHANNEL_PC);
+				columnInfo.setOrderNo(orderNo);
+				columnInfo.setUpdateDate(new Date());
+			}else{
+				columnInfo = new ColumnInfo();
+				columnInfo.setCode(code);
+				columnInfo.setName(name);
+				if(columnLevel.equals("level0")){
+					columnInfo.setLevel(ColumnInfo.LEVEL_ROOT);
+				}else{
+					columnInfo.setLevel(ColumnInfo.LEVEL_LEAF);
+					if(StringUtils.isNotBlank(parentId)){
+						ColumnInfo parentColumnInfo = this.columnInfoService.find(parentId);
+						columnInfo.setParent(parentColumnInfo);
+					}
+				}
+				columnInfo.setChannel(ColumnInfo.CHANNEL_PC);
+				columnInfo.setOrderNo(orderNo);
+				columnInfo.setCreateDate(new Date());
+				columnInfo.setDeleteFlag(ColumnInfo.DELETE_FLAG_NORMAL);
+			}
+						
+			if(StringUtils.isNotBlank(id)){
+				this.columnInfoService.update(columnInfo);
+			}else{
+				this.columnInfoService.save(columnInfo);
+				if(columnInfo != null){
+					if(columnInfo.getParent() != null){
+						String path = columnInfo.getParent().getId()+"/"+columnInfo.getId();
+						columnInfo.setPath(path);
+					}else{
+						columnInfo.setPath(columnInfo.getId());
+					}
+					this.columnInfoService.update(columnInfo);
+				}
+			}
+			ajaxResult.setSuccess(true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return ajaxResult;
+	}
+	
+	/**
+	 * 栏目删除
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/column/ajax/delete")
+	@ResponseBody
+	public AjaxResult ajaxUpdColumnDelete(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String[] ids = request.getParameterValues("ids");
+			String deleteFlag = request.getParameter("deleteFlag");
+			
+			if(ids != null && ids.length > 0){
+				for(String id:ids){
+					ColumnInfo columnInfo = this.columnInfoService.find(id);
+					columnInfo.setDeleteFlag(deleteFlag);
+					this.columnInfoService.update(columnInfo);
+					
+					//删除该节点对应的孩子列表
+					ColumnInfoQueryDTO columnInfoQueryDTO = new ColumnInfoQueryDTO();
+					columnInfoQueryDTO.setRootColumnId(id);
+					List<ColumnInfo> leafColumnInfoList = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+					if(leafColumnInfoList != null && leafColumnInfoList.size() > 0){
+						for(ColumnInfo c : leafColumnInfoList){
+							c.setDeleteFlag(ColumnInfo.DELETE_FLAG_DELETED);
+							this.columnInfoService.update(c);
+						}
+					}
+				}
+			}
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 获取文章列表
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/article/list")
+	public String articleList(HttpServletRequest request, Model model){
+		String type = request.getParameter("type");
+		String rootColumnId = request.getParameter("rootColumnId");
+		String columnId = request.getParameter("columnId");
+		String title = request.getParameter("title");
+		String publisher = request.getParameter("publisher");
+		String startDate = request.getParameter("startDate");
+		String endDate = request.getParameter("endDate");
+		String createDateSortCss = request.getParameter("createDateSortCss");
+		String currentPageStr = request.getParameter("currentPage");
+		String pageSizeStr = request.getParameter("pageSize");
+		int currentPage = 1;
+		int pageSize = 10;
+		if(StringUtils.isNotBlank(currentPageStr)){
+			currentPage = Integer.parseInt(currentPageStr);
+		}
+		if(StringUtils.isNotBlank(pageSizeStr)){
+			pageSize = Integer.parseInt(pageSizeStr);
+		}
+		
+		ColumnInfoQueryDTO columnInfoQueryDTO =new ColumnInfoQueryDTO();
+		columnInfoQueryDTO.setLevel(ColumnInfo.LEVEL_ROOT);
+		List<ColumnInfo> rootCoulumnInfoList = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+		List<ColumnInfoDTO> columnInfoDTOList = new ArrayList<ColumnInfoDTO>();
+		
+		
+		if(rootCoulumnInfoList != null && rootCoulumnInfoList.size() > 0){
+			if(StringUtils.isBlank(rootColumnId)){
+				rootColumnId = rootCoulumnInfoList.get(0).getId();
+			}
+			for(ColumnInfo c:rootCoulumnInfoList){
+				ColumnInfoDTO columnInfoDTO = new ColumnInfoDTO();
+				columnInfoDTO.setId(c.getId());
+				columnInfoDTO.setName(c.getName());
+				
+				ColumnInfoQueryDTO childColumnInfoQueryDTO = new ColumnInfoQueryDTO();
+				childColumnInfoQueryDTO.setRootColumnId(c.getId());
+				childColumnInfoQueryDTO.setIsRootColumnLike(false);
+				List<ColumnInfo> childColumnInfoList = this.columnInfoService.queryColumnInfoList(childColumnInfoQueryDTO);
+				if(childColumnInfoList != null && childColumnInfoList.size() > 0){
+					List<ColumnInfoDTO> rColumnInfoDTOList = new ArrayList<ColumnInfoDTO>();
+					for(ColumnInfo rc:childColumnInfoList){
+						ColumnInfoDTO rColumnInfoDTO = new ColumnInfoDTO();
+						rColumnInfoDTO.setId(rc.getId());
+						rColumnInfoDTO.setName(rc.getName());
+						rColumnInfoDTOList.add(rColumnInfoDTO);
+					}
+					columnInfoDTO.setChildColumnInfoList(rColumnInfoDTOList);
+				}
+				columnInfoDTOList.add(columnInfoDTO);
+			}
+		}
+		
+		ArticleQueryDTO articleQueryDTO = new ArticleQueryDTO();
+		articleQueryDTO.setColumnId(columnId);
+		articleQueryDTO.setType(type);
+		articleQueryDTO.setIsFront(false);
+		articleQueryDTO.setRootColumnId(rootColumnId);
+		articleQueryDTO.setTitle(title);
+		articleQueryDTO.setPublisher(publisher);
+		articleQueryDTO.setStartDate(startDate);
+		articleQueryDTO.setEndDate(endDate);
+		articleQueryDTO.setCreateDateSortCss(createDateSortCss);
+		articleQueryDTO.setCurrentPage(currentPage);
+		articleQueryDTO.setPageSize(pageSize);
+		
+		PageModel<Article> page = this.articleService.queryArticlePage(articleQueryDTO);
+		List<Map<String,Object>> statisMapList = this.articleService.queryStatisMapList(articleQueryDTO);
+		Map<String,Object> statisMap = null;
+		if(statisMapList != null && statisMapList.size() > 0){
+			statisMap = statisMapList.get(0);
+		}
+		model.addAttribute("page", page);
+		model.addAttribute("type", type);
+		model.addAttribute("statisMap", statisMap);
+		model.addAttribute("articleQueryDTO", articleQueryDTO);
+		model.addAttribute("rootCoulumnInfoList", rootCoulumnInfoList);
+		model.addAttribute("columnInfoDTOList", columnInfoDTOList);
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_ARTICLE_LIST);
+		
+		return "/cms/article_default_list";
+	}
+	
+	/**
+	 * 文章修改
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/article/edit")
+	public String articleEdit(HttpServletRequest request, Model model){
+		Article article = null;
+		String id = request.getParameter("id");		
+		String rootColumnId = request.getParameter("rootColumnId");
+		String columnId = request.getParameter("columnId");
+		if(StringUtils.isNotBlank(id)){
+			article = this.articleService.find(id);
+			if(article != null){
+				rootColumnId = article.getRootColumnInfo().getId();
+				columnId = article.getColumnInfo().getId();
+			}
+		}
+		ColumnInfoQueryDTO columnInfoQueryDTO =new ColumnInfoQueryDTO();
+		columnInfoQueryDTO.setLevel(ColumnInfo.LEVEL_ROOT);
+		List<ColumnInfo> rootCoulumnInfoList = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+		
+		model.addAttribute("rootColumnId", rootColumnId);
+		model.addAttribute("columnId", columnId);
+		model.addAttribute("article", article);
+		model.addAttribute("rootCoulumnInfoList", rootCoulumnInfoList);
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_ARTICLE_LIST);
+		
+		return "/cms/article_edit";
+	}
+	
+	/**
+	 * 文章保存操作
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/article/ajax/save")
+	@ResponseBody
+	public AjaxResult doArticlejaxSave(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		try {
+			String id = request.getParameter("id");
+			String rootColumnId = request.getParameter("rootColumnId");
+			String columnInfoId = request.getParameter("leafColumnId");
+			String title = request.getParameter("title");
+			String publisher = request.getParameter("publisher");
+			String content = request.getParameter("content");
+			String summary = request.getParameter("summary");
+			String coverImageUrl = request.getParameter("coverImageUrl");
+			String href = request.getParameter("href");
+			String orderNoStr = request.getParameter("orderNo");
+			String articleTypeStr = request.getParameter("articleType");
+		   
+			Article article = null;
+			Integer orderNo = null;
+			Integer articleType = null;
+			ColumnInfo rootColumnInfo = null;
+			ColumnInfo columnInfo = null;
+			if(StringUtils.isNotBlank(rootColumnId)){
+				rootColumnInfo = this.columnInfoService.find(rootColumnId);
+			}
+			if(StringUtils.isNotBlank(columnInfoId)){
+				columnInfo = this.columnInfoService.find(columnInfoId);
+			}
+			if(StringUtils.isNotBlank(orderNoStr)){
+				orderNo = Integer.parseInt(orderNoStr);
+			}
+			if(StringUtils.isNotBlank(articleTypeStr)){
+				if(articleTypeStr.equals("contentType")){
+					articleType = 0;
+				}else if(articleTypeStr.equals("hrefType")){
+					articleType = 1;
+				}else if(articleTypeStr.equals("adType")){
+					articleType = 2;
+				}
+			}
+			if(StringUtils.isNotBlank(id)){
+				article = this.articleService.find(id);
+				article.setTitle(title);
+				article.setPublisher(publisher);
+				article.setContent(content);
+				article.setType(articleType);
+				article.setRootColumnInfo(rootColumnInfo);
+				article.setColumnInfo(columnInfo);
+				article.setSummary(summary);
+				article.setUpdateDate(new Date());
+				article.setOrderNo(orderNo);
+				article.setHref(href);
+				if(StringUtils.isNotBlank(coverImageUrl)){
+					article.setCoverImageUrl(coverImageUrl);
+				}
+			}else{
+				article = new Article();
+				article.setTitle(title);
+				article.setPublisher(publisher);
+				article.setContent(content);
+				article.setType(articleType);
+				article.setRootColumnInfo(rootColumnInfo);
+				article.setColumnInfo(columnInfo);
+				article.setSummary(summary);
+				article.setCreateDate(new Date());
+				article.setViewCount(0);
+				article.setDeleteFlag(ColumnInfo.DELETE_FLAG_NORMAL);
+				article.setIsAudit(true);
+				article.setOrderNo(orderNo);
+				article.setHref(href);
+				if(StringUtils.isNotBlank(coverImageUrl)){
+					article.setCoverImageUrl(coverImageUrl);
+				}
+			}
+						
+			if(StringUtils.isNotBlank(id)){
+				this.articleService.update(article);
+			}else{
+				this.articleService.save(article);
+			}
+			ajaxResult.setSuccess(true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return ajaxResult;
+	}
+	
+	/**
+	 * 根据根节点获取叶子节点
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/column/ajax/getLeafColumn")
+	@ResponseBody
+	public AjaxResult getLeafColumn(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(true);
+		String rootColumnId = request.getParameter("rootColumnInfoId");
+		ColumnInfoQueryDTO columnInfoQueryDTO = new ColumnInfoQueryDTO();
+		columnInfoQueryDTO.setIsRootColumnLike(false);
+		columnInfoQueryDTO.setRootColumnId(rootColumnId);
+		List<ColumnInfo> columnInfoList = this.columnInfoService.queryColumnInfoList(columnInfoQueryDTO);
+		ajaxResult.setData(columnInfoList);
+		return ajaxResult;
+	}
+	
+	/**
+	 * 文章删除
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/article/ajax/delete")
+	@ResponseBody
+	public AjaxResult ajaxArticleDelete(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String[] ids = request.getParameterValues("ids");
+			String deleteFlag = request.getParameter("deleteFlag");
+			
+			if(ids != null && ids.length > 0){
+				for(String id:ids){
+					Article article = this.articleService.find(id);
+					article.setDeleteFlag(deleteFlag);
+					this.articleService.update(article);
+				}
+			}
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 文章审核
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/article/ajax/audit")
+	@ResponseBody
+	public AjaxResult ajaxArticleAudit(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			Boolean isAudit = false;
+			String[] ids = request.getParameterValues("ids");
+			String auditFlag = request.getParameter("auditFlag");
+			if(StringUtils.isNotBlank(auditFlag) && auditFlag.equals("1")){
+				isAudit = true;
+			}
+			if(ids != null && ids.length > 0){
+				for(String id:ids){
+					Article article = this.articleService.find(id);
+					article.setIsAudit(isAudit);
+					this.articleService.update(article);
+				}
+			}
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 文章置顶
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/article/ajax/top")
+	@ResponseBody
+	public AjaxResult ajaxArticleTop(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			Boolean isTop = false;
+			String[] ids = request.getParameterValues("ids");
+			String topFlag = request.getParameter("topFlag");
+			if(StringUtils.isNotBlank(topFlag) && topFlag.equals("1")){
+				isTop = true;
+			}
+			if(ids != null && ids.length > 0){
+				for(String id:ids){
+					Article article = this.articleService.find(id);
+					article.setIsTop(isTop);
+					this.articleService.update(article);
+				}
+			}
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return ajaxResult;
+	}
+	
+	/**
+	 * 跳转到flash控件开启页面
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/article/flashView")
+	public String articleFlashView(HttpServletRequest request, Model model){
+		
+		return "/cms/article_flash_view";
+	}
+
+}

+ 23 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/IndexController.java

@@ -0,0 +1,23 @@
+package com.jeff.tianti.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * 后台工程欢迎页
+ * @author Jeff Xu
+ * @since 2017-12-02
+ */
+@Controller
+public class IndexController {
+	
+	/**
+	 * 入口
+	 * @return
+	 */
+	@RequestMapping("/index")
+	public String index(){
+		return "index";
+	}
+
+}

+ 89 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/LoginController.java

@@ -0,0 +1,89 @@
+package com.jeff.tianti.controller;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.LockedAccountException;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.Subject;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.jeff.tianti.common.util.Md5Util;
+import com.jeff.tianti.org.entity.Resource;
+import com.jeff.tianti.util.WebHelper;
+
+@Controller
+public class LoginController {
+	
+	@RequestMapping("/login")
+	public String login(){
+		return "login";
+	}
+	
+	@RequestMapping("/do_login")
+	public String doLogin(HttpServletRequest request, Model model){
+		
+		String username = request.getParameter("username");
+		String pwd = request.getParameter("pwd");
+		
+		boolean rememberMe = false;
+		
+		String md5Pwd = Md5Util.generatePassword(pwd);
+		
+		try {
+			UsernamePasswordToken token = new UsernamePasswordToken(username, md5Pwd, rememberMe);
+			
+			Subject subject = SecurityUtils.getSubject();
+			
+			subject.login(token);
+			
+			//跳转第一个菜单
+			List<Resource> hasResource = (List<Resource>) request.getSession().getAttribute(WebHelper.SESSION_MENU_RESOURCE);
+			if(hasResource != null && !hasResource.isEmpty()){
+				for(Resource resource : hasResource){
+					
+					List<Resource> chResources = resource.getChildren();
+					if(StringUtils.isNotBlank(resource.getUrl()) && (chResources == null || chResources.isEmpty())){
+						return "redirect:" + resource.getUrl();
+					}
+					if(chResources != null && !chResources.isEmpty()){
+						for(Resource chRes : chResources){
+							if(StringUtils.isNotBlank(chRes.getUrl())){
+								return "redirect:" + chRes.getUrl();
+							}
+						}
+					}
+				}
+			}
+			
+			return "redirect:/user/list";
+		} catch (LockedAccountException lae) {
+//			lae.printStackTrace();
+			model.addAttribute("msg", "账号已被禁用");
+		} catch (AuthenticationException ae) {
+//			ae.printStackTrace();
+			model.addAttribute("msg", "账号或密码错误");
+		} catch (Exception e) {
+//			e.printStackTrace();
+			model.addAttribute("msg", "登录异常");
+		}
+		
+		return "login";
+	}
+	
+	@RequestMapping("/login_out")
+	public String loginOut(HttpServletRequest request){
+		
+		Subject subject = SecurityUtils.getSubject();
+		subject.logout();
+		
+		return "redirect:/login";
+	}
+
+}

+ 109 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/UploadController.java

@@ -0,0 +1,109 @@
+package com.jeff.tianti.controller;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import com.jeff.tianti.common.dto.AjaxResult;
+
+/**
+ * 文件异步上传Controller
+ * @author JeffXu
+ * @since 2016-03-14
+ */
+@Controller
+@RequestMapping("/upload")
+public class UploadController {
+	
+	public final static String ATTACH_SAVE_PATH = "attach";
+
+	@RequestMapping("/uploadAttach")
+	public void uploadAttach(HttpServletRequest request, PrintWriter out) {
+		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+		Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+		MultipartFile multipartFile = null;
+		String fileName = null;
+		for (Map.Entry<String, MultipartFile> set : fileMap.entrySet()) {
+			multipartFile = set.getValue();// 文件名
+		}
+		fileName = this.storeIOc(multipartRequest, multipartFile);
+
+		out.print(fileName);
+	}
+
+
+	@RequestMapping("/ajax/upload_file")
+	@ResponseBody
+	public AjaxResult ajaxUploadFile(HttpServletRequest request) {
+		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+		
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		try {
+			
+			Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+			MultipartFile multipartFile = null;
+			String fileName = null;
+			for (Map.Entry<String, MultipartFile> set : fileMap.entrySet()) {
+				multipartFile = set.getValue();// 文件名
+			}
+			fileName = this.storeIOc(multipartRequest, multipartFile);
+			
+			ajaxResult.setData(fileName);
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	// 接受图片,返回文件地址
+	private String storeIOc(HttpServletRequest request, MultipartFile file) {
+		String result = "";
+		String realPath = request.getSession().getServletContext().getRealPath("uploads");
+		if (file == null) {
+			return null;
+		}
+		String fileName = "";
+		String logImageName = "";
+		if (file.isEmpty()) {
+			result = "文件未上传";
+		} else {
+			String _fileName = file.getOriginalFilename();
+			String suffix = _fileName.substring(_fileName.lastIndexOf("."));
+			if(StringUtils.isNotBlank(suffix)){
+				if(suffix.equalsIgnoreCase(".xls") || suffix.equalsIgnoreCase(".xlsx") || suffix.equalsIgnoreCase(".txt")|| suffix.equalsIgnoreCase(".png")
+						  || suffix.equalsIgnoreCase(".doc") || suffix.equalsIgnoreCase(".docx") || suffix.equalsIgnoreCase(".pdf") 
+						  || suffix.equalsIgnoreCase(".ppt") || suffix.equalsIgnoreCase(".pptx")|| suffix.equalsIgnoreCase(".gif")
+						  || suffix.equalsIgnoreCase(".jpg")|| suffix.equalsIgnoreCase(".jpeg")|| suffix.equalsIgnoreCase(".bmp")){
+					// /**使用UUID生成文件名称**/
+					logImageName = UUID.randomUUID().toString() + suffix;
+
+					fileName = realPath + File.separator + ATTACH_SAVE_PATH + File.separator + logImageName;
+					File restore = new File(fileName);
+					try {
+						file.transferTo(restore);
+						result = "/uploads/attach/" + logImageName;
+					} catch (Exception e) {
+						throw new RuntimeException(e);
+					}
+				}else{
+					result = "文件格式不对,只能上传ppt、ptx、doc、docx、xls、xlsx、pdf、png、jpg、jpeg、gif、bmp格式";
+				}
+			}
+		}
+		return result;
+	}
+
+}

+ 657 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/UserController.java

@@ -0,0 +1,657 @@
+package com.jeff.tianti.controller;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jeff.tianti.common.dto.AjaxResult;
+import com.jeff.tianti.common.entity.PageModel;
+import com.jeff.tianti.common.util.ExcelUtils;
+import com.jeff.tianti.common.util.Md5Util;
+import com.jeff.tianti.org.dto.RoleQueryDTO;
+import com.jeff.tianti.org.dto.UserQueryDTO;
+import com.jeff.tianti.org.entity.Resource;
+import com.jeff.tianti.org.entity.Role;
+import com.jeff.tianti.org.entity.User;
+import com.jeff.tianti.org.service.ResourceService;
+import com.jeff.tianti.org.service.RoleService;
+import com.jeff.tianti.org.service.UserService;
+import com.jeff.tianti.util.Constants;
+import com.jeff.tianti.util.WebHelper;
+/**
+ * 用户管理Controller
+ * @author Jeff Xu
+ *
+ */
+@Controller
+@RequestMapping("/user")
+public class UserController {
+
+	@Autowired
+	private ResourceService resourceService;
+	
+	@Autowired
+	private RoleService roleService;
+	
+	@Autowired
+	private UserService userService;
+	
+	/**
+	 * 获取用户列表
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/list")
+	public String list(HttpServletRequest request, Model model){
+		String userName = request.getParameter("userName");
+		String currentPageStr = request.getParameter("currentPage");
+		String pageSizeStr = request.getParameter("pageSize");
+		
+		int currentPage = 1;
+		int pageSize = 10;
+		if(StringUtils.isNotBlank(currentPageStr)){
+			currentPage = Integer.parseInt(currentPageStr);
+		}
+		if(StringUtils.isNotBlank(pageSizeStr)){
+			pageSize = Integer.parseInt(pageSizeStr);
+		}
+		
+		UserQueryDTO userQueryDTO = new UserQueryDTO();
+		userQueryDTO.setUserName(userName);
+		userQueryDTO.setCurrentPage(currentPage);
+		userQueryDTO.setPageSize(pageSize);
+		
+		PageModel<User> page = userService.queryUserPage(userQueryDTO);
+		model.addAttribute("page", page);
+		model.addAttribute("userQueryDTO", userQueryDTO);
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_USER_LIST);
+		
+		return "user/user_list";
+	}
+	
+	/**
+	 * 导出用户数据
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@RequestMapping("/export")
+	public String exportOrder(HttpServletRequest request, HttpServletResponse response){	
+		String userName = request.getParameter("userName");
+		Map<String, Object> params = new HashMap<String, Object>();
+		if(StringUtils.isNotBlank(userName)){
+			params.put("username", userName);
+		}
+
+		List<User> userList = this.userService.findUsers(params);
+		List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
+		Map<String, String> headNameMap = new LinkedHashMap<String, String>();
+		headNameMap.put("roleName", "角色");
+		headNameMap.put("userName", "账号");
+		headNameMap.put("realName", "姓名");
+		headNameMap.put("mobile", "电话号码");
+		headNameMap.put("createDate", "创建时间");
+		headNameMap.put("status", "状态");
+		
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		if(userList != null && userList.size() > 0){
+			for(User user : userList){
+				String statusName = "正常";
+				String createDate = "";
+				String roleName = "";
+				if(StringUtils.isNotBlank(user.getDeleteFlag()) && user.getDeleteFlag().equals(User.DELETE_FLAG_DELETED)){
+					statusName = "删除";
+				}
+				
+				if(user.getCreateDate() != null){
+					createDate = sdf.format(user.getCreateDate());
+				}
+				
+				Set<Role> roleSet = user.getRoles();
+				if(roleSet != null && roleSet.size() > 0){
+					for(Role r:roleSet){
+						roleName +=r.getName()+" ";
+					}
+				}
+				Map<String,Object> map = new HashMap<String,Object>();
+				map.put("roleName", roleName);
+				map.put("userName", user.getUsername());
+				map.put("realName", user.getRealName());
+				map.put("mobile", user.getMobile());
+				map.put("createDate", createDate);
+				map.put("status", statusName);
+				list.add(map);
+			}
+		}
+		
+		ExcelUtils.exportXlsx(response, "用户数据", headNameMap, list);
+		return null;
+	}
+	
+	/**
+	 * 跳转到用户编辑页
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/dialog/edit")
+	public String dialogEdit(HttpServletRequest request, Model model){
+		
+		String id = request.getParameter("id");
+		if(StringUtils.isNotBlank(id)){
+			User user = userService.find(id);
+			model.addAttribute("user", user);
+			
+		}
+		
+		Map<String, Object> params = new HashMap<String, Object>();
+		params.put("deleteFlag", "0");
+		List<Role> roles = roleService.findRoles(params);
+		model.addAttribute("roles", roles);
+		
+		return "user/dialog/user_edit";
+	}
+	
+	/**
+	 * 用户保存操作
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/save")
+	@ResponseBody
+	public AjaxResult ajaxSave(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			
+			String id = request.getParameter("id");
+			String username = request.getParameter("username");
+			String password = request.getParameter("password");
+			String realName = request.getParameter("realName");
+			String mobile = request.getParameter("mobile");
+			String[] roleIds = request.getParameterValues("roleId");
+			
+			
+			User user = null;
+			if(StringUtils.isNotBlank(id)){
+				user = userService.find(id);
+			}else{
+				user = new User();
+				user.setUsername(StringUtils.trim(username));
+				user.setStatus(User.STATUS_YES);
+			}
+			
+			if(StringUtils.isNotBlank(password)){
+				user.setPassword(Md5Util.generatePassword(password));
+			}
+			
+			user.setRealName(StringUtils.trim(realName));
+			user.setMobile(StringUtils.trim(mobile));
+			
+			Set<Role> set = new HashSet<Role>();
+			if(roleIds != null){
+				for(String roleId : roleIds){
+					Role role = roleService.find(roleId);
+					if(role != null){
+						set.add(role);
+					}
+				}
+			}
+			user.setRoles(set);
+			
+			if(StringUtils.isNotBlank(id)){
+				userService.update(user);
+			}else{
+				user.setType(0);
+				userService.save(user);
+			}
+			ajaxResult.setSuccess(true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	
+	/**
+	 * 修改用户状态
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/upd/status")
+	@ResponseBody
+	public AjaxResult ajaxUpdStatus(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String[] ids = request.getParameterValues("ids");
+			String status = request.getParameter("status");
+			
+			userService.updateStatus(ids, Integer.parseInt(status));
+			
+			ajaxResult.setSuccess(true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 皮肤列表
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/skin/list")
+	public String skinList(HttpServletRequest request,Model model){
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_UPDATE_SKIN);
+		return "/user/skin_list";
+	}
+	
+	/**
+	 * 修改皮肤
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/upd/skin")
+	@ResponseBody
+	public AjaxResult ajaxUpdSkin(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String currentSkin = request.getParameter("skin");
+			User user = (User)request.getSession().getAttribute(WebHelper.SESSION_LOGIN_USER);
+			if(user != null){
+				user.setCurrentSkin(currentSkin);
+				this.userService.update(user);
+				request.getSession().setAttribute(WebHelper.SESSION_LOGIN_USER, user);
+				ajaxResult.setSuccess(true);
+			}
+						
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return ajaxResult;
+	}
+	
+	/**
+	 * 校验用户是否存在
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/validator/username")
+	@ResponseBody
+	public Map<String, Object> ajaxValidatorUsername(HttpServletRequest request){
+		Map<String, Object> map = new HashMap<String, Object>();
+		
+		String username = request.getParameter("username");
+		Map<String, Object> params = new HashMap<String, Object>();
+		if(StringUtils.isNotBlank(username)){
+			params.put("username", StringUtils.trim(username));
+		}
+		
+		List<User> users = userService.findUsers(params);
+		if(users != null && !users.isEmpty()){
+			map.put("error", "账号已经存在");
+		}else{
+			map.put("ok", "");
+		}
+		
+		return map;
+	} 
+	
+	/**
+	 * 角色列表
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/role_list")
+	public String roleList(HttpServletRequest request, Model model){		
+		
+		String name = request.getParameter("name");
+		String currentPageStr = request.getParameter("currentPage");
+		String pageSizeStr = request.getParameter("pageSize");
+		
+		int currentPage = 1;
+		int pageSize = 10;
+		if(StringUtils.isNotBlank(currentPageStr)){
+			currentPage = Integer.parseInt(currentPageStr);
+		}
+		if(StringUtils.isNotBlank(pageSizeStr)){
+			pageSize = Integer.parseInt(pageSizeStr);
+		}
+		
+		RoleQueryDTO roleQueryDTO = new RoleQueryDTO();
+		roleQueryDTO.setName(name);
+		roleQueryDTO.setCurrentPage(currentPage);
+		roleQueryDTO.setPageSize(pageSize);
+		
+		PageModel<Role> page = roleService.queryRolePage(roleQueryDTO);
+		model.addAttribute("page", page);
+		model.addAttribute("roleQueryDTO", roleQueryDTO);
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_ROLE_LIST);
+		
+		return "user/role_list";
+	}
+	
+	/**
+	 * 跳转到角色编辑页面
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/dialog/role_edit")
+	public String dialogRoleEdit(HttpServletRequest request, Model model){
+		
+		List<Map<String, Object>> resources = resourceService.getMap();
+		
+		String roleId = request.getParameter("id");
+		if(StringUtils.isNotBlank(roleId)){
+			Role role = roleService.find(roleId);
+			model.addAttribute("role", role);
+			
+			Set<Resource> set = role.getResources();
+			if(set != null && !set.isEmpty()){
+				for(int i=0,size=resources.size();i<size;i++){
+					Map<String, Object> map = resources.get(i);
+					String id = map.get("id").toString();
+					for(Resource resource : set){
+						if(id.equals(resource.getId())){
+							map.put("checked", true);
+							map.put("open", true);
+							break;
+						}
+					}
+				}
+			}
+			
+		}
+		
+		try {
+			ObjectMapper objectMapper = new ObjectMapper();
+			String resourceJson = objectMapper.writeValueAsString(resources);
+			model.addAttribute("resourceJson", resourceJson);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return "user/dialog/role_edit";
+	}
+	
+	/**
+	 * 保存角色
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/save_role")
+	@ResponseBody
+	public AjaxResult ajaxSaveRole(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String id = request.getParameter("id");
+			String name = request.getParameter("name");
+			String description = request.getParameter("description");
+			String[] rescoureIds = request.getParameterValues("rescoureIds");
+			
+			
+			Role role = null;
+			if(StringUtils.isNotBlank(id)){
+				role = roleService.get(id);
+			}else{
+				role = new Role();
+			}
+			
+			role.setName(StringUtils.trim(name));
+			role.setDescription(StringUtils.trim(description));
+			
+			Set<Resource> resources = new HashSet<Resource>();
+			if(rescoureIds != null){
+				for(String rId : rescoureIds){
+					Resource resource = resourceService.find(rId);
+					if(resource != null){
+						resources.add(resource);
+					}
+				}
+			}
+			role.setResources(resources);
+			
+			if(StringUtils.isNotBlank(role.getId())){
+				roleService.update(role);
+			}else{
+				roleService.save(role);
+			}
+			
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+		
+
+	/**
+	 * 角色删除
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/upd_role/delete_flag")
+	@ResponseBody
+	public AjaxResult ajaxUpdRoleDeleteFlag(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String[] ids = request.getParameterValues("ids");
+			String deleteFlag = request.getParameter("deleteFlag");
+			
+			roleService.updateDeleteFlag(ids, deleteFlag);
+			
+			ajaxResult.setSuccess(true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 跳转到菜单列表
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/menu_list")
+	public String menuList(HttpServletRequest request, Model model){
+		String name = request.getParameter("name");
+		Map<String, Object> params = new HashMap<String, Object>();
+		if(StringUtils.isNotBlank(name)){
+			params.put("name", "%" + StringUtils.trim(name) + "%");
+		}
+		model.addAttribute("name", name);
+		
+		List<Resource> resources = resourceService.findMenuResource(params);
+		model.addAttribute("resources", resources);
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_NAME_LIST);
+		
+		return "user/menu_list";
+	}
+	
+	/**
+	 * 逻辑操作菜单状态
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/upd_menu/delete_flag")
+	@ResponseBody
+	public AjaxResult ajaxUpdMenuDeleteFlag(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String[] ids = request.getParameterValues("ids");
+			String deleteFlag = request.getParameter("deleteFlag");
+			
+			resourceService.updateDeleteFlag(ids, deleteFlag);
+			
+			ajaxResult.setSuccess(true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 跳转到菜单编辑页面
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/dialog/menu_edit")
+	public String dialogMenuEdit(HttpServletRequest request, Model model){
+		
+		String id = request.getParameter("id");
+		if(StringUtils.isNotBlank(id)){
+			Resource resource = resourceService.find(id);
+			model.addAttribute("resource", resource);
+		}
+		
+		List<Resource> modelResources = resourceService.getRootResourceList();
+		model.addAttribute("modelResources", modelResources);
+		
+		return "user/dialog/menu_edit";
+	}
+	
+	/**
+	 * 保存菜单
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/save_menu")
+	@ResponseBody
+	public AjaxResult ajaxSaveMenu(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			String id = request.getParameter("id");
+			String name = request.getParameter("name");
+			String type = request.getParameter("type");
+			String parentId = request.getParameter("parentId");
+			String url = request.getParameter("url");
+			String icon = request.getParameter("icon");
+			String orderNoStr = request.getParameter("orderNo");
+			Integer orderNo = null;
+			if(StringUtils.isNotBlank(orderNoStr)){
+				orderNo = Integer.parseInt(orderNoStr);
+			}
+			
+			Resource resource = null;
+			if(StringUtils.isNotBlank(id)){
+				resource = resourceService.find(id);
+			}else{
+				resource = new Resource();
+			}
+			resource.setName(StringUtils.trim(name));
+			resource.setType(type);
+			Resource parentResource = null;
+			if(StringUtils.isNotBlank(parentId) && "page".equals(type)){
+				parentResource = resourceService.find(parentId);
+			}
+			resource.setParent(parentResource);
+			resource.setUrl(StringUtils.trim(url));
+			resource.setIcon(StringUtils.trim(icon));
+			resource.setOrderNo(orderNo);
+			
+			resourceService.saveResource(resource);
+			
+			ajaxResult.setSuccess(true);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		
+		return ajaxResult;
+	}
+	
+	/**
+	 * 跳转到修改密码
+	 * @param request
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping("/update_pwd")
+	public String updatePwd(HttpServletRequest request, Model model){
+		
+		model.addAttribute(Constants.MENU_NAME, Constants.MENU_UPDATE_PWD);
+		
+		return "user/update_pwd";
+	}
+	
+	/**
+	 * 保存密码
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping("/ajax/save_pwd")
+	@ResponseBody
+	public AjaxResult ajaxSavePwd(HttpServletRequest request){
+		AjaxResult ajaxResult = new AjaxResult();
+		ajaxResult.setSuccess(false);
+		
+		try {
+			
+			User user = WebHelper.getUser(request);
+			
+			String oldPwd = request.getParameter("oldPwd");
+			String pwd = request.getParameter("pwd");
+			
+			user = userService.find(user.getId());
+			if(Md5Util.generatePassword(oldPwd).equals(user.getPassword())){
+				
+				user.setPassword(Md5Util.generatePassword(pwd));
+				userService.update(user);
+				
+				ajaxResult.setSuccess(true);
+			}else{
+				ajaxResult.setMsg("原始密码输入不正确");
+			}
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			ajaxResult.setMsg("修改失败");
+		}
+		
+		return ajaxResult;
+	}
+	
+}

+ 22 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/shiro/RememberAuthenticationFilter.java

@@ -0,0 +1,22 @@
+package com.jeff.tianti.shiro;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
+
+public class RememberAuthenticationFilter extends FormAuthenticationFilter{
+	
+	/**
+	 * 判断是否让用户登陆
+	 */
+	@Override
+	protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
+		
+		Subject subject = getSubject(request, response);
+		
+		return subject.isAuthenticated() || subject.isRemembered();
+	}
+
+}

+ 157 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/shiro/ShiroDBRealm.java

@@ -0,0 +1,157 @@
+package com.jeff.tianti.shiro;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.LockedAccountException;
+import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.jeff.tianti.org.entity.Resource;
+import com.jeff.tianti.org.entity.Role;
+import com.jeff.tianti.org.entity.User;
+import com.jeff.tianti.org.service.ResourceService;
+import com.jeff.tianti.org.service.UserService;
+import com.jeff.tianti.util.WebHelper;
+
+public class ShiroDBRealm extends AuthorizingRealm{
+	
+	@Autowired
+	private UserService userService;
+	
+	@Autowired
+	private ResourceService resourceService;
+	
+	/**
+	 * 授权
+	 */
+	@Override
+	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+		
+		String userName = (String) principals.getPrimaryPrincipal();
+		User user = userService.findUserByName(userName);
+		SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
+		Set<Role> roleSet = user.getRoles();
+
+		Set<String> permissionSet = new HashSet<String>();
+		for (Role role : roleSet) {
+			if(StringUtils.isNotBlank(role.getRoleName())){
+				info.addRole(role.getRoleName());
+				Set<Resource> resources = role.getResources();
+				if(resources!=null && !resources.isEmpty()){
+					for(Resource r : resources){
+						if(StringUtils.isNotBlank(r.getUrl())){
+							permissionSet.add(r.getUrl());
+						}
+					}
+				}
+			}
+		}
+		
+		info.addStringPermissions(permissionSet);
+
+		return info;
+	}
+
+	/**
+	 * 验证当前用户
+	 */
+	@Override
+	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
+		UsernamePasswordToken token = (UsernamePasswordToken)authcToken;
+        
+        if(StringUtils.isEmpty(token.getUsername())){
+        	return null;
+        }
+        
+        User user = userService.findUserByName(token.getUsername());
+        if(user != null){
+        	
+        	if(user.getStatus() == User.STATUS_NO){
+        		throw new LockedAccountException();
+        	}
+        	
+        	AuthenticationInfo authcInfo = new SimpleAuthenticationInfo(user.getUsername(), user.getPassword(), getName());
+        	
+        	setSession(WebHelper.SESSION_LOGIN_USER, user);
+        	
+        	initMenu(user.getId());
+        	
+        	return authcInfo;
+        }
+        
+        return null;
+	}
+	
+	private void initMenu(String userId){
+
+		//菜单权限
+		List<Resource> menuResources = resourceService.findAllMenu();
+		
+		List<Resource> hasResource = new ArrayList<Resource>();
+		
+		Map<String, Object> map = userService.findResourceMap(userId);
+		
+		if(menuResources != null && !menuResources.isEmpty()){
+			for(Resource resource : menuResources){
+				Resource retRes = hasResource(resource, map);
+				if(retRes != null){
+					hasResource.add(retRes);
+				}
+			}
+		}
+		
+		setSession(WebHelper.SESSION_MENU_RESOURCE, hasResource);
+		
+	}
+	
+	private Resource hasResource(Resource resource, Map<String, Object> map){
+		if(map.containsKey(resource.getId())){
+			List<Resource> chResources = resource.getChildren();
+			List<Resource> hasChResources = new ArrayList<Resource>();
+			if(chResources != null && !chResources.isEmpty()){
+				for(Resource chRes : chResources){
+					Resource retRes = hasResource(chRes, map);
+					if(retRes != null){
+						hasChResources.add(retRes);
+					}
+				}
+			}
+			resource.setChildren(hasChResources);
+			return resource;
+		}else{
+			return null;
+		}
+	}
+	
+	/**
+	 * 
+	 * @param key
+	 * @param value
+	 */
+	private void setSession(Object key, Object value){
+		Subject subject = SecurityUtils.getSubject();
+		if(subject != null){
+			Session session = subject.getSession();
+			if(session != null){
+				session.setAttribute(key, value);
+			}
+		}
+	}
+
+}

+ 19 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/util/Constants.java

@@ -0,0 +1,19 @@
+package com.jeff.tianti.util;
+
+public class Constants {
+	
+	public static final String HEAD_NAME = "head_name";
+	public static final String MENU_NAME = "menu_name";
+	
+	public static final String ROLE_INSTITUTION = "role_institution";
+	
+	public static final String MENU_ROLE_LIST = "角色列表";
+	public static final String MENU_USER_LIST = "用户列表";
+	public static final String MENU_NAME_LIST = "菜单列表";
+	public static final String MENU_COLUMN_LIST = "栏目列表";
+	public static final String MENU_ARTICLE_LIST = "文章列表";
+	
+	public static final String MENU_UPDATE_PWD = "修改密码";
+	public static final String MENU_UPDATE_SKIN = "换肤管理";
+
+}

+ 77 - 0
tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/util/WebHelper.java

@@ -0,0 +1,77 @@
+package com.jeff.tianti.util;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.ui.Model;
+
+import com.jeff.tianti.org.entity.User;
+
+public class WebHelper {
+	
+	public static final String SESSION_LOGIN_USER = "session_login_user";
+
+	public static final String SESSION_MENU_RESOURCE = "session_menu_resource";
+
+	public static final String SESSION_NO_IMPORT_SCORE = "session_no_import_score";
+
+	/**
+	 * 
+	 * @param request
+	 * @return
+	 */
+	public static Integer getCurrentPage(HttpServletRequest request) {
+
+		String currentPage = request.getParameter("currentPage");
+		if (StringUtils.isNotBlank(currentPage)
+				&& StringUtils.isNumeric(currentPage)) {
+			return Integer.parseInt(currentPage);
+		}
+
+		return null;
+	}
+
+	/**
+	 * 
+	 * @param request
+	 * @return
+	 */
+	public static Integer getPageSize(HttpServletRequest request) {
+
+		String pageSize = request.getParameter("pageSize");
+		if (StringUtils.isNotBlank(pageSize) && StringUtils.isNumeric(pageSize)) {
+			return Integer.parseInt(pageSize);
+		}
+
+		return null;
+	}
+
+	/**
+	 * 
+	 * @param request
+	 * @return
+	 */
+	public static User getUser(HttpServletRequest request) {
+		return (User) request.getSession().getAttribute(SESSION_LOGIN_USER);
+	}
+
+	public static String getRemoteHost(HttpServletRequest request) {
+		String ip = request.getHeader("x-forwarded-for");
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getHeader("Proxy-Client-IP");
+		}
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getHeader("WL-Proxy-Client-IP");
+		}
+		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+			ip = request.getRemoteAddr();
+		}
+		return ip.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ip;
+	}
+
+	public static void setGoBackUrl(HttpServletRequest request, Model model) {
+		String fromUrl = request.getHeader("referer");
+		model.addAttribute("goBackUrl", fromUrl);
+	}
+
+}

+ 9 - 0
tianti-modules/tianti-module-admin/src/main/resources/application.development.properties

@@ -0,0 +1,9 @@
+#mysql database setting
+jdbc.driver=com.mysql.jdbc.Driver
+jdbc.url=jdbc:mysql://39.105.129.147:3306/tianti_stage?useUnicode=true&characterEncoding=utf-8
+jdbc.username=root
+jdbc.password=123456
+
+#connection pool settings
+jdbc.pool.maxIdle=10
+jdbc.pool.maxActive=50

+ 9 - 0
tianti-modules/tianti-module-admin/src/main/resources/application.production.properties

@@ -0,0 +1,9 @@
+#mysql database setting
+jdbc.driver=com.mysql.jdbc.Driver
+jdbc.url=jdbc:mysql://39.105.129.147:3306/tianti_stage?useUnicode=true&characterEncoding=utf-8
+jdbc.username=root
+jdbc.password=123456
+
+#connection pool settings
+jdbc.pool.maxIdle=10
+jdbc.pool.maxActive=50

+ 50 - 0
tianti-modules/tianti-module-admin/src/main/resources/applicationContext-cache.xml

@@ -0,0 +1,50 @@
+<?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" 
+	xmlns:jdbc="http://www.springframework.org/schema/jdbc"  
+	xmlns:jee="http://www.springframework.org/schema/jee" 
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
+	xmlns:cache="http://www.springframework.org/schema/cache"
+	xmlns:aop="http://www.springframework.org/schema/aop"
+	xsi:schemaLocation="
+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
+		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
+		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
+		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
+		http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
+		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd"
+	>
+
+	<context:annotation-config/>
+	
+	<cache:annotation-driven cache-manager="cacheManager"/>
+
+	<!-- spring cache -->	
+	<!-- <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
+        <property name="caches">
+            <set>
+                <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
+                    <property name="name" value="default"/>
+                </bean>
+                <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
+                    <property name="name" value="productType"/>
+                </bean>
+            </set>
+        </property>
+    </bean> -->
+
+	<!-- eh-cache -->
+	<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+		<property name="configLocation" value="classpath:ehcache.xml"/>
+	</bean>
+	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
+		<property name="cacheManager" ref="cacheManagerFactory"/>
+	</bean>
+	
+	
+</beans>

+ 101 - 0
tianti-modules/tianti-module-admin/src/main/resources/applicationContext-shiro.xml

@@ -0,0 +1,101 @@
+<?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" xmlns:jdbc="http://www.springframework.org/schema/jdbc"  
+	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
+	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
+	xsi:schemaLocation="
+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
+		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
+		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
+		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd"
+	>
+
+	<description>shiro配置</description>
+
+	
+	<!-- 记住我 -->
+	<!-- 会话Cookie模板 -->  
+	<bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">  
+	    <constructor-arg value="sid"/>  
+	    <property name="httpOnly" value="true"/>  
+	    <property name="maxAge" value="-1"/>  
+	</bean>  
+	<bean id="rememberMeCookie" class="org.apache.shiro.web.servlet.SimpleCookie">  
+	    <constructor-arg value="rememberMe"/>  
+	    <property name="httpOnly" value="true"/>  
+	    <property name="maxAge" value="2592000"/><!-- 30天 -->  
+	</bean>
+	
+	<!-- rememberMe管理器 -->  
+	<bean id="rememberMeManager" class="org.apache.shiro.web.mgt.CookieRememberMeManager">  
+	    <property name="cipherKey" value="#{T(org.apache.shiro.codec.Base64).decode('4AvVhmFLUs0KTA3Kprsdag==')}"/>  
+	    <property name="cookie" ref="rememberMeCookie"/>  
+	</bean>
+	
+	<bean id="rememberAuthFilter"  class="com.jeff.tianti.shiro.RememberAuthenticationFilter">  
+	    <property name="rememberMeParam" value="rememberMe"/>
+	</bean>
+	
+	
+	<!-- 继承自AuthorizingRealm的自定义Realm,即指定Shiro验证用户登录的类为自定义的ShiroDbRealm.java -->  
+	<bean id="myRealm" class="com.jeff.tianti.shiro.ShiroDBRealm"/>
+	
+	<!-- Shiro默认会使用Servlet容器的Session,可通过sessionMode属性来指定使用Shiro原生Session -->  
+	<!-- 即<property name="sessionMode" value="native"/>,详细说明见官方文档 -->  
+	<!-- 这里主要是设置自定义的单Realm应用,若有多个Realm,可使用'realms'属性代替 -->  
+	<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">  
+	    <property name="realm" ref="myRealm"/> 
+	    <property name="rememberMeManager" ref="rememberMeManager"/> 
+	</bean>
+	
+	<!-- Shiro主过滤器本身功能十分强大,其强大之处就在于它支持任何基于URL路径表达式的、自定义的过滤器的执行 -->  
+	<!-- Web应用中,Shiro可控制的Web请求必须经过Shiro主过滤器的拦截,Shiro对基于Spring的Web应用提供了完美的支持 -->  
+	<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">  
+	    <!-- Shiro的核心安全接口,这个属性是必须的 -->  
+	    <property name="securityManager" ref="securityManager"/>  
+	    <!-- 要求登录时的链接(可根据项目的URL进行替换),非必须的属性,默认会自动寻找Web工程根目录下的"/login.jsp"页面 -->  
+	    <property name="loginUrl" value="/index"/>  
+	    <!-- 登录成功后要跳转的连接(本例中此属性用不到,因为登录成功后的处理逻辑在LoginController里硬编码为main.jsp了) -->  
+	    <!-- <property name="successUrl" value="/system/main"/> -->  
+	    <!-- 用户访问未对其授权的资源时,所显示的连接 -->  
+	    <!-- 若想更明显的测试此属性可以修改它的值,如unauthor.jsp,然后用[玄玉]登录后访问/admin/listUser.jsp就看见浏览器会显示unauthor.jsp -->  
+	    <property name="unauthorizedUrl" value="/"/>  
+	    <!-- Shiro连接约束配置,即过滤链的定义 -->  
+	    <!-- 此处可配合我的这篇文章来理解各个过滤连的作用http://blog.csdn.net/jadyer/article/details/12172839 -->  
+	    <!-- 下面value值的第一个'/'代表的路径是相对于HttpServletRequest.getContextPath()的值来的 -->  
+	    <!-- anon:它对应的过滤器里面是空的,什么都没做,这里.do和.jsp后面的*表示参数,比方说login.jsp?main这种 -->  
+	    <!-- authc:该过滤器下的页面必须验证后才能访问,它是Shiro内置的一个拦截器org.apache.shiro.web.filter.authc.FormAuthenticationFilter -->
+	    <!-- rememberAuthFilter -->  
+	    <property name="filterChainDefinitions">  
+	        <value>
+	        	 /index = anon
+	        	 /error_page = anon
+	        	 /static/** = anon
+	        	 /ueditor/** = anon
+	        	 /uploads/** = anon
+	        	 /upload/** = anon
+	             /do_login = anon
+	             /login = anon
+	             /forget**/** = anon
+	             /** = rememberAuthFilter
+	        </value>  
+	    </property>
+	</bean>  
+	
+	<!-- 保证实现了Shiro内部lifecycle函数的bean执行 -->  
+	<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>  
+	   
+	<!-- 开启Shiro的注解(如@RequiresRoles,@RequiresPermissions),需借助SpringAOP扫描使用Shiro注解的类,并在必要时进行安全逻辑验证 -->  
+	<!-- 配置以下两个bean即可实现此功能 -->  
+	<!-- Enable Shiro Annotations for Spring-configured beans. Only run after the lifecycleBeanProcessor has run -->  
+	<!-- 由于本例中并未使用Shiro注解,故注释掉这两个bean(个人觉得将权限通过注解的方式硬编码在程序中,查看起来不是很方便,没必要使用) -->  
+	<!--   
+	<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"/>  
+	  <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">  
+	    <property name="securityManager" ref="securityManager"/>  
+	  </bean>  
+	-->
+	
+</beans>

+ 148 - 0
tianti-modules/tianti-module-admin/src/main/resources/applicationContext.xml

@@ -0,0 +1,148 @@
+<?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"
+	xmlns:jdbc="http://www.springframework.org/schema/jdbc"
+	xmlns:jee="http://www.springframework.org/schema/jee"
+	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
+	xmlns:aop="http://www.springframework.org/schema/aop"
+	default-lazy-init="true"
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
+		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
+		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+
+
+	<description>Spring公共配置 </description>
+
+	<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
+	<context:component-scan base-package="com.jeff.tianti"/>
+
+	<!-- Jpa Entity Manager 配置 -->
+	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
+		<property name="dataSource" ref="dataSource"/>
+		<property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
+		<property name="packagesToScan">
+			<list>
+				<value>com.jeff.tianti</value>
+				<!-- <value>com.vision.edu</value> -->
+			</list>
+		</property>
+		<property name="jpaProperties">
+			<props>
+				<!-- 命名规则 My_NAME->MyName -->
+				<prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
+			</props>
+		</property>
+	</bean>
+	
+	<bean id="hibernateJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+		<property name="databasePlatform">
+			<bean factory-method="getDialect" class="org.springside.modules.persistence.Hibernates">
+				<constructor-arg ref="dataSource"/>
+			</bean>
+		</property>
+		
+		<property name="generateDdl" value="true" />
+		<property name="showSql" value="true" />
+		<!--  
+		<property name="jpaPropertyMap">
+			<map>
+				<entry key="hibernate.query.substitutions" value="true 1, false 0" />
+				<entry key="hibernate.default_batch_fetch_size" value="16" />
+				<entry key="hibernate.max_fetch_depth" value="2" />
+				<entry key="hibernate.generate_statistics" value="true" />
+				<entry key="hibernate.bytecode.use_reflection_optimizer" value="true" />
+				<entry key="hibernate.cache.use_second_level_cache" value="false" />
+				<entry key="hibernate.cache.use_query_cache" value="false" />
+			</map>
+		</property>
+		-->
+	</bean>
+
+	<!-- Spring Data Jpa配置 -->
+ 	<jpa:repositories base-package="com.jeff.tianti"  transaction-manager-ref="transactionManager" entity-manager-factory-ref="entityManagerFactory"/>
+   
+	<!-- Jpa 事务配置 -->
+	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+		<property name="entityManagerFactory" ref="entityManagerFactory"/>
+	</bean>
+	
+	<!-- 事务声明配置 -->
+	<tx:advice id="txAdvice" transaction-manager="transactionManager">
+		<tx:attributes>
+			<tx:method name="save*" propagation="REQUIRED" />
+			<tx:method name="create*" propagation="REQUIRED" />
+			<tx:method name="remove*" propagation="REQUIRED" />
+			<tx:method name="del*" propagation="REQUIRED" />
+			<tx:method name="update*" propagation="REQUIRED" />
+			<tx:method name="modify*" propagation="REQUIRED" />
+			<tx:method name="get*" propagation="REQUIRED" />
+			<tx:method name="find*" propagation="REQUIRED" />
+			<tx:method name="do*" propagation="REQUIRED" />
+			<tx:method name="*" propagation="REQUIRED" read-only="true"/>
+		</tx:attributes>
+	</tx:advice>
+	<aop:config>
+		<aop:pointcut expression="execution (* com.jeff..service..*.*(..))" id="txPointcut"/>
+		<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
+	</aop:config>
+
+	<!-- JSR303 Validator定义 -->
+ 	<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
+	
+ 	<!-- jdbcTemplate配置 -->
+	<bean id = "jdbcTemplate" class = "org.springframework.jdbc.core.JdbcTemplate">   
+        <property name = "dataSource" ref="dataSource"/>   
+    </bean>
+ 	
+	<!-- production环境 -->
+ 	<beans profile="production">
+ 		<context:property-placeholder ignore-unresolvable="true"
+			location="classpath*:/application.production.properties" />	
+		
+		<!-- 数据源配置, 使用Tomcat JDBC连接池 -->
+		<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
+			<!-- Connection Info -->
+			<property name="driverClassName" value="${jdbc.driver}" />
+			<property name="url" value="${jdbc.url}" />
+			<property name="username" value="${jdbc.username}" />
+			<property name="password" value="${jdbc.password}" />
+		
+			<!-- Connection Pooling Info -->
+			<property name="maxActive" value="${jdbc.pool.maxActive}" />
+			<property name="maxIdle" value="${jdbc.pool.maxIdle}" />
+			<property name="minIdle" value="0" />
+			<property name="defaultAutoCommit" value="false" />
+			<property name="validationQuery" value="select 1" />
+		</bean>
+		
+		<!-- 数据源配置,使用应用服务器的数据库连接池 -->
+		<!--<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/ExampleDB" />-->
+	</beans>
+	
+	<!-- local development环境 -->
+	<beans profile="development">
+		<context:property-placeholder ignore-resource-not-found="true"
+			location="classpath*:/application.development.properties" />	
+
+		<!-- Tomcat JDBC连接池 -->
+		<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
+			<property name="driverClassName" value="${jdbc.driver}" />
+			<property name="url" value="${jdbc.url}" />
+			<property name="username" value="${jdbc.username}" />
+			<property name="password" value="${jdbc.password}" />
+			
+			<!-- Connection Pooling Info -->
+			<property name="maxActive" value="${jdbc.pool.maxActive}" />
+			<property name="maxIdle" value="${jdbc.pool.maxIdle}" />
+			<property name="minIdle" value="0" />
+			<property name="defaultAutoCommit" value="false" />
+			<property name="validationQuery" value="select 1" />
+		</bean>
+	</beans>	
+</beans>

+ 24 - 0
tianti-modules/tianti-module-admin/src/main/resources/ehcache.xml

@@ -0,0 +1,24 @@
+<ehcache>
+
+    <diskStore path="java.io.tmpdir"/>
+	
+    <defaultCache
+            maxElementsInMemory="10000"
+            eternal="false"
+            timeToIdleSeconds="120"
+            timeToLiveSeconds="120"
+            overflowToDisk="true"
+            maxElementsOnDisk="10000000"
+            diskPersistent="false"
+            diskExpiryThreadIntervalSeconds="120"
+            memoryStoreEvictionPolicy="LRU"
+            />
+     
+     <cache name="org_cache"
+     		maxElementsOnDisk="20000"  
+            maxElementsInMemory="2000"  
+            eternal="true"  
+            overflowToDisk="true"  
+            diskPersistent="false"/>
+     
+</ehcache>

+ 7 - 0
tianti-modules/tianti-module-admin/src/main/resources/log4j.properties

@@ -0,0 +1,7 @@
+##
+log4j.logger.jdbc.sqlonly=DEBUG,sql 
+log4j.appender.sql=org.apache.log4j.ConsoleAppender 
+log4j.appender.sqlThreshold=debug 
+log4j.appender.sqlTarget=System.out log4j.appender.sqlEncoding=utf-8 
+log4j.appender.sql.layout=org.apache.log4j.PatternLayout 
+log4j.appender.sql.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS}  [%thread] - %msg%n

+ 7 - 0
tianti-modules/tianti-module-admin/src/main/resources/log4jdbc.properties

@@ -0,0 +1,7 @@
+#Optional properties
+#log4jdbc.debug.stack.prefix=
+#log4jdbc.sqltiming.warn.threshold=
+log4jdbc.dump.sql.select=true
+log4jdbc.dump.sql.insert=true
+log4jdbc.dump.sql.update=true
+log4jdbc.dump.sql.delete=true

BIN
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/pager-taglib.jar


BIN
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/springside-core-4.2.2.GA.jar


BIN
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/statistics-1.0.2.jar


BIN
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/lib/ueditor-1.1.1.jar


+ 47 - 0
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/springmvc-servlet.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 注意下面不要忘记导入mvc、context的schema -->  
+<beans xmlns="http://www.springframework.org/schema/beans"  
+xmlns:mvc="http://www.springframework.org/schema/mvc"  
+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/mvc   
+http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd   
+http://www.springframework.org/schema/context   
+http://www.springframework.org/schema/context/spring-context-3.0.xsd">  
+  	<description>Spring-web MVC配置</description>
+  	<!-- 开启自动扫描包 -->  
+    <context:component-scan base-package="com.jeff.tianti.controller"/>  
+    <!-- 开启注解驱动 -->  
+    <mvc:annotation-driven/>
+  
+   	<!-- 在地址栏访问 "网站根路径 + /404",所跳转到的页面404.jsp -->  
+    <mvc:view-controller path="/404" view-name="404"/>  
+    <mvc:view-controller path="/500" view-name="500"/>  
+  
+  	<!--   
+         配置不用DispatcherServlet拦截的路径(例如:图片、CSS样式、js文件...):   
+        路径可以自己设置,这里面我用static(WebRoot中的文件夹);   
+        其中的"**"代表路径及其子路径       
+     -->  
+    <mvc:resources location="/static/" mapping="/static/**"/> 
+    <mvc:resources location="/ueditor/" mapping="/ueditor/**"/> 
+    <mvc:resources location="/uploads/" mapping="/uploads/**"/> 
+  
+    <!-- 配置视图解析器 -->  
+    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">  
+        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>  
+        <!--    
+            上面的配置是固定的,下面两个配置意思是:如果你要访问index视图,   
+            它会自动 prefix(前缀) + index + suffix(后缀),   
+            生成/WEB-INF/views/index.jsp    
+        -->  
+        <property name="prefix" value="/WEB-INF/views/"/>  
+        <property name="suffix" value=".jsp"/>  
+    </bean> 
+    
+    <!-- 支持上传文件 -->
+    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>  
+</beans>

+ 515 - 0
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/views/cms/article_default_list.jsp

@@ -0,0 +1,515 @@
+<%@ page language="java" pageEncoding="UTF-8" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+<%@ include file="../common/common.jsp" %>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>${menu_name} - ${title }</title>
+</head>
+
+<body <%@ include file="../common/skin.jsp" %>>
+	<%@ include file="../common/head.jsp" %>
+    <%@ include file="../common/menu.jsp" %>
+
+	<div data-ui="header" class="J_header">
+        <div class="h_left">
+            <div class="l_nav">
+                <div class="n_item
+                    <c:if test="${articleQueryDTO.type == null || articleQueryDTO.type == '' }">current</c:if>
+                ">
+                    <div class="i_default"><a href="${ctx }/cms/article/list"><span>全部文章(
+                    <c:choose>
+                      <c:when test="${statisMap.totalCount != null }">
+                         ${statisMap.totalCount}
+                      </c:when>
+                      <c:otherwise>
+                        0
+                      </c:otherwise>
+                    </c:choose>   
+                                          )</span><b></b></a></div>
+                </div>
+                <div class="n_item
+                    <c:if test="${articleQueryDTO.type == 'zhiding' }">current</c:if>
+                ">
+                    <div class="i_default"><a href="${ctx }/cms/article/list?type=zhiding&rootColumnId=${articleQueryDTO.rootColumnId}"><span>置顶文章(
+                     <c:choose>
+                      <c:when test="${statisMap.zhidingCount != null }">
+                         ${statisMap.zhidingCount}
+                      </c:when>
+                      <c:otherwise>
+                        0
+                      </c:otherwise>
+                    </c:choose>        
+                                         )</span><b></b></a></div>
+                </div>
+                <div class="n_item
+                    <c:if test="${articleQueryDTO.type == 'shenhe' }">current</c:if>
+                ">
+                    <div class="i_default"><a href="${ctx }/cms/article/list?rootColumnId=${articleQueryDTO.rootColumnId}"><span>审核列表(
+                    <c:choose>
+                      <c:when test="${statisMap.shenheCount != null }">
+                         ${statisMap.shenheCount}
+                      </c:when>
+                      <c:otherwise>
+                        0
+                      </c:otherwise>
+                    </c:choose>    
+                                          )</span><b></b></a></div>
+                </div>
+                <div class="n_item
+                    <c:if test="${articleQueryDTO.type == 'laji' }">current</c:if>
+                ">
+                    <div class="i_default"><a href="${ctx }/cms/article/list?type=laji&rootColumnId=${articleQueryDTO.rootColumnId}"><span>垃圾箱(
+                    <c:choose>
+                      <c:when test="${statisMap.deleteCount != null }">
+                         ${statisMap.deleteCount}
+                      </c:when>
+                      <c:otherwise>
+                        0
+                      </c:otherwise>
+                    </c:choose>    )</span><b></b></a></div>
+                </div>
+            </div> 
+        </div>
+    </div>
+
+    <div class="J_content">
+		
+		<div class="mt20 plr20">	
+		    <form action="${ctx }/cms/article/list" id="queryForm" method="POST">
+		        <input type="hidden" name="type" value="${type }" />
+		        <input type="hidden" name="columnId" value="${articleQueryDTO.columnId }" />
+			<input type="hidden" name="rootColumnId" value="${articleQueryDTO.rootColumnId }" />
+		        <div class="J_toolsBar clearfix">
+					<div class="t_text ml10">
+	                	<input placeholder="标题" type="text" style="width:200px" id="title" name="title" value="${articleQueryDTO.title }">
+	                </div>
+	                <div class="t_text ml10">
+	                	<input placeholder="发布人" type="text" style="width:200px" id="publisher" name="publisher" value="${articleQueryDTO.publisher }">
+	                </div>
+	                <div class="t_text ml10">
+	                	<input placeholder="开始时间" type="text" id="startDate" name="startDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="${articleQueryDTO.startDate }">
+	                </div>
+	                <div class="t_text ml10">
+	                	<input placeholder="结束时间" type="text" id="endDate" name="endDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="${articleQueryDTO.endDate }">
+	                </div>
+	                <div class="t_button ml10">
+	                
+	               		<a class="abtn red" href="javascript:myQuery();">
+	               		     <i class="icon"></i>查询
+	               		</a>
+	               	</div>
+	               	<div class="t_button ml10">
+	               		<a class="abtn blue" href="javascript:myEdit();">
+	               		     <i class="icon"></i>新增
+	               		</a>
+	               	</div>
+	               	<div class="t_button ml10">
+	               		<a class="abtn red" href="javascript:myAduit('','1');">
+	               		     <i class="icon"></i>审核通过
+	               		</a>
+	               	</div>
+	               	<div class="t_button ml10">
+	               		<a class="abtn blue" href="javascript:myAduit('','0');">
+	               		     <i class="icon"></i>审核不通过
+	               		</a>
+	               	</div>
+	               	<div class="t_button ml10">
+	               		<a class="abtn red" href="javascript:myTop('','1');">
+	               		     <i class="icon"></i>置顶
+	               		</a>
+	               	</div>
+	               	<div class="t_button ml10">
+	               		<a class="abtn blue" href="javascript:myTop('','0');">
+	               		     <i class="icon"></i>取消置顶
+	               		</a>
+	               	</div>
+	               	<div class="t_label ml10">
+	               		记录数:<font color="red" id="totalRecode">${page.totalCount}</font>
+	               	</div>
+				</div>
+				<div style="text-align: right; line-height: 40px; font-size: 12px; color: red;">文章只有审核通过且未删除才能在前端显示,如果设置为置顶则在该模块优先显示。</div>
+				<input type="hidden" id="isCreateDateSort" name="isCreateDateSort" value="${articleQueryDTO.createDateSortCss }" />
+			<div class="J_column">		
+			 <div class="c_left">
+			   <div class="J_filterGroup">
+                   <div class="f_toolbar">
+                       <div class="t_text">栏目列表</div>
+                   </div>
+                   <div class="f_main">
+                            <div class="m_list">
+	                            <c:forEach items="${columnInfoDTOList }" var="c">
+	                               <div class="m_item
+	                               <c:if test="${c.id == articleQueryDTO.rootColumnId }">open</c:if>
+	                               ">
+                                     <div class="i_default
+                                     <c:if test="${c.id == articleQueryDTO.rootColumnId }">current</c:if>
+                                     ">
+                                        <a href="${ctx }/cms/article/list?rootColumnId=${c.id}&type=${type}">${c.name }</a>
+                                     </div>
+                                     <div class="i_menu">
+                                        <c:forEach items="${c.childColumnInfoList }" var="rc">
+                                            <div class="m_item
+                                             <c:if test="${rc.id == articleQueryDTO.columnId }">open</c:if>
+                                            ">
+	                                            <div class="i_default
+	                                             <c:if test="${rc.id == articleQueryDTO.columnId }">current</c:if>
+	                                            ">
+	                                                <a href="${ctx }/cms/article/list?rootColumnId=${c.id}&columnId=${rc.id}&type=${type}">${rc.name }</a>
+	                                            </div>
+	                                        </div>
+                                        </c:forEach>
+                                        
+                                      </div>
+                                    </div>	                               
+	                            </c:forEach>
+                            </div>
+                    </div>
+               </div>
+			 </div>
+			 <div class="c_right">
+			   <div class="J_table mt20">
+                 <div class="t_table">
+                     <table>
+                         <thead>
+                             <tr>
+                                 <td>
+                                   <input type="checkbox" name="selectAll" id="selectAll" onclick="selectAllIds();" />
+                                 </td>
+                                 <td>
+                                 	<span>标题</span>
+                                 </td>
+                                 <td>
+                                    <span>栏目</span>
+                                 </td>
+                                 <td>
+                                    <span>发布者</span>
+                                 </td>
+                                 <td>
+                                    <span>阅读数</span>
+                                 </td>
+                                 <td id="createDateTd"
+                                 <c:choose>
+                                    <c:when test = "${articleQueryDTO.createDateSortCss != null && articleQueryDTO.createDateSortCss != ''  }">
+                                       class = "${articleQueryDTO.createDateSortCss}"
+                                    </c:when>
+                                    <c:otherwise>
+                                      class="down"
+                                    </c:otherwise>
+                                  </c:choose>
+                                   data-type="sort">
+                                      <span>发布日期</span><i></i>
+                                 </td>
+                                 <td>
+                                     <span>是否审核</span>
+                                 </td>
+                                 <td>
+                                     <span>是否置顶</span>
+                                 </td>
+                                 <td>
+                                     <span>状态</span>
+                                 </td>
+                                 <td>
+                                     <span>操作</span>
+                                 </td>
+                             </tr>
+                         </thead>
+                     
+                         <tbody>
+                         	<c:forEach items="${page.list }" var="p">
+	                            <tr >
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         <input type="checkBox" name="selecteId" value="${p.id }" />
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         ${p.title }
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         ${p.columnInfo.name }
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         ${p.publisher }
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         <c:choose>
+	                                            <c:when test="${p.viewCount != null }">
+	                                               ${p.viewCount }
+	                                            </c:when>
+	                                            <c:otherwise>
+	                                               0
+	                                            </c:otherwise>
+	                                         </c:choose>
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         <fmt:formatDate value="${p.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/>
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         <c:choose>
+	                                         	<c:when test="${p.isAudit eq 'true' }">
+	                                         		是
+	                                         	</c:when>
+	                                         	<c:otherwise>
+	                                         	  <font color="red">否</font>
+	                                         	</c:otherwise>
+	                                         </c:choose>
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         <c:choose>
+	                                         	<c:when test="${p.isTop eq 'true' }">
+	                                         	           是
+	                                         	</c:when>
+	                                         	<c:otherwise>
+	                                         		<font color="red">否</font>
+	                                         	</c:otherwise>
+	                                         </c:choose>
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_text tc">
+	                                         <c:choose>
+	                                         	<c:when test="${p.deleteFlag eq '0' }">
+	                                         		正常
+	                                         	</c:when>
+	                                         	<c:otherwise>
+	                                         		<font color="red">删除</font>
+	                                         	</c:otherwise>
+	                                         </c:choose>
+	                                     </div>
+	                                 </td>
+	                                 <td>
+	                                     <div class="t_link">
+	                                          <a href="javascript:myEdit('${p.id }');"><i class="icon"></i>编辑</a>
+		                                      <c:choose>
+		                                         <c:when test="${p.deleteFlag eq '0' }">
+		                                         	<a href="javascript:updDeleteFlag('${p.id }', '1');"><i class="icon"></i>删除</a>
+		                                         </c:when>
+		                                         <c:otherwise>
+		                                         	<a href="javascript:updDeleteFlag('${p.id }', '0');"><i class="icon"></i>恢复</a>
+		                                         </c:otherwise>
+		                                      </c:choose>
+	                                     </div>
+	                                 </td>
+	                             </tr>
+                             </c:forEach>
+                         </tbody>
+                     </table>
+                 </div>
+                 <%@ include file="../common/pager.jsp"%>
+               </div>	
+             </div>	
+           </div>
+          </form>	
+		</div>
+    </div>
+	
+	<script type="text/javascript">
+
+		function updDeleteFlag(id, deleteFlag){
+			var ids;
+			if(id){
+				ids = new Array();
+				ids.push(id);
+			}else{
+				ids = getSelectIds();
+			}
+			
+			var msg = deleteFlag == 1 ? '删除' : '恢复';
+			
+			if(!ids || ids.length == 0){
+				layer.msg('请选择要'+msg+'记录');
+				return;
+			}
+			
+			layer.confirm('确定要' + msg + '记录吗?', function(index){
+				layer.close(index);
+				
+				var loadIdx = layer.load();
+				$.ajax({
+					url : '${ctx}/cms/article/ajax/delete',
+					type : 'post',
+					data : {
+						'ids' : ids,
+						'deleteFlag' : deleteFlag
+					},
+					traditional : true,
+					success : function(result){
+						layer.close(loadIdx);
+						if(result.success){
+							layer.alert('操作成功', function(){
+								window.location.reload();
+							});
+						}else{
+							layer.alert('操作失败');
+						}
+					}
+				});
+			});
+		}
+		
+		function myAduit(id, auditFlag){
+			var ids;
+			if(id){
+				ids = new Array();
+				ids.push(id);
+			}else{
+				ids = getSelectIds();
+			}
+			
+			var msg = auditFlag == 1 ? '审核' : '取消审核';
+			
+			if(!ids || ids.length == 0){
+				layer.alert('请选择要'+msg+'记录');
+				return;
+			}
+			
+			layer.confirm('确定要' + msg + '记录吗?', function(index){
+				layer.close(index);
+				
+				var loadIdx = layer.load();
+				$.ajax({
+					url : '${ctx}/cms/article/ajax/audit',
+					type : 'post',
+					data : {
+						'ids' : ids,
+						'auditFlag' : auditFlag
+					},
+					traditional : true,
+					success : function(result){
+						layer.close(loadIdx);
+						if(result.success){
+							layer.alert('操作成功', function(){
+								window.location.reload();
+							});
+						}else{
+							layer.alert('操作失败');
+						}
+					}
+				});
+			});
+		}
+		
+        function myTop(id, topFlag){
+        	var ids;
+			if(id){
+				ids = new Array();
+				ids.push(id);
+			}else{
+				ids = getSelectIds();
+			}
+			
+			var msg = topFlag == 1 ? '置顶' : '取消置顶';
+			
+			if(!ids || ids.length == 0){
+				layer.alert('请选择要'+msg+'记录');
+				return;
+			}
+			
+			layer.confirm('确定要' + msg + '记录吗?', function(index){
+				layer.close(index);
+				
+				var loadIdx = layer.load();
+				$.ajax({
+					url : '${ctx}/cms/article/ajax/top',
+					type : 'post',
+					data : {
+						'ids' : ids,
+						'topFlag' : topFlag
+					},
+					traditional : true,
+					success : function(result){
+						layer.close(loadIdx);
+						if(result.success){
+							layer.alert('操作成功', function(){
+								window.location.reload();
+							});
+						}else{
+							layer.alert('操作失败');
+						}
+					}
+				});
+			});
+		}
+		
+		function getSelectIds(){
+			var ids = new Array();
+			$('input[name="selecteId"]:checked').each(function(idx, obj){
+				ids.push($(obj).attr('value'));
+			});
+			return ids;
+		}
+		
+		 //全选
+	    function selectAllIds(){
+	  	  var selAll = document.getElementById("selectAll");
+	  	  var selectIdArr = $(":input[name='selecteId']");
+	  	  if(selAll.checked){
+	  		  if(selectIdArr.length > 0){
+	  			  for(var i=0;i<selectIdArr.length;i++){
+	  				  selectIdArr[i].checked = true;
+	  			  }
+	  		  }
+	  	  }else{
+	  		  if(selectIdArr.length > 0){
+	  			  for(var i=0;i<selectIdArr.length;i++){
+	  				  selectIdArr[i].checked = false;
+	  			  }
+	  		  }
+	  	  }
+	    }
+		 
+	    function myQuery(){
+	    	$('#queryForm').submit();
+	    }
+	    
+	    //点击标题预览
+		function view(id){
+			
+		}
+	    
+	    //编辑
+		function myEdit(id){
+	    	var rootColumnId = '${articleQueryDTO.rootColumnId}';
+	    	var columnId = '${articleQueryDTO.columnId}';
+			if(!id){
+				id = '';
+			}
+	    	window.location.href='${ctx}/cms/article/edit?id='+id+'&rootColumnId='+rootColumnId+"&columnId="+columnId;
+		}
+		
+		function doCreateDateSort(){
+			var createDateClass = $('#createDateTd').attr("class");
+			var isCreateDateSort = '';
+			if(createDateClass == 'down'){
+				$('#createDateTd').removeClass('down');
+				$('#createDateTd').addClass('up');
+				isCreateDateSort = "up";
+			}else{
+				$('#createDateTd').removeClass('up');
+				$('#createDateTd').addClass('down');
+				isCreateDateSort = "down";
+			}
+			$("#isCreateDateSort").val(isCreateDateSort);
+		}
+		
+</script>
+	
+
+</body>
+</html>

+ 0 - 0
tianti-modules/tianti-module-admin/src/main/webapp/WEB-INF/views/cms/article_edit.jsp


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