From 8ca56adfa02c0fecf0bd608579b8119f8efdea6f Mon Sep 17 00:00:00 2001 From: 15037635792 Date: Fri, 17 Dec 2021 19:49:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=8F=E6=96=B0=E9=B9=8F=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ssh_1904_suxinp/pom.xml | 67 ++++++ .../src/main/java/SuXinPeng/entity/Page.java | 112 ++++++++++ .../main/java/SuXinPeng/entity/PageUtils.java | 85 ++++++++ .../SuXinPeng/entity/SuXinPengEntity.java | 49 +++++ .../src/main/resource/applicationcontext.xml | 76 +++++++ .../main/resource/conf/hrb/SuXinPeng.hbm.xml | 15 ++ .../resource/conf/struts/suxinpengstrust.xml | 23 +++ .../src/main/resource/database.properties | 11 + ssh_1904_suxinp/src/main/resource/struts.xml | 8 + .../webapp/WEB-INF/suxinp/dept_index.html | 150 ++++++++++++++ .../webapp/WEB-INF/suxinp/user_create.html | 191 ++++++++++++++++++ .../webapp/WEB-INF/suxinp/user_index.html | 176 ++++++++++++++++ 12 files changed, 963 insertions(+) create mode 100644 ssh_1904_suxinp/pom.xml create mode 100644 ssh_1904_suxinp/src/main/java/SuXinPeng/entity/Page.java create mode 100644 ssh_1904_suxinp/src/main/java/SuXinPeng/entity/PageUtils.java create mode 100644 ssh_1904_suxinp/src/main/java/SuXinPeng/entity/SuXinPengEntity.java create mode 100644 ssh_1904_suxinp/src/main/resource/applicationcontext.xml create mode 100644 ssh_1904_suxinp/src/main/resource/conf/hrb/SuXinPeng.hbm.xml create mode 100644 ssh_1904_suxinp/src/main/resource/conf/struts/suxinpengstrust.xml create mode 100644 ssh_1904_suxinp/src/main/resource/database.properties create mode 100644 ssh_1904_suxinp/src/main/resource/struts.xml create mode 100644 ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/dept_index.html create mode 100644 ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_create.html create mode 100644 ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_index.html diff --git a/ssh_1904_suxinp/pom.xml b/ssh_1904_suxinp/pom.xml new file mode 100644 index 00000000..3e6d8b03 --- /dev/null +++ b/ssh_1904_suxinp/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + org.example + ssh_1904_suxinp + 1.0-SNAPSHOT + war + + ssh_1904_suxinp Maven Webapp + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + + + + + junit + junit + 4.11 + test + + + + + ssh_1904_suxinp + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-war-plugin + 3.2.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + + diff --git a/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/Page.java b/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/Page.java new file mode 100644 index 00000000..95d35093 --- /dev/null +++ b/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/Page.java @@ -0,0 +1,112 @@ +package SuXinPeng.entity; + +import java.util.List; + +public class Page { + // 1. 每页显示的数量 + private int everyPage; + + // 2. 总条目数 + private int totalCount; + + // 3. 总页数 + private int totalPage; + + // 4. 当前页数 + private int currentPage; + + // 5. 起始条 + private int beginIndex; + + // 6. 是否有上一页 + private boolean hasPrePage; + + // 7. 是否还有下一页 + private boolean hasNextPage; + + private List data; + + + + + + + public Page() { + } + + public Page(int everyPage, int totalCount, int totalPage, int currentPage, int beginIndex, boolean hasPrePage, + boolean hasNextPage) { + super(); + this.everyPage = everyPage; + this.totalCount = totalCount; + this.totalPage = totalPage; + this.currentPage = currentPage; + this.beginIndex = beginIndex; + this.hasPrePage = hasPrePage; + this.hasNextPage = hasNextPage; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public int getEveryPage() { + return everyPage; + } + + public void setEveryPage(int everyPage) { + this.everyPage = everyPage; + } + + public int getTotalCount() { + return totalCount; + } + + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + + 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 int getBeginIndex() { + return beginIndex; + } + + public void setBeginIndex(int beginIndex) { + this.beginIndex = beginIndex; + } + + public boolean isHasPrePage() { + return hasPrePage; + } + + public void setHasPrePage(boolean hasPrePage) { + this.hasPrePage = hasPrePage; + } + + public boolean isHasNextPage() { + return hasNextPage; + } + + public void setHasNextPage(boolean hasNextPage) { + this.hasNextPage = hasNextPage; + } +} diff --git a/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/PageUtils.java b/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/PageUtils.java new file mode 100644 index 00000000..b6e953fa --- /dev/null +++ b/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/PageUtils.java @@ -0,0 +1,85 @@ +package SuXinPeng.entity; + +public class PageUtils { + public static Page getPage(int everyPage, int totalCount, int currentPage) { + Page page = null; + //每页显示两条 + + + + //总页数 2 2 4 + //总页数 6 3 17 + int totalPage = getTotalPage(everyPage, totalCount); + + currentPage = getCurrentPage(currentPage,totalPage); + //起始条 5 2 3 + //起始条 11 5 3 + //起始条 11 3 7 + int beginIndex = getBeginIndex(everyPage, currentPage); + + + boolean hasPrePage = hasPrePage(currentPage); + boolean hasNextPage = hasNextPage(totalPage, currentPage); + return page = new Page(everyPage, totalCount, totalPage, currentPage, beginIndex, hasPrePage, hasNextPage); + } + + + + /** + * 设定当前页 + * + * @param currentPage + * @return + */ + public static int getCurrentPage(int currentPage,int totalPage) { + if(currentPage == 0) { + currentPage = 1; + }else if(currentPage > totalPage ){ + currentPage =totalPage; + } + return currentPage; + } + + /** + * 设定分页的总页数 + * + * @param everyPage + * @param totalCount + * @return + */ + public static int getTotalPage(int everyPage, int totalCount) { + int num = totalCount / everyPage; + return totalCount % everyPage == 0 ? num : num + 1; + } + + /** + * 设置起始点 + * + * @param everyPage + * @param currentPage + * @return + */ + public static int getBeginIndex(int everyPage, int currentPage) { + return (currentPage - 1) * everyPage; + } + + /** + * 设置是否有上一页 + * + * @param currentPage + * @return + */ + public static boolean hasPrePage(int currentPage) { + return currentPage == 1 ? false : true; + } + + /** + * 设置是否有下一页 + * + * @param currentPage + * @return + */ + public static boolean hasNextPage(int totalPage, int currentPage) { + return currentPage == totalPage || totalPage == 0 ? false : true; + } +} diff --git a/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/SuXinPengEntity.java b/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/SuXinPengEntity.java new file mode 100644 index 00000000..9a97d8ed --- /dev/null +++ b/ssh_1904_suxinp/src/main/java/SuXinPeng/entity/SuXinPengEntity.java @@ -0,0 +1,49 @@ +package SuXinPeng.entity; + +public class SuXinPengEntity { + + private Integer id; + private String name; + private Integer bid; + private String url; + private String bname; + public Integer getId() { + return id; + } + + public Integer getBid() { + return bid; + } + + public void setBid(Integer bid) { + this.bid = bid; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getBname() { + return bname; + } + + public void setBname(String bname) { + this.bname = bname; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/ssh_1904_suxinp/src/main/resource/applicationcontext.xml b/ssh_1904_suxinp/src/main/resource/applicationcontext.xml new file mode 100644 index 00000000..337ee9ff --- /dev/null +++ b/ssh_1904_suxinp/src/main/resource/applicationcontext.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + classpath:conf/hrb/ + + + + + org.hibernate.dialect.MySQL5InnoDBDialect + true + update + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ssh_1904_suxinp/src/main/resource/conf/hrb/SuXinPeng.hbm.xml b/ssh_1904_suxinp/src/main/resource/conf/hrb/SuXinPeng.hbm.xml new file mode 100644 index 00000000..7089bab8 --- /dev/null +++ b/ssh_1904_suxinp/src/main/resource/conf/hrb/SuXinPeng.hbm.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ssh_1904_suxinp/src/main/resource/conf/struts/suxinpengstrust.xml b/ssh_1904_suxinp/src/main/resource/conf/struts/suxinpengstrust.xml new file mode 100644 index 00000000..6ffd87d0 --- /dev/null +++ b/ssh_1904_suxinp/src/main/resource/conf/struts/suxinpengstrust.xml @@ -0,0 +1,23 @@ + + + + + + + + page + + + flag + + + SuXinPengEntity + + + queryPage,save,edit + + + + \ No newline at end of file diff --git a/ssh_1904_suxinp/src/main/resource/database.properties b/ssh_1904_suxinp/src/main/resource/database.properties new file mode 100644 index 00000000..698f6049 --- /dev/null +++ b/ssh_1904_suxinp/src/main/resource/database.properties @@ -0,0 +1,11 @@ +driver=com.mysql.jdbc.Driver +url=jdbc:mysql://localhost:3306/java3456?useUnicode=true&characterEncoding=utf-8 +user=root +password=123456 +minIdle=45 +maxIdle=50 +initialSize=5 +maxActive=100 +maxWait=100 +removeAbandonedTimeout=180 +removeAbandoned=true diff --git a/ssh_1904_suxinp/src/main/resource/struts.xml b/ssh_1904_suxinp/src/main/resource/struts.xml new file mode 100644 index 00000000..c5c8a11b --- /dev/null +++ b/ssh_1904_suxinp/src/main/resource/struts.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/dept_index.html b/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/dept_index.html new file mode 100644 index 00000000..bad9b701 --- /dev/null +++ b/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/dept_index.html @@ -0,0 +1,150 @@ + + + + + + + + 学生管理 + + + + + + + + + + + + + +
+ + + +
+
+ 网站首页 + + + +
+ +
+ + +
+
+ + +
+ + + + + + + + + + + + + + + + +
部门操作
+
+ + +
+
+ + + +
+ +
+
+ + + + diff --git a/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_create.html b/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_create.html new file mode 100644 index 00000000..8a43f39e --- /dev/null +++ b/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_create.html @@ -0,0 +1,191 @@ + + + + + + + + 添加用户 - BsAdmin后台模板 - 经典版演示 + + + + + + + + + + + + + +
+ + + +
+
+ 网站首页 + + + +
+ +
+ + +
+
+ +
+
新增用户
+
+
+
+
+
+ +
+ + + +
+
+ + + +
+ +
+ + + + + +
+ + + +
+
+
+ +
+ + +
+ + +
+
+
+ + + +
+ +
+
+ + + + diff --git a/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_index.html b/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_index.html new file mode 100644 index 00000000..be8b2fdc --- /dev/null +++ b/ssh_1904_suxinp/src/main/webapp/WEB-INF/suxinp/user_index.html @@ -0,0 +1,176 @@ + + + + + + + + 学生管理 + + + + + + + + + + + + + +
+ + + +
+
+ 网站首页 + + + +
+ +
+ + +
+
+ + +
+ + + + + + + + + + + + + + + + + +
姓名班级url操作
+
+
+ 共23223条 + 共23223页 + + + + +
+ +
+
+ + + +
+ +
+
+ + + + -- Gitee