From 78c3c58e95590e8ff00d9240051fbb9536be485b Mon Sep 17 00:00:00 2001
From: qirong <2032486488@qq.com>
Date: 星期三, 07 六月 2023 13:59:35 +0800
Subject: [PATCH] page

---
 src/main/resources/mapper/DepartmentMapper.xml                                      |   20 ++++++
 src/main/java/com/mindskip/xzs/service/DepartmentService.java                       |    4 +
 src/main/java/com/mindskip/xzs/service/impl/DepartmentServiceImpl.java              |   10 ++
 log/xzs.20230607.log                                                                |   68 ++++++++++++++++++++++
 src/main/java/com/mindskip/xzs/repository/DepartmentMapper.java                     |    3 +
 src/main/java/com/mindskip/xzs/viewmodel/admin/department/DepartmentResponseVM.java |   46 +++++++++++++++
 6 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/log/xzs.20230607.log b/log/xzs.20230607.log
index 6ecdd50..05110b8 100644
--- a/log/xzs.20230607.log
+++ b/log/xzs.20230607.log
@@ -398,3 +398,71 @@
 2023-06-07 11:06:20.385  INFO 5104 --- [restartedMain] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
 2023-06-07 11:06:20.495  INFO 5104 --- [restartedMain] o.s.b.w.e.u.UndertowServletWebServer     : Undertow started on port(s) 8000 (http) with context path ''
 2023-06-07 11:06:20.500  INFO 5104 --- [restartedMain] com.mindskip.xzs.XzsApplication          : Started XzsApplication in 5.716 seconds (JVM running for 7.176)
+2023-06-07 13:40:46.035  INFO 26704 --- [restartedMain] com.mindskip.xzs.XzsApplication          : Starting XzsApplication on DESKTOP-7A2KHS1 with PID 26704 (E:\ycll\qyksxt\target\classes started by qirong in E:\ycll\qyksxt)
+2023-06-07 13:40:46.038  INFO 26704 --- [restartedMain] com.mindskip.xzs.XzsApplication          : The following profiles are active: dev
+2023-06-07 13:40:46.093  INFO 26704 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
+2023-06-07 13:40:46.094  INFO 26704 --- [restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
+2023-06-07 13:40:48.317  INFO 26704 --- [restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9e2c5a86] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
+2023-06-07 13:40:48.559  WARN 26704 --- [restartedMain] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
+2023-06-07 13:40:48.589  INFO 26704 --- [restartedMain] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext
+2023-06-07 13:40:48.589  INFO 26704 --- [restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2495 ms
+2023-06-07 13:40:49.880  INFO 26704 --- [restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
+2023-06-07 13:40:50.041  INFO 26704 --- [restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@617b6561, org.springframework.security.web.context.SecurityContextPersistenceFilter@ed44c66, org.springframework.security.web.header.HeaderWriterFilter@47c8f461, org.springframework.web.filter.CorsFilter@3cac1358, org.springframework.security.web.authentication.logout.LogoutFilter@3804ca76, com.mindskip.xzs.configuration.spring.security.RestLoginAuthenticationFilter@26fb8869, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@45c16bb2, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5ae15e3d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@373f9fdb, org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter@76fb376e, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7cadfa8c, org.springframework.security.web.session.SessionManagementFilter@25d837a8, org.springframework.security.web.access.ExceptionTranslationFilter@468e7ee4, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@250562ad]
+2023-06-07 13:40:50.059  INFO 26704 --- [restartedMain] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
+2023-06-07 13:40:50.350  INFO 26704 --- [restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
+2023-06-07 13:40:50.369  INFO 26704 --- [restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
+2023-06-07 13:40:50.405  INFO 26704 --- [restartedMain] s.d.s.w.s.ApiListingReferenceScanner     : Scanning for api listing references
+2023-06-07 13:40:50.557  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: indexUsingPOST_1
+2023-06-07 13:40:50.559  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: taskUsingPOST_1
+2023-06-07 13:40:50.591  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: listUsingPOST_1
+2023-06-07 13:40:50.607  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_1
+2023-06-07 13:40:50.658  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_1
+2023-06-07 13:40:50.690  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: answerSubmitUsingPOST_1
+2023-06-07 13:40:50.694  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: editUsingPOST_1
+2023-06-07 13:40:50.697  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_2
+2023-06-07 13:40:50.700  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: readUsingPOST_1
+2023-06-07 13:40:50.714  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_3
+2023-06-07 13:40:50.721  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_2
+2023-06-07 13:40:50.725  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_4
+2023-06-07 13:40:50.728  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_3
+2023-06-07 13:40:50.731  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingPOST_1
+2023-06-07 13:40:50.739  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: editUsingPOST_2
+2023-06-07 13:40:50.747  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_5
+2023-06-07 13:40:50.749  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_4
+2023-06-07 13:40:50.759  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_6
+2023-06-07 13:40:50.770  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_7
+2023-06-07 13:40:50.774  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_5
+2023-06-07 13:40:50.778  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingPOST_2
+2023-06-07 13:40:50.780  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: editUsingPOST_3
+2023-06-07 13:40:50.808  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_8
+2023-06-07 13:40:50.811  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_6
+2023-06-07 13:40:50.813  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingPOST_3
+2023-06-07 13:40:50.817  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: editUsingPOST_4
+2023-06-07 13:40:50.825  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_9
+2023-06-07 13:40:50.828  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_7
+2023-06-07 13:40:50.839  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingGET_1
+2023-06-07 13:40:50.840  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingHEAD_1
+2023-06-07 13:40:50.841  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingPOST_1
+2023-06-07 13:40:50.841  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingPUT_1
+2023-06-07 13:40:50.842  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingPATCH_1
+2023-06-07 13:40:50.843  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingDELETE_1
+2023-06-07 13:40:50.843  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingOPTIONS_1
+2023-06-07 13:40:50.844  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: questionUploadAndReadExcelUsingTRACE_1
+2023-06-07 13:40:50.878  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: readUsingPOST_2
+2023-06-07 13:40:50.889  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: currentUsingPOST_1
+2023-06-07 13:40:50.890  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingPOST_4
+2023-06-07 13:40:50.897  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: editUsingPOST_5
+2023-06-07 13:40:50.907  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: pageListUsingPOST_10
+2023-06-07 13:40:50.908  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: selectUsingPOST_8
+2023-06-07 13:40:50.912  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: updateUsingPOST_1
+2023-06-07 13:40:50.913  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: currentUsingPOST_2
+2023-06-07 13:40:50.914  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: logUsingPOST_1
+2023-06-07 13:40:50.918  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: messagePageListUsingPOST_1
+2023-06-07 13:40:50.919  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: readUsingPOST_3
+2023-06-07 13:40:50.922  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: registerUsingPOST_1
+2023-06-07 13:40:50.923  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: unReadCountUsingPOST_1
+2023-06-07 13:40:50.926  INFO 26704 --- [restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: updateUsingPOST_2
+2023-06-07 13:40:50.985  INFO 26704 --- [restartedMain] org.xnio                                 : XNIO version 3.3.8.Final
+2023-06-07 13:40:50.997  INFO 26704 --- [restartedMain] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
+2023-06-07 13:40:51.073  INFO 26704 --- [restartedMain] o.s.b.w.e.u.UndertowServletWebServer     : Undertow started on port(s) 8000 (http) with context path ''
+2023-06-07 13:40:51.077  INFO 26704 --- [restartedMain] com.mindskip.xzs.XzsApplication          : Started XzsApplication in 5.782 seconds (JVM running for 6.861)
diff --git a/src/main/java/com/mindskip/xzs/repository/DepartmentMapper.java b/src/main/java/com/mindskip/xzs/repository/DepartmentMapper.java
index a3efae5..5c96cab 100644
--- a/src/main/java/com/mindskip/xzs/repository/DepartmentMapper.java
+++ b/src/main/java/com/mindskip/xzs/repository/DepartmentMapper.java
@@ -1,6 +1,7 @@
 package com.mindskip.xzs.repository;
 
 import com.mindskip.xzs.domain.Department;
+import com.mindskip.xzs.viewmodel.admin.department.DepartmentResponseVM;
 import org.apache.ibatis.annotations.Mapper;
 import org.w3c.dom.stylesheets.LinkStyle;
 
@@ -14,4 +15,6 @@
     Integer update(Department department);
 
     List<Department> gets();
+
+    List<Department> page(DepartmentResponseVM departmentResponseVM);
 }
diff --git a/src/main/java/com/mindskip/xzs/service/DepartmentService.java b/src/main/java/com/mindskip/xzs/service/DepartmentService.java
index bafec01..50147be 100644
--- a/src/main/java/com/mindskip/xzs/service/DepartmentService.java
+++ b/src/main/java/com/mindskip/xzs/service/DepartmentService.java
@@ -1,7 +1,9 @@
 package com.mindskip.xzs.service;
 
+import com.github.pagehelper.PageInfo;
 import com.mindskip.xzs.domain.Department;
 import com.mindskip.xzs.domain.Question;
+import com.mindskip.xzs.viewmodel.admin.department.DepartmentResponseVM;
 
 import java.util.List;
 
@@ -32,5 +34,5 @@
      * 鏌ヨ鎵�鏈夐儴闂�
      * @return
      */
-    List<Department> gets();
+    PageInfo<Department> gets(DepartmentResponseVM departmentResponseVM);
 }
diff --git a/src/main/java/com/mindskip/xzs/service/impl/DepartmentServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/DepartmentServiceImpl.java
index 4425999..4d5e50a 100644
--- a/src/main/java/com/mindskip/xzs/service/impl/DepartmentServiceImpl.java
+++ b/src/main/java/com/mindskip/xzs/service/impl/DepartmentServiceImpl.java
@@ -1,10 +1,14 @@
 package com.mindskip.xzs.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.mindskip.xzs.domain.Department;
 import com.mindskip.xzs.repository.BaseMapper;
 import com.mindskip.xzs.repository.DepartmentMapper;
 import com.mindskip.xzs.service.DepartmentService;
 import com.mindskip.xzs.utility.ModelMapperSingle;
+import com.mindskip.xzs.viewmodel.admin.department.DepartmentResponseVM;
+import com.sun.webkit.PageCache;
 import org.modelmapper.ModelMapper;
 import org.springframework.stereotype.Service;
 
@@ -43,7 +47,9 @@
     }
 
     @Override
-    public List<Department> gets() {
-        return departmentMapper.gets();
+    public PageInfo<Department> gets(DepartmentResponseVM departmentResponseVM) {
+        return PageHelper.startPage(departmentResponseVM.getPageIndex(), departmentResponseVM.getPageSize(), "id desc").doSelectPageInfo(() ->
+                departmentMapper.page(departmentResponseVM)
+        );
     }
 }
diff --git a/src/main/java/com/mindskip/xzs/viewmodel/admin/department/DepartmentResponseVM.java b/src/main/java/com/mindskip/xzs/viewmodel/admin/department/DepartmentResponseVM.java
new file mode 100644
index 0000000..33dd791
--- /dev/null
+++ b/src/main/java/com/mindskip/xzs/viewmodel/admin/department/DepartmentResponseVM.java
@@ -0,0 +1,46 @@
+package com.mindskip.xzs.viewmodel.admin.department;
+
+import com.mindskip.xzs.base.BasePage;
+
+public class DepartmentResponseVM extends BasePage {
+
+
+    private Integer id;
+
+    private String name;
+
+    private String deleted;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(String deleted) {
+        this.deleted = deleted;
+    }
+
+    @Override
+    public String toString() {
+        return "Department{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", deleted='" + deleted + '\'' +
+                '}';
+    }
+}
diff --git a/src/main/resources/mapper/DepartmentMapper.xml b/src/main/resources/mapper/DepartmentMapper.xml
index 4df30ab..43083d2 100644
--- a/src/main/resources/mapper/DepartmentMapper.xml
+++ b/src/main/resources/mapper/DepartmentMapper.xml
@@ -7,6 +7,10 @@
         <result column="deleted" jdbcType="VARCHAR" property="deleted"/>
     </resultMap>
 
+    <sql id="Base_Column_List">
+        id, name,deleted
+    </sql>
+
     <insert id="add" parameterType="com.mindskip.xzs.domain.Department" useGeneratedKeys="true" keyProperty="id">
         insert into t_department (name, deleted)
         values (#{name,jdbcType=VARCHAR}, #{deleted,jdbcType=VARCHAR})
@@ -30,4 +34,20 @@
         <include refid="Base_Column_List"/>
         from t_department where deleted=0
     </select>
+
+    <select id="page" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.department.DepartmentResponseVM">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_department
+        <where>
+            and deleted=0
+            <if test="id != null ">
+                and id= #{id}
+            </if>
+            <if test="name != null ">
+                and name like concat('%',#{name},'%')
+            </if>
+
+        </where>
+    </select>
 </mapper>

--
Gitblit v1.8.0