From bc6ac2f55b2ddec81614ebf7722760b4868f76db Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期四, 24 八月 2023 16:11:27 +0800
Subject: [PATCH] 修改派警list返回用户信息
---
ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java | 15 +++++--
ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml | 59 +++++++++++++++--------------
ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java | 13 ++----
ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java | 11 +++--
4 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java b/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java
index f6cdfce..b338450 100644
--- a/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java
@@ -2,6 +2,7 @@
import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -46,7 +47,7 @@
private String userId;
/** 娲捐鍏宠仈鐢ㄦ埛淇℃伅 */
- private List<String> ardDispatchPoliceUserList;
+ private List<SysUser> sysUserList;
public void setId(String id)
{
@@ -103,12 +104,12 @@
return userId;
}
- public List<String> getArdDispatchPoliceUserList() {
- return ardDispatchPoliceUserList;
+ public List<SysUser> getSysUserList() {
+ return sysUserList;
}
- public void setArdDispatchPoliceUserList(List<String> ardDispatchPoliceUserList) {
- this.ardDispatchPoliceUserList = ardDispatchPoliceUserList;
+ public void setSysUserList(List<SysUser> sysUserList) {
+ this.sysUserList = sysUserList;
}
public String getText() {
diff --git a/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java b/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java
index 71c5a87..041e61e 100644
--- a/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java
@@ -11,7 +11,7 @@
* @author ard
* @date 2023-08-21
*/
-public class ArdDispatchPoliceUser extends BaseEntity
+public class ArdDispatchPoliceUser
{
private static final long serialVersionUID = 1L;
@@ -22,6 +22,8 @@
/** 鍏宠仈鐢ㄦ埛ID */
@Excel(name = "鍏宠仈鐢ㄦ埛ID")
private String userId;
+
+
public void setDispatchId(String dispatchId)
{
@@ -42,11 +44,6 @@
return userId;
}
- @Override
- public String toString() {
- return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
- .append("dispatchId", getDispatchId())
- .append("userId", getUserId())
- .toString();
- }
+
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java b/ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java
index 92a99ff..b6df112 100644
--- a/ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java
@@ -2,6 +2,7 @@
import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
@@ -119,15 +120,21 @@
*
* @param ardDispatchPolice 娲捐绠$悊瀵硅薄
*/
+ /**
+ * 鏂板娲捐鍏宠仈鐢ㄦ埛淇℃伅
+ *
+ * @param ardDispatchPolice 娲捐绠$悊瀵硅薄
+ */
public void insertArdDispatchPoliceUser(ArdDispatchPolice ardDispatchPolice) {
- List<String> ardDispatchPoliceUserList = ardDispatchPolice.getArdDispatchPoliceUserList();
+ List<SysUser> sysUserList = ardDispatchPolice.getSysUserList();
String id = ardDispatchPolice.getId();
- if (StringUtils.isNotNull(ardDispatchPoliceUserList)) {
+ if (StringUtils.isNotNull(sysUserList)) {
List<ArdDispatchPoliceUser> list = new ArrayList<ArdDispatchPoliceUser>();
- for (String userId : ardDispatchPoliceUserList) {
+ for (SysUser user :sysUserList)
+ {
ArdDispatchPoliceUser ardDispatchPoliceUser=new ArdDispatchPoliceUser();
- ardDispatchPoliceUser.setUserId(userId);
ardDispatchPoliceUser.setDispatchId(id);
+ ardDispatchPoliceUser.setUserId(user.getUserId());
list.add(ardDispatchPoliceUser);
}
if (list.size() > 0) {
diff --git a/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml b/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml
index 6b0882c..90d8a53 100644
--- a/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml
+++ b/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml
@@ -16,39 +16,39 @@
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
- <!-- 瀛愭煡璇紝鍏宠仈 ard_dispatch_police_user 琛� -->
- <collection property="ardDispatchPoliceUserList" ofType="java.lang.String" select="getUserIdsByMainTableId"
- column="id"/>
- </resultMap>
- <select id="getUserIdsByMainTableId" resultType="java.lang.String">
- SELECT user_id
- FROM ard_dispatch_police_user
- WHERE dispatch_id = #{id}
- </select>
- <resultMap id="ArdDispatchPoliceArdDispatchPoliceUserResult" type="ArdDispatchPolice"
- extends="ArdDispatchPoliceResult">
- <collection property="ardDispatchPoliceUserList" notNullColumn="sub_dispatch_id" javaType="java.util.List"
- resultMap="ArdDispatchPoliceUserResult"/>
+ <collection property="sysUserList" javaType="java.util.List" resultMap="SysUserListResult"/>
</resultMap>
- <resultMap type="ArdDispatchPoliceUser" id="ArdDispatchPoliceUserResult">
- <result property="dispatchId" column="sub_dispatch_id"/>
+ <resultMap id="ArdDispatchPoliceArdDispatchPoliceUserResult" type="ArdDispatchPolice"
+ extends="ArdDispatchPoliceResult">
+ <collection property="sysUserList" notNullColumn="sub_dispatch_id" javaType="java.util.List"
+ resultMap="SysUserListResult"/>
+ </resultMap>
+
+ <resultMap type="SysUser" id="SysUserListResult">
<result property="userId" column="sub_user_id"/>
+ <result property="nickName" column="sub_nick_name"/>
+ <result property="deptId" column="sub_dept_id"/>
</resultMap>
<sql id="selectArdDispatchPoliceVo">
- SELECT ID,
- NAME,
- text,
- longitude,
- latitude,
- dept_id,
- user_id,
- create_by,
- create_time,
- update_by,
- update_time
- FROM ard_dispatch_police
+ SELECT adp.ID,
+ adp.NAME,
+ adp.text,
+ adp.longitude,
+ adp.latitude,
+ adp.dept_id,
+ adp.user_id,
+ adp.create_by,
+ adp.create_time,
+ adp.update_by,
+ adp.update_time,
+ u.user_id as sub_user_id,
+ u.nick_name as sub_nick_name,
+ u.dept_id as sub_dept_id
+ FROM ard_dispatch_police adp
+ left join ard_dispatch_police_user b on b.dispatch_id = adp.id
+ left join sys_user u on b.user_id = u.user_id
</sql>
<select id="selectArdDispatchPoliceList" parameterType="ArdDispatchPolice" resultMap="ArdDispatchPoliceResult">
@@ -75,8 +75,9 @@
a.create_time,
a.update_by,
a.update_time,
- b.dispatch_id as sub_dispatch_id,
- b.user_id as sub_user_id
+ b.user_id as sub_user_id,
+ b.nick_name as sub_nick_name,
+ b.dept_id as sub_dept_id
from ard_dispatch_police a
left join ard_dispatch_police_user b on b.dispatch_id = a.id
where a.id = #{id}
--
Gitblit v1.9.3