From f32c25a67a7f3ce0bde1f266b9f8abd6379b7378 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期一, 21 八月 2023 16:06:56 +0800
Subject: [PATCH] 增加派警管理业务 获取部门和相机接口增加通道list
---
ard-work/src/main/java/com/ruoyi/dispatch/mapper/ArdDispatchPoliceMapper.java | 87 ++++++
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml | 1
ard-work/src/main/java/com/ruoyi/dispatch/controller/ArdDispatchPoliceController.java | 111 ++++++++
ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java | 138 ++++++++++
ard-work/src/main/java/com/ruoyi/dispatch/service/IArdDispatchPoliceService.java | 61 ++++
ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml | 159 ++++++++++++
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 10
ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java | 52 ++++
ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java | 109 ++++++++
9 files changed, 726 insertions(+), 2 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
index 88b4637..eeac1a7 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -47,8 +47,7 @@
private SysDeptMapper sysDeptMapper;
@Resource
private RedisCache redisCache;
- @Resource
- private IHikClientService hikClientService;
+
@Resource
private ArdChannelMapper ardChannelMapper;
@@ -235,6 +234,13 @@
}
if (ardCameras.size() > 0) {
for (ArdCameras camera : ardCameras) {
+ ArdChannel ardChannel=new ArdChannel();
+ ardChannel.setDeviceId(camera.getId());
+ List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
+ if(ardChannels!=null)
+ {
+ camera.setChannelList(ardChannels);
+ }
Map<String, Object> cameraMap = ArdTool.convertEntityToMap(camera);
childList.add(cameraMap);
}
diff --git a/ard-work/src/main/java/com/ruoyi/dispatch/controller/ArdDispatchPoliceController.java b/ard-work/src/main/java/com/ruoyi/dispatch/controller/ArdDispatchPoliceController.java
new file mode 100644
index 0000000..6ed83ed
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/controller/ArdDispatchPoliceController.java
@@ -0,0 +1,111 @@
+package com.ruoyi.dispatch.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.dispatch.domain.ArdDispatchPolice;
+import com.ruoyi.dispatch.service.IArdDispatchPoliceService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 娲捐绠$悊Controller
+ *
+ * @author ard
+ * @date 2023-08-21
+ */
+@Api(tags = "娲捐绠$悊")
+@RestController
+@RequestMapping("/dispatch/police")
+public class ArdDispatchPoliceController extends BaseController
+{
+ @Autowired
+ private IArdDispatchPoliceService ardDispatchPoliceService;
+
+ /**
+ * 鏌ヨ娲捐绠$悊鍒楄〃
+ */
+ @ApiOperation("鏌ヨ娲捐绠$悊鍒楄〃")
+ @PreAuthorize("@ss.hasPermi('dispatch:police:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdDispatchPolice ardDispatchPolice)
+ {
+ startPage();
+ List<ArdDispatchPolice> list = ardDispatchPoliceService.selectArdDispatchPoliceList(ardDispatchPolice);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭娲捐绠$悊鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('dispatch:police:export')")
+ @Log(title = "娲捐绠$悊", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdDispatchPolice ardDispatchPolice)
+ {
+ List<ArdDispatchPolice> list = ardDispatchPoliceService.selectArdDispatchPoliceList(ardDispatchPolice);
+ ExcelUtil<ArdDispatchPolice> util = new ExcelUtil<ArdDispatchPolice>(ArdDispatchPolice.class);
+ util.exportExcel(response, list, "娲捐绠$悊鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇娲捐绠$悊璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('dispatch:police:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardDispatchPoliceService.selectArdDispatchPoliceById(id));
+ }
+
+ /**
+ * 鏂板娲捐绠$悊
+ */
+ @ApiOperation("鏂板娲捐绠$悊")
+ @PreAuthorize("@ss.hasPermi('dispatch:police:add')")
+ @Log(title = "娲捐绠$悊", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdDispatchPolice ardDispatchPolice)
+ {
+ return toAjax(ardDispatchPoliceService.insertArdDispatchPolice(ardDispatchPolice));
+ }
+
+ /**
+ * 淇敼娲捐绠$悊
+ */
+ @PreAuthorize("@ss.hasPermi('dispatch:police:edit')")
+ @Log(title = "娲捐绠$悊", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdDispatchPolice ardDispatchPolice)
+ {
+ return toAjax(ardDispatchPoliceService.updateArdDispatchPolice(ardDispatchPolice));
+ }
+
+ /**
+ * 鍒犻櫎娲捐绠$悊
+ */
+ @ApiOperation("鍒犻櫎娲捐绠$悊")
+ @PreAuthorize("@ss.hasPermi('dispatch:police:remove')")
+ @Log(title = "娲捐绠$悊", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardDispatchPoliceService.deleteArdDispatchPoliceByIds(ids));
+ }
+}
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
new file mode 100644
index 0000000..64d3dab
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPolice.java
@@ -0,0 +1,109 @@
+package com.ruoyi.dispatch.domain;
+
+import java.util.List;
+
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 娲捐绠$悊瀵硅薄 ard_dispatch_police
+ *
+ * @author ard
+ * @date 2023-08-21
+ */
+public class ArdDispatchPolice extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** ID */
+ private String id;
+
+ /** 娲捐鍚嶇О */
+ @Excel(name = "娲捐鍚嶇О")
+ private String name;
+
+ /** 缁忓害 */
+ @Excel(name = "缁忓害")
+ private Double longitude;
+
+ /** 绾害 */
+ @Excel(name = "绾害")
+ private Double latitude;
+
+ /** 閮ㄩ棬ID */
+ @Excel(name = "閮ㄩ棬ID")
+ private Integer deptId;
+
+ /** 鐢ㄦ埛ID */
+ @Excel(name = "鐢ㄦ埛ID")
+ private String userId;
+
+ /** 娲捐鍏宠仈鐢ㄦ埛淇℃伅 */
+ private List<String> ardDispatchPoliceUserList;
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ public void setLongitude(Double longitude)
+ {
+ this.longitude = longitude;
+ }
+
+ public Double getLongitude()
+ {
+ return longitude;
+ }
+ public void setLatitude(Double latitude)
+ {
+ this.latitude = latitude;
+ }
+
+ public Double getLatitude()
+ {
+ return latitude;
+ }
+ public void setDeptId(Integer deptId)
+ {
+ this.deptId = deptId;
+ }
+
+ public Integer getDeptId()
+ {
+ return deptId;
+ }
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ public List<String> getArdDispatchPoliceUserList() {
+ return ardDispatchPoliceUserList;
+ }
+
+ public void setArdDispatchPoliceUserList(List<String> ardDispatchPoliceUserList) {
+ this.ardDispatchPoliceUserList = ardDispatchPoliceUserList;
+ }
+}
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
new file mode 100644
index 0000000..71c5a87
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/domain/ArdDispatchPoliceUser.java
@@ -0,0 +1,52 @@
+package com.ruoyi.dispatch.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 娲捐鍏宠仈鐢ㄦ埛瀵硅薄 ard_dispatch_police_user
+ *
+ * @author ard
+ * @date 2023-08-21
+ */
+public class ArdDispatchPoliceUser extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 娲捐ID */
+ @Excel(name = "娲捐ID")
+ private String dispatchId;
+
+ /** 鍏宠仈鐢ㄦ埛ID */
+ @Excel(name = "鍏宠仈鐢ㄦ埛ID")
+ private String userId;
+
+ public void setDispatchId(String dispatchId)
+ {
+ this.dispatchId = dispatchId;
+ }
+
+ public String getDispatchId()
+ {
+ return dispatchId;
+ }
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ 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/mapper/ArdDispatchPoliceMapper.java b/ard-work/src/main/java/com/ruoyi/dispatch/mapper/ArdDispatchPoliceMapper.java
new file mode 100644
index 0000000..443bcd8
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/mapper/ArdDispatchPoliceMapper.java
@@ -0,0 +1,87 @@
+package com.ruoyi.dispatch.mapper;
+
+import java.util.List;
+import com.ruoyi.dispatch.domain.ArdDispatchPolice;
+import com.ruoyi.dispatch.domain.ArdDispatchPoliceUser;
+
+/**
+ * 娲捐绠$悊Mapper鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-08-21
+ */
+public interface ArdDispatchPoliceMapper
+{
+ /**
+ * 鏌ヨ娲捐绠$悊
+ *
+ * @param id 娲捐绠$悊涓婚敭
+ * @return 娲捐绠$悊
+ */
+ public ArdDispatchPolice selectArdDispatchPoliceById(String id);
+
+ /**
+ * 鏌ヨ娲捐绠$悊鍒楄〃
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 娲捐绠$悊闆嗗悎
+ */
+ public List<ArdDispatchPolice> selectArdDispatchPoliceList(ArdDispatchPolice ardDispatchPolice);
+
+ /**
+ * 鏂板娲捐绠$悊
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 缁撴灉
+ */
+ public int insertArdDispatchPolice(ArdDispatchPolice ardDispatchPolice);
+
+ /**
+ * 淇敼娲捐绠$悊
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 缁撴灉
+ */
+ public int updateArdDispatchPolice(ArdDispatchPolice ardDispatchPolice);
+
+ /**
+ * 鍒犻櫎娲捐绠$悊
+ *
+ * @param id 娲捐绠$悊涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdDispatchPoliceById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎娲捐绠$悊
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdDispatchPoliceByIds(String[] ids);
+
+ /**
+ * 鎵归噺鍒犻櫎娲捐鍏宠仈鐢ㄦ埛
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdDispatchPoliceUserByDispatchIds(String[] ids);
+
+ /**
+ * 鎵归噺鏂板娲捐鍏宠仈鐢ㄦ埛
+ *
+ * @param ardDispatchPoliceUserList 娲捐鍏宠仈鐢ㄦ埛鍒楄〃
+ * @return 缁撴灉
+ */
+ public int batchArdDispatchPoliceUser(List<ArdDispatchPoliceUser> ardDispatchPoliceUserList);
+
+
+ /**
+ * 閫氳繃娲捐绠$悊涓婚敭鍒犻櫎娲捐鍏宠仈鐢ㄦ埛淇℃伅
+ *
+ * @param id 娲捐绠$悊ID
+ * @return 缁撴灉
+ */
+ public int deleteArdDispatchPoliceUserByDispatchId(String id);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/dispatch/service/IArdDispatchPoliceService.java b/ard-work/src/main/java/com/ruoyi/dispatch/service/IArdDispatchPoliceService.java
new file mode 100644
index 0000000..0d68396
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/service/IArdDispatchPoliceService.java
@@ -0,0 +1,61 @@
+package com.ruoyi.dispatch.service;
+
+import java.util.List;
+import com.ruoyi.dispatch.domain.ArdDispatchPolice;
+
+/**
+ * 娲捐绠$悊Service鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-08-21
+ */
+public interface IArdDispatchPoliceService
+{
+ /**
+ * 鏌ヨ娲捐绠$悊
+ *
+ * @param id 娲捐绠$悊涓婚敭
+ * @return 娲捐绠$悊
+ */
+ public ArdDispatchPolice selectArdDispatchPoliceById(String id);
+
+ /**
+ * 鏌ヨ娲捐绠$悊鍒楄〃
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 娲捐绠$悊闆嗗悎
+ */
+ public List<ArdDispatchPolice> selectArdDispatchPoliceList(ArdDispatchPolice ardDispatchPolice);
+
+ /**
+ * 鏂板娲捐绠$悊
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 缁撴灉
+ */
+ public int insertArdDispatchPolice(ArdDispatchPolice ardDispatchPolice);
+
+ /**
+ * 淇敼娲捐绠$悊
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 缁撴灉
+ */
+ public int updateArdDispatchPolice(ArdDispatchPolice ardDispatchPolice);
+
+ /**
+ * 鎵归噺鍒犻櫎娲捐绠$悊
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑娲捐绠$悊涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdDispatchPoliceByIds(String[] ids);
+
+ /**
+ * 鍒犻櫎娲捐绠$悊淇℃伅
+ *
+ * @param id 娲捐绠$悊涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdDispatchPoliceById(String id);
+}
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
new file mode 100644
index 0000000..92a99ff
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/dispatch/service/impl/ArdDispatchPoliceServiceImpl.java
@@ -0,0 +1,138 @@
+package com.ruoyi.dispatch.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.DateUtils;
+
+import com.ruoyi.common.utils.uuid.IdUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.transaction.annotation.Transactional;
+import com.ruoyi.dispatch.domain.ArdDispatchPoliceUser;
+import com.ruoyi.dispatch.mapper.ArdDispatchPoliceMapper;
+import com.ruoyi.dispatch.domain.ArdDispatchPolice;
+import com.ruoyi.dispatch.service.IArdDispatchPoliceService;
+
+import javax.annotation.Resource;
+
+/**
+ * 娲捐绠$悊Service涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2023-08-21
+ */
+@Service
+public class ArdDispatchPoliceServiceImpl implements IArdDispatchPoliceService {
+ @Resource
+ private ArdDispatchPoliceMapper ardDispatchPoliceMapper;
+
+ /**
+ * 鏌ヨ娲捐绠$悊
+ *
+ * @param id 娲捐绠$悊涓婚敭
+ * @return 娲捐绠$悊
+ */
+ @Override
+ public ArdDispatchPolice selectArdDispatchPoliceById(String id) {
+ return ardDispatchPoliceMapper.selectArdDispatchPoliceById(id);
+ }
+
+ /**
+ * 鏌ヨ娲捐绠$悊鍒楄〃
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 娲捐绠$悊
+ */
+ @Override
+ public List<ArdDispatchPolice> selectArdDispatchPoliceList(ArdDispatchPolice ardDispatchPolice) {
+ return ardDispatchPoliceMapper.selectArdDispatchPoliceList(ardDispatchPolice);
+ }
+
+ /**
+ * 鏂板娲捐绠$悊
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 缁撴灉
+ */
+ @Transactional
+ @Override
+ public int insertArdDispatchPolice(ArdDispatchPolice ardDispatchPolice) {
+ ardDispatchPolice.setId(IdUtils.simpleUUID());
+ ardDispatchPolice.setUserId(SecurityUtils.getUserId());
+ ardDispatchPolice.setCreateBy(SecurityUtils.getUsername());
+ ardDispatchPolice.setCreateTime(DateUtils.getNowDate());
+ int rows = ardDispatchPoliceMapper.insertArdDispatchPolice(ardDispatchPolice);
+ insertArdDispatchPoliceUser(ardDispatchPolice);
+ return rows;
+ }
+
+ /**
+ * 淇敼娲捐绠$悊
+ *
+ * @param ardDispatchPolice 娲捐绠$悊
+ * @return 缁撴灉
+ */
+ @Transactional
+ @Override
+ public int updateArdDispatchPolice(ArdDispatchPolice ardDispatchPolice) {
+ ardDispatchPolice.setUpdateBy(SecurityUtils.getUsername());
+ ardDispatchPolice.setUpdateTime(DateUtils.getNowDate());
+ ardDispatchPoliceMapper.deleteArdDispatchPoliceUserByDispatchId(ardDispatchPolice.getId())
+ ;
+ insertArdDispatchPoliceUser(ardDispatchPolice);
+ return ardDispatchPoliceMapper.updateArdDispatchPolice(ardDispatchPolice);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎娲捐绠$悊
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑娲捐绠$悊涓婚敭
+ * @return 缁撴灉
+ */
+ @Transactional
+ @Override
+ public int deleteArdDispatchPoliceByIds(String[] ids) {
+ ardDispatchPoliceMapper.deleteArdDispatchPoliceUserByDispatchIds(ids);
+ return ardDispatchPoliceMapper.deleteArdDispatchPoliceByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎娲捐绠$悊淇℃伅
+ *
+ * @param id 娲捐绠$悊涓婚敭
+ * @return 缁撴灉
+ */
+ @Transactional
+ @Override
+ public int deleteArdDispatchPoliceById(String id) {
+ ardDispatchPoliceMapper.deleteArdDispatchPoliceUserByDispatchId(id);
+ return ardDispatchPoliceMapper.deleteArdDispatchPoliceById(id);
+ }
+
+ /**
+ * 鏂板娲捐鍏宠仈鐢ㄦ埛淇℃伅
+ *
+ * @param ardDispatchPolice 娲捐绠$悊瀵硅薄
+ */
+ public void insertArdDispatchPoliceUser(ArdDispatchPolice ardDispatchPolice) {
+ List<String> ardDispatchPoliceUserList = ardDispatchPolice.getArdDispatchPoliceUserList();
+ String id = ardDispatchPolice.getId();
+ if (StringUtils.isNotNull(ardDispatchPoliceUserList)) {
+ List<ArdDispatchPoliceUser> list = new ArrayList<ArdDispatchPoliceUser>();
+ for (String userId : ardDispatchPoliceUserList) {
+ ArdDispatchPoliceUser ardDispatchPoliceUser=new ArdDispatchPoliceUser();
+ ardDispatchPoliceUser.setUserId(userId);
+ ardDispatchPoliceUser.setDispatchId(id);
+ list.add(ardDispatchPoliceUser);
+ }
+ if (list.size() > 0) {
+ ardDispatchPoliceMapper.batchArdDispatchPoliceUser(list);
+ }
+ }
+ }
+}
diff --git a/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml b/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml
new file mode 100644
index 0000000..7056376
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/dispatch/ArdDispatchPoliceMapper.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.dispatch.mapper.ArdDispatchPoliceMapper">
+
+ <resultMap type="ArdDispatchPolice" id="ArdDispatchPoliceResult">
+ <result property="id" column="id"/>
+ <result property="name" column="name"/>
+ <result property="longitude" column="longitude"/>
+ <result property="latitude" column="latitude"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="userId" column="user_id"/>
+ <result property="createBy" column="create_by"/>
+ <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"/>
+ </resultMap>
+
+ <resultMap type="ArdDispatchPoliceUser" id="ArdDispatchPoliceUserResult">
+ <result property="dispatchId" column="sub_dispatch_id"/>
+ <result property="userId" column="sub_user_id"/>
+ </resultMap>
+
+ <sql id="selectArdDispatchPoliceVo">
+ SELECT ID,
+ NAME,
+ longitude,
+ latitude,
+ dept_id,
+ user_id,
+ create_by,
+ create_time,
+ update_by,
+ update_time
+ FROM ard_dispatch_police
+ </sql>
+
+ <select id="selectArdDispatchPoliceList" parameterType="ArdDispatchPolice" resultMap="ArdDispatchPoliceResult">
+ <include refid="selectArdDispatchPoliceVo"/>
+ <where>
+ <if test="name != null and name != ''">and name like '%'||#{name}||'%'</if>
+ <if test="longitude != null ">and longitude = #{longitude}</if>
+ <if test="latitude != null ">and latitude = #{latitude}</if>
+ <if test="deptId != null ">and dept_id = #{deptId}</if>
+ <if test="userId != null and userId != ''">and user_id = #{userId}</if>
+ </where>
+ </select>
+
+ <select id="selectArdDispatchPoliceById" parameterType="String"
+ resultMap="ArdDispatchPoliceArdDispatchPoliceUserResult">
+ select a.id,
+ a.name,
+ a.longitude,
+ a.latitude,
+ a.dept_id,
+ a.user_id,
+ a.create_by,
+ a.create_time,
+ a.update_by,
+ a.update_time,
+ b.dispatch_id as sub_dispatch_id,
+ b.user_id as sub_user_id
+ from ard_dispatch_police a
+ left join ard_dispatch_police_user b on b.dispatch_id = a.id
+ where a.id = #{id}
+ </select>
+
+ <insert id="insertArdDispatchPolice" parameterType="ArdDispatchPolice">
+ insert into ard_dispatch_police
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="name != null">name,</if>
+ <if test="longitude != null">longitude,</if>
+ <if test="latitude != null">latitude,</if>
+ <if test="deptId != null">dept_id,</if>
+ <if test="userId != null">user_id,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="name != null">#{name},</if>
+ <if test="longitude != null">#{longitude},</if>
+ <if test="latitude != null">#{latitude},</if>
+ <if test="deptId != null">#{deptId},</if>
+ <if test="userId != null">#{userId},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdDispatchPolice" parameterType="ArdDispatchPolice">
+ update ard_dispatch_police
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="name != null">name = #{name},</if>
+ <if test="longitude != null">longitude = #{longitude},</if>
+ <if test="latitude != null">latitude = #{latitude},</if>
+ <if test="deptId != null">dept_id = #{deptId},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteArdDispatchPoliceById" parameterType="String">
+ delete
+ from ard_dispatch_police
+ where id = #{id}
+ </delete>
+
+ <delete id="deleteArdDispatchPoliceByIds" parameterType="String">
+ delete from ard_dispatch_police where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+
+ <delete id="deleteArdDispatchPoliceUserByDispatchIds" parameterType="String">
+ delete from ard_dispatch_police_user where dispatch_id in
+ <foreach item="dispatchId" collection="array" open="(" separator="," close=")">
+ #{dispatchId}
+ </foreach>
+ </delete>
+
+ <delete id="deleteArdDispatchPoliceUserByDispatchId" parameterType="String">
+ delete
+ from ard_dispatch_police_user
+ where dispatch_id = #{dispatchId}
+ </delete>
+
+ <insert id="batchArdDispatchPoliceUser">
+ insert into ard_dispatch_police_user( dispatch_id, user_id) values
+ <foreach item="item" index="index" collection="list" separator=",">
+ ( #{item.dispatchId}, #{item.userId})
+ </foreach>
+ </insert>
+
+</mapper>
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
index b988080..7f4291b 100644
--- a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
+++ b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
@@ -18,5 +18,6 @@
</settings>
<typeAliases>
<package name="com.ruoyi.*.*.domain"/> <!--鏇挎崲鎴愪綘鐨勯」鐩殑瀹炰綋绫荤殑璺緞(杩欎釜閰嶇疆瀵逛簬椤圭洰鏉ヨ娌℃湁浣滅敤锛屼粎浠呮槸鍐欑粰IDEA涓婂畨瑁呯殑 MyBatis 鎻掍欢鐪嬬殑锛岄槻姝㈡爣绾�)-->
+ <package name="com.ruoyi.*.domain"/>
</typeAliases>
</configuration>
--
Gitblit v1.9.3