From 8b8ecaf63f03fe636c22ce9e8d8e7acd2a5e8255 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期二, 08 七月 2025 16:41:44 +0800
Subject: [PATCH] 排序改造
---
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java | 2 ++
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java | 7 ++++++-
multi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 35 ++++++++++++++++++++++++++++++++---
3 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java b/multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java
index 5a62f35..9f2fee6 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java
@@ -23,6 +23,8 @@
*/
public List<DeptVo> selectDeptList(SysDept dept);
+ int selectDeptListCount(SysDept dept);
+
/**
*
* @param dept
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java
index 990c07e..6b941f5 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java
@@ -72,7 +72,12 @@
}
}
- return CommonPage.restPage(deptVos);
+ int i = deptMapper.selectDeptListCount(req);
+ CommonPage<DeptVo> deptVoCommonPage = CommonPage.restPage(deptVos);
+ int totalPage = (int) Math.ceil((double) i / deptVoCommonPage.getPageSize());
+ deptVoCommonPage.setTotalPage(totalPage);
+ deptVoCommonPage.setTotal(Long.valueOf( i));
+ return deptVoCommonPage;
}
diff --git a/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 951e1c1..02d875f 100644
--- a/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -80,8 +80,37 @@
<if test="status != null and status != ''">
AND d.status = #{status}
</if>
- order by d.order_num,d.parent_id
+ order by d.order_num
</select>
+
+
+ <select id="selectDeptListCount" parameterType="com.gkhy.exam.common.domain.entity.SysDept" resultType="int">
+ select count(d.dept_id) as total
+ from sys_dept d
+ where d.del_flag = '0'
+ <if test="companyId != null and companyId != 0">
+ AND d.company_id = #{companyId}
+ </if>
+ <if test="deptType != null and deptType != '' " >
+ AND d.dept_type = #{deptType}
+ </if>
+ <if test="responsType != null and responsType != '' " >
+ AND d.respons_type = #{responsType}
+ </if>
+ <if test="deptId != null and deptId != 0">
+ AND d.dept_id = #{deptId}
+ </if>
+ <if test="parentId != null and parentId != 0">
+ AND d.parent_id = #{parentId}
+ </if>
+ <if test="deptName != null and deptName != ''">
+ AND d.dept_name like concat('%', #{deptName}, '%')
+ </if>
+ <if test="status != null and status != ''">
+ AND d.status = #{status}
+ </if>
+ </select>
+
<select id="getOutDeptList" parameterType="com.gkhy.exam.common.domain.entity.SysDept" resultMap="SysDeptResult">
@@ -102,7 +131,7 @@
<if test="status != null and status != ''">
AND status = #{status}
</if>
- order by d.order_num,d.parent_id
+ order by d.order_num
</select>
@@ -114,7 +143,7 @@
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
- order by d.parent_id, d.order_num
+ order by d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
--
Gitblit v1.9.2