459242451@qq.com 3 anos atrás
pai
commit
adb01ccf05

+ 39 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysGatewayUserTask.java

@@ -8,9 +8,13 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.framework.websocket.WebSocketServer;
+import com.ruoyi.framework.websocket.WebsocketConst;
 import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.service.ISysDictTypeService;
 import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.zhdd.domain.GatewayDept;
 import com.ruoyi.zhdd.domain.GatewayOrg;
@@ -39,6 +43,12 @@ public class SysGatewayUserTask {
     @Autowired
     private ISingleDeviceService singleDeviceService;
 
+    @Autowired
+    private ISysDictTypeService sysDictTypeService;
+
+    @Autowired
+    private WebSocketServer webSocketServer;
+
     @KafkaListener(topics = "t_uc_user")
     public void onUserMessage(String message) {
         log.info("kafka用户信息消费:{}", message);
@@ -227,6 +237,11 @@ public class SysGatewayUserTask {
         }
     }
 
+    /**
+     * 单兵实时位置消费
+     *
+     * @param message
+     */
     @KafkaListener(topics = "gps_executestation_581a2b5cb28e429bb56a3c6b8cbdf5a6")
     public void onDeviceMessage(String message) {
         log.info("kafka单兵设备信息消费:{}", message);
@@ -250,4 +265,28 @@ public class SysGatewayUserTask {
         }
     }
 
+    /**
+     * 语音指令
+     *
+     * @param message
+     */
+    @KafkaListener(topics = "voice-vcg")
+    public void onVoiceMessage(String message) {
+        log.info("kafka语音指令消费:{}", message);
+        JSONObject jsonObject = JSONUtil.parseObj(message);
+        String id = jsonObject.getStr("id");
+        String wordValue = jsonObject.getStr("wordValue");
+        List<SysDictData> zhdd_voice = sysDictTypeService.selectDictDataByType("zhdd_voice");
+        for (SysDictData sysDictData : zhdd_voice) {
+            if (sysDictData.getDictLabel().contains(wordValue)) {
+                JSONObject obj = new JSONObject();
+                obj.set(WebsocketConst.MSG_CMD, sysDictData.getDictValue());
+                obj.set(WebsocketConst.MSG_ID, id);
+                obj.set(WebsocketConst.MSG_TXT, wordValue);
+                webSocketServer.sendAllMessage(obj.toString());
+                break;
+            }
+        }
+    }
+
 }

+ 32 - 25
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhdd/ResourceController.java

@@ -1,37 +1,43 @@
 package com.ruoyi.web.controller.zhdd;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.stream.Collectors;
-
 import cn.hutool.core.collection.CollUtil;
-import com.ruoyi.common.core.domain.GatewayUser;
-import lombok.RequiredArgsConstructor;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.constraints.*;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.validation.annotation.Validated;
-import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.GatewayUser;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.core.validate.AddGroup;
 import com.ruoyi.common.core.validate.EditGroup;
 import com.ruoyi.common.core.validate.QueryGroup;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.zhdd.domain.vo.ResourceVo;
 import com.ruoyi.zhdd.domain.bo.ResourceBo;
+import com.ruoyi.zhdd.domain.vo.ResourceVo;
 import com.ruoyi.zhdd.service.IResourceService;
-import com.ruoyi.common.core.page.TableDataInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 应急资源Controller
@@ -55,7 +61,7 @@ public class ResourceController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('zhdd:resource:list')")
     @GetMapping("/list")
     public TableDataInfo<ResourceVo> list(@Validated(QueryGroup.class) ResourceBo bo) {
-        GatewayUser user =  getGateWayUser();
+        GatewayUser user = getGateWayUser();
         return iResourceService.queryPageList(bo);
     }
 
@@ -78,7 +84,7 @@ public class ResourceController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('zhdd:resource:query')")
     @GetMapping("/{id}")
     public AjaxResult<ResourceVo> getInfo(@NotNull(message = "主键不能为空")
-                                                  @PathVariable("id") String id) {
+                                          @PathVariable("id") String id) {
         return AjaxResult.success(iResourceService.queryById(id));
     }
 
@@ -111,22 +117,23 @@ public class ResourceController extends BaseController {
      */
     @ApiOperation("删除应急资源")
 //    @PreAuthorize("@ss.hasPermi('zhdd:resource:remove')")
-    @Log(title = "应急资源" , businessType = BusinessType.DELETE)
+    @Log(title = "应急资源", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
-                                       @PathVariable String[] ids) {
+                                   @PathVariable String[] ids) {
         return toAjax(iResourceService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
     }
 
     @ApiOperation("查询所有应急资源信息")
     @GetMapping("/location")
-    public AjaxResult<Map<String,List<ResourceVo>>> queryResourceLocation(ResourceBo bo) {
+    public AjaxResult<Map<String, List<ResourceVo>>> queryResourceLocation(ResourceBo bo) {
         List<ResourceVo> list = iResourceService.queryList(bo);
         Map<Integer, List<ResourceVo>> collect = list.stream().collect(Collectors.groupingBy(ResourceVo::getResourceType, Collectors.mapping(a -> a, Collectors.toList())));
-        Map<String,List<ResourceVo>> result = new HashMap<>();
+        Map<String, List<ResourceVo>> result = new HashMap<>();
         result.put("应急仓库", CollUtil.defaultIfEmpty(collect.get(1), new ArrayList<>()));
         result.put("应急队伍", CollUtil.defaultIfEmpty(collect.get(2), new ArrayList<>()));
         result.put("应急车队", CollUtil.defaultIfEmpty(collect.get(3), new ArrayList<>()));
         return AjaxResult.success(result);
     }
+
 }

+ 31 - 17
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhdd/ResourceDetailController.java

@@ -1,31 +1,38 @@
 package com.ruoyi.web.controller.zhdd;
 
-import java.util.List;
-import java.util.Arrays;
-import java.util.concurrent.TimeUnit;
-
-import lombok.RequiredArgsConstructor;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.constraints.*;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.validation.annotation.Validated;
-import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.core.validate.AddGroup;
 import com.ruoyi.common.core.validate.EditGroup;
 import com.ruoyi.common.core.validate.QueryGroup;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.zhdd.domain.vo.ResourceDetailVo;
 import com.ruoyi.zhdd.domain.bo.ResourceDetailBo;
+import com.ruoyi.zhdd.domain.vo.ResourceDetailVo;
+import com.ruoyi.zhdd.domain.vo.ResourceVo;
 import com.ruoyi.zhdd.service.IResourceDetailService;
-import com.ruoyi.common.core.page.TableDataInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * 应急资源明细Controller
@@ -71,7 +78,7 @@ public class ResourceDetailController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('zhdd:resourceDetail:query')")
     @GetMapping("/{id}")
     public AjaxResult<ResourceDetailVo> getInfo(@NotNull(message = "主键不能为空")
-                                                  @PathVariable("id") String id) {
+                                                @PathVariable("id") String id) {
         return AjaxResult.success(iResourceDetailService.queryById(id));
     }
 
@@ -104,10 +111,17 @@ public class ResourceDetailController extends BaseController {
      */
     @ApiOperation("删除应急资源明细")
 //    @PreAuthorize("@ss.hasPermi('zhdd:resourceDetail:remove')")
-    @Log(title = "应急资源明细" , businessType = BusinessType.DELETE)
+    @Log(title = "应急资源明细", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
-                                       @PathVariable String[] ids) {
+                                   @PathVariable String[] ids) {
         return toAjax(iResourceDetailService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
     }
+
+    @ApiOperation("通过物资检索应急仓库")
+    @GetMapping("/searchWarehouseByGoods")
+    public AjaxResult<List<ResourceVo>> searchWarehouseByGoods(ResourceDetailBo bo) {
+        List<ResourceVo> list = iResourceDetailService.searchWarehouseByGoods(bo);
+        return AjaxResult.success(list);
+    }
 }

+ 41 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhdd/WebSocketController.java

@@ -0,0 +1,41 @@
+package com.ruoyi.web.controller.zhdd;
+
+import cn.hutool.json.JSONObject;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.websocket.WebSocketServer;
+import com.ruoyi.framework.websocket.WebsocketConst;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2022/1/5
+ * @Version V1.0
+ */
+@Api(value = "websocket发送消息", tags = {"websocket发送消息"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/zhdd/websocket")
+public class WebSocketController extends BaseController {
+
+    private final WebSocketServer webSocket;
+
+    @ApiOperation("发送所有")
+    @PostMapping("/sendAll")
+    public AjaxResult<Void> sendAll(@RequestBody JSONObject jsonObject) {
+        String message = jsonObject.getStr("message");
+        JSONObject obj = new JSONObject();
+        obj.set(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
+        obj.set(WebsocketConst.MSG_TXT, message);
+        webSocket.sendAllMessage(obj.toString());
+        return AjaxResult.success();
+    }
+}

+ 69 - 39
ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketServer.java

@@ -1,6 +1,9 @@
 package com.ruoyi.framework.websocket;
 
-import java.util.concurrent.Semaphore;
+import cn.hutool.json.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
 import javax.websocket.OnClose;
 import javax.websocket.OnError;
 import javax.websocket.OnMessage;
@@ -8,13 +11,10 @@ import javax.websocket.OnOpen;
 import javax.websocket.Session;
 import javax.websocket.server.PathParam;
 import javax.websocket.server.ServerEndpoint;
-
-import cn.hutool.json.JSONObject;
-import lombok.extern.slf4j.Slf4j;
-import okhttp3.WebSocket;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArraySet;
 
 /**
  * websocket 消息处理
@@ -26,32 +26,25 @@ import org.springframework.stereotype.Component;
 @Slf4j
 public class WebSocketServer {
 
-    /**
-     * 默认最多允许同时在线人数100
-     */
-    public static int socketMaxOnlineCount = 100;
-
-    private static Semaphore socketSemaphore = new Semaphore(socketMaxOnlineCount);
+    private static CopyOnWriteArraySet<WebSocketServer> webSockets = new CopyOnWriteArraySet<>();
+    private Session session;
+    private static Map<String, Session> sessionPool = new HashMap<>();
 
     /**
      * 连接建立成功调用的方法
      */
     @OnOpen
-    public void onOpen(Session session, @PathParam(value = "userId") String userId) throws Exception {
-        boolean semaphoreFlag;
-        // 尝试获取信号量
-        semaphoreFlag = SemaphoreUtils.tryAcquire(socketSemaphore);
-        if (!semaphoreFlag) {
-            // 未获取到信号量
-            log.error("\n 当前在线人数超过限制数- {}", socketMaxOnlineCount);
-            WebSocketUsers.sendMessageToUserByText(session, "当前在线人数超过限制数:" + socketMaxOnlineCount);
-            session.close();
-        } else {
+    public void onOpen(Session session, @PathParam(value = "userId") String userId) {
+        try {
+            this.session = session;
+            webSockets.add(this);
             // 添加用户
-            WebSocketUsers.put(userId, session);
+            sessionPool.put(userId, session);
             log.info("\n 建立连接 - {}", session);
-            log.info("\n 当前人数 - {}", WebSocketUsers.getUsers().size());
-            WebSocketUsers.sendMessageToUserByText(session, "连接成功");
+            log.info("\n 当前人数 - {}", webSockets.size());
+            sendMessageToUserByText(session, "连接成功");
+        } catch (Exception e) {
+            log.error("\n websocket建立连接异常");
         }
     }
 
@@ -62,9 +55,7 @@ public class WebSocketServer {
     public void onClose(Session session) {
         log.info("\n 关闭连接 - {}", session);
         // 移除用户
-        WebSocketUsers.remove(session.getId());
-        // 获取到信号量则需释放
-        SemaphoreUtils.release(socketSemaphore);
+        webSockets.remove(this);
     }
 
     /**
@@ -78,34 +69,73 @@ public class WebSocketServer {
         }
         String sessionId = session.getId();
         log.info("\n 连接异常 - {}\n异常信息 - {}", sessionId, exception);
-        // 移出用户
-        WebSocketUsers.remove(sessionId);
-        // 获取到信号量则需释放
-        SemaphoreUtils.release(socketSemaphore);
     }
 
     /**
      * 服务器接收到客户端消息时调用的方法
      */
     @OnMessage
-    public void onMessage(String message, Session session) {
-        log.info("【websocket消息】收到客户端消息:{}", message);
+    public void onMessage(String message) {
+        log.info("\n websocket消息 收到客户端消息:{}", message);
         JSONObject obj = new JSONObject();
         obj.set(WebsocketConst.MSG_CMD, WebsocketConst.CMD_CHECK);//业务类型
         obj.set(WebsocketConst.MSG_TXT, "心跳响应");//消息内容
-        WebSocketUsers.sendMessageToUserByText(session, obj.toString());
+        sendMessageToUserByText(session, obj.toString());
+    }
+
+    // 此为广播消息
+    public void sendAllMessage(String message) {
+        log.info("\n websocket消息 广播消息:" + message);
+        for (WebSocketServer webSocket : webSockets) {
+            try {
+                if (webSocket.session.isOpen()) {
+                    webSocket.session.getAsyncRemote().sendText(message);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
     }
 
     // 此为单点消息
     public void sendOneMessage(String userId, String message) {
-        WebSocketUsers.sendMessageToSingleUserByText(userId, message);
+        sendMessageToSingleUserByText(userId, message);
     }
 
     // 此为单点消息(多人)
     public void sendMoreMessage(String[] userIds, String message) {
         for (String userId : userIds) {
-            WebSocketUsers.sendMessageToSingleUserByText(userId, message);
+            sendMessageToSingleUserByText(userId, message);
+        }
+    }
+
+    /**
+     * 发送文本消息
+     *
+     * @param session 自己的用户名
+     * @param message 消息内容
+     */
+    public static void sendMessageToUserByText(Session session, String message) {
+        if (session != null) {
+            session.getAsyncRemote().sendText(message);
+        } else {
+            log.info("\n[你已离线]");
         }
+    }
 
+    public void sendMessageToSingleUserByText(String userId, String message) {
+        log.info("\n websocket消息 发送给:{}, 单点消息:{}", userId, message);
+        Session session = sessionPool.get(userId);
+        if (session != null && session.isOpen()) {
+            try {
+                synchronized (session) {
+                    session.getBasicRemote().sendText(message);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        } else {
+            log.info("\n[你已离线]");
+        }
     }
 }

+ 0 - 122
ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketUsers.java

@@ -1,122 +0,0 @@
-package com.ruoyi.framework.websocket;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import javax.websocket.Session;
-
-import lombok.extern.slf4j.Slf4j;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * websocket 客户端用户集
- *
- * @author ruoyi
- */
-@Slf4j
-public class WebSocketUsers {
-
-    /**
-     * 用户集
-     */
-    private static Map<String, Session> USERS = new ConcurrentHashMap<>();
-
-    /**
-     * 存储用户
-     *
-     * @param key     唯一键
-     * @param session 用户信息
-     */
-    public static void put(String key, Session session) {
-        USERS.put(key, session);
-    }
-
-    /**
-     * 移除用户
-     *
-     * @param session 用户信息
-     * @return 移除结果
-     */
-    public static boolean remove(Session session) {
-        String key = null;
-        boolean flag = USERS.containsValue(session);
-        if (flag) {
-            Set<Map.Entry<String, Session>> entries = USERS.entrySet();
-            for (Map.Entry<String, Session> entry : entries) {
-                Session value = entry.getValue();
-                if (value.equals(session)) {
-                    key = entry.getKey();
-                    break;
-                }
-            }
-        } else {
-            return true;
-        }
-        return remove(key);
-    }
-
-    /**
-     * 移出用户
-     *
-     * @param key 键
-     */
-    public static boolean remove(String key) {
-        log.info("\n 正在移出用户 - {}", key);
-        Session remove = USERS.remove(key);
-        if (remove != null) {
-            boolean containsValue = USERS.containsValue(remove);
-            log.info("\n 移出结果 - {}", containsValue ? "失败" : "成功");
-            return containsValue;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * 获取在线用户列表
-     *
-     * @return 返回用户集合
-     */
-    public static Map<String, Session> getUsers() {
-        return USERS;
-    }
-
-    /**
-     * 群发消息文本消息
-     *
-     * @param message 消息内容
-     */
-    public static void sendMessageToUsersByText(String message) {
-        Collection<Session> values = USERS.values();
-        for (Session value : values) {
-            sendMessageToUserByText(value, message);
-        }
-    }
-
-    /**
-     * 发送文本消息
-     *
-     * @param session 自己的用户名
-     * @param message 消息内容
-     */
-    public static void sendMessageToUserByText(Session session, String message) {
-        if (session != null) {
-            session.getAsyncRemote().sendText(message);
-        } else {
-            log.info("\n[你已离线]");
-        }
-    }
-
-    public static void sendMessageToSingleUserByText(String userId, String message) {
-        log.info("【websocket消息】发送给:{}, 单点消息:{}", userId, message);
-        Session session = USERS.get(userId);
-        if (session != null) {
-            session.getAsyncRemote().sendText(message);
-        } else {
-            log.info("\n[你已离线]");
-        }
-    }
-}

+ 2 - 11
ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebsocketConst.java

@@ -42,18 +42,9 @@ public class WebsocketConst {
     public static final String CMD_TOPIC = "topic";
 
     /**
-     * 消息类型 email
+     * 消息类型 打开大屏
      */
-    public static final String CMD_EMAIL = "email";
+    public static final String CMD_OPEN_BIG_SCREEN = "openBigScreen";
 
-    /**
-     * 消息类型 meetingsign 会议签到
-     */
-    public static final String CMD_SIGN = "sign";
-
-    /**
-     * 消息类型 新闻发布/取消
-     */
-    public static final String NEWS_PUBLISH = "publish";
 
 }

+ 6 - 3
ruoyi-zhdd/src/main/java/com/ruoyi/zhdd/mapper/ResourceDetailMapper.java

@@ -1,9 +1,11 @@
 package com.ruoyi.zhdd.mapper;
 
-import com.ruoyi.zhdd.domain.ResourceDetail;
 import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
-import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
-import org.apache.ibatis.annotations.CacheNamespace;
+import com.ruoyi.zhdd.domain.Resource;
+import com.ruoyi.zhdd.domain.ResourceDetail;
+import com.ruoyi.zhdd.domain.bo.ResourceDetailBo;
+
+import java.util.List;
 
 /**
  * 应急资源明细Mapper接口
@@ -13,4 +15,5 @@ import org.apache.ibatis.annotations.CacheNamespace;
  */
 public interface ResourceDetailMapper extends BaseMapperPlus<ResourceDetail> {
 
+    List<Resource> searchWarehouseByGoods(ResourceDetailBo bo);
 }

+ 45 - 38
ruoyi-zhdd/src/main/java/com/ruoyi/zhdd/service/IResourceDetailService.java

@@ -1,10 +1,11 @@
 package com.ruoyi.zhdd.service;
 
-import com.ruoyi.zhdd.domain.ResourceDetail;
-import com.ruoyi.zhdd.domain.vo.ResourceDetailVo;
-import com.ruoyi.zhdd.domain.bo.ResourceDetailBo;
 import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
 import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.zhdd.domain.ResourceDetail;
+import com.ruoyi.zhdd.domain.bo.ResourceDetailBo;
+import com.ruoyi.zhdd.domain.vo.ResourceDetailVo;
+import com.ruoyi.zhdd.domain.vo.ResourceVo;
 
 import java.util.Collection;
 import java.util.List;
@@ -16,41 +17,47 @@ import java.util.List;
  * @date 2021-10-27
  */
 public interface IResourceDetailService extends IServicePlus<ResourceDetail, ResourceDetailVo> {
-	/**
-	 * 查询单个
-	 * @return
-	 */
-	ResourceDetailVo queryById(String id);
-
-	/**
-	 * 查询列表
-	 */
+    /**
+     * 查询单个
+     *
+     * @return
+     */
+    ResourceDetailVo queryById(String id);
+
+    /**
+     * 查询列表
+     */
     TableDataInfo<ResourceDetailVo> queryPageList(ResourceDetailBo bo);
 
-	/**
-	 * 查询列表
-	 */
-	List<ResourceDetailVo> queryList(ResourceDetailBo bo);
-
-	/**
-	 * 根据新增业务对象插入应急资源明细
-	 * @param bo 应急资源明细新增业务对象
-	 * @return
-	 */
-	Boolean insertByBo(ResourceDetailBo bo);
-
-	/**
-	 * 根据编辑业务对象修改应急资源明细
-	 * @param bo 应急资源明细编辑业务对象
-	 * @return
-	 */
-	Boolean updateByBo(ResourceDetailBo bo);
-
-	/**
-	 * 校验并删除数据
-	 * @param ids 主键集合
-	 * @param isValid 是否校验,true-删除前校验,false-不校验
-	 * @return
-	 */
-	Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
+    /**
+     * 查询列表
+     */
+    List<ResourceDetailVo> queryList(ResourceDetailBo bo);
+
+    /**
+     * 根据新增业务对象插入应急资源明细
+     *
+     * @param bo 应急资源明细新增业务对象
+     * @return
+     */
+    Boolean insertByBo(ResourceDetailBo bo);
+
+    /**
+     * 根据编辑业务对象修改应急资源明细
+     *
+     * @param bo 应急资源明细编辑业务对象
+     * @return
+     */
+    Boolean updateByBo(ResourceDetailBo bo);
+
+    /**
+     * 校验并删除数据
+     *
+     * @param ids     主键集合
+     * @param isValid 是否校验,true-删除前校验,false-不校验
+     * @return
+     */
+    Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
+
+    List<ResourceVo> searchWarehouseByGoods(ResourceDetailBo bo);
 }

+ 21 - 11
ruoyi-zhdd/src/main/java/com/ruoyi/zhdd/service/impl/ResourceDetailServiceImpl.java

@@ -1,23 +1,27 @@
 package com.ruoyi.zhdd.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.PageUtils;
-import com.ruoyi.common.core.page.PagePlus;
-import com.ruoyi.common.core.page.TableDataInfo;
-import org.springframework.stereotype.Service;
-import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
+import cn.hutool.core.bean.copier.CopyOptions;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
+import com.ruoyi.common.core.page.PagePlus;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.utils.BeanCopyUtils;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.zhdd.domain.Resource;
+import com.ruoyi.zhdd.domain.ResourceDetail;
 import com.ruoyi.zhdd.domain.bo.ResourceDetailBo;
 import com.ruoyi.zhdd.domain.vo.ResourceDetailVo;
-import com.ruoyi.zhdd.domain.ResourceDetail;
+import com.ruoyi.zhdd.domain.vo.ResourceVo;
 import com.ruoyi.zhdd.mapper.ResourceDetailMapper;
 import com.ruoyi.zhdd.service.IResourceDetailService;
+import org.springframework.stereotype.Service;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.Collection;
 
 /**
  * 应急资源明细Service业务层处理
@@ -29,7 +33,7 @@ import java.util.Collection;
 public class ResourceDetailServiceImpl extends ServicePlusImpl<ResourceDetailMapper, ResourceDetail, ResourceDetailVo> implements IResourceDetailService {
 
     @Override
-    public ResourceDetailVo queryById(String id){
+    public ResourceDetailVo queryById(String id) {
         return getVoById(id);
     }
 
@@ -75,15 +79,21 @@ public class ResourceDetailServiceImpl extends ServicePlusImpl<ResourceDetailMap
      *
      * @param entity 实体类数据
      */
-    private void validEntityBeforeSave(ResourceDetail entity){
+    private void validEntityBeforeSave(ResourceDetail entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
     @Override
     public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return removeByIds(ids);
     }
+
+    @Override
+    public List<ResourceVo> searchWarehouseByGoods(ResourceDetailBo bo) {
+        List<Resource> list = baseMapper.searchWarehouseByGoods(bo);
+        return BeanCopyUtils.listCopy(list, new CopyOptions(), ResourceVo.class);
+    }
 }

+ 21 - 2
ruoyi-zhdd/src/main/resources/mapper/zhdd/ResourceDetailMapper.xml

@@ -1,7 +1,7 @@
 <?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">
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.zhdd.mapper.ResourceDetailMapper">
 
     <resultMap type="com.ruoyi.zhdd.domain.ResourceDetail" id="ResourceDetailResult">
@@ -17,5 +17,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime" column="create_time"/>
     </resultMap>
 
+    <select id="searchWarehouseByGoods" resultType="com.ruoyi.zhdd.domain.Resource">
+        select distinct t2.id,
+                        resource_type resourceType,
+                        t2.name,
+                        address,
+                        longitude,
+                        latitude,
+                        manage_unit   manageUnit,
+                        t2.num,
+                        carry_goods   carryGoods,
+                        contact_name  contactName,
+                        contact_phone contactPhone,
+                        car_type      carType,
+                        location_type locationType
+        from b_resource_detail t1
+                 left join b_resource t2 on t1.resource_id = t2.id
+        where t1.name like concat('%', #{name}, '%')
+    </select>
+
 
 </mapper>

+ 0 - 173
sql/test.sql

@@ -1,173 +0,0 @@
-USE `tocc-sq`;
-
-DROP TABLE if EXISTS test_demo;
-CREATE TABLE test_demo
-(
-    id          int(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
-    dept_id     int(0) NULL DEFAULT NULL COMMENT '部门id',
-    user_id     int(0) NULL DEFAULT NULL COMMENT '用户id',
-    order_num   int(0) NULL DEFAULT 0 COMMENT '排序号',
-    test_key    varchar(255) NULL DEFAULT NULL COMMENT 'key键',
-    value       varchar(255) NULL DEFAULT NULL COMMENT '值',
-    version     int(0) NULL DEFAULT 0 COMMENT '版本',
-    create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-    create_by   varchar(64) NULL DEFAULT NULL COMMENT '创建人',
-    update_time datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
-    update_by   varchar(64) NULL DEFAULT NULL COMMENT '更新人',
-    del_flag    int(0) NULL DEFAULT 0 COMMENT '删除标志',
-    PRIMARY KEY (id) USING BTREE
-) ENGINE = InnoDB COMMENT = '测试单表';
-
-DROP TABLE if EXISTS test_tree;
-CREATE TABLE test_tree
-(
-    id          int(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
-    parent_id   int(0) NULL DEFAULT 0 COMMENT '父id',
-    dept_id     int(0) NULL DEFAULT NULL COMMENT '部门id',
-    user_id     int(0) NULL DEFAULT NULL COMMENT '用户id',
-    tree_name   varchar(255) NULL DEFAULT NULL COMMENT '值',
-    version     int(0) NULL DEFAULT 0 COMMENT '版本',
-    create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-    create_by   varchar(64) NULL DEFAULT NULL COMMENT '创建人',
-    update_time datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
-    update_by   varchar(64) NULL DEFAULT NULL COMMENT '更新人',
-    del_flag    int(0) NULL DEFAULT 0 COMMENT '删除标志',
-    PRIMARY KEY (id) USING BTREE
-) ENGINE = InnoDB COMMENT = '测试树表';
-
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (5, '测试菜单', 0, 5, 'demo', NULL, 1, 0, 'M', '0', '0', NULL, 'star', 'admin', '2021-05-30 00:34:26', NULL, NULL, '');
-
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1500, '测试单表', 5, 1, 'demo', 'demo/demo/index', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '测试单表菜单');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1501, '测试单表查询', 1500, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1502, '测试单表新增', 1500, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1503, '测试单表修改', 1500, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1504, '测试单表删除', 1500, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1505, '测试单表导出', 1500, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '');
-
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1506, '测试树表', 5, 1, 'tree', 'demo/tree/index', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '测试树表菜单');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1507, '测试树表查询', 1506, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1508, '测试树表新增', 1506, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1509, '测试树表修改', 1506, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '');
-INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '');
-
-INSERT INTO sys_role(role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) VALUES (3, '本部门及以下', 'test1', 3, '4', 1, 1, '0', '0', 'admin', '2021-05-08 22:31:37', 'admin', '2021-05-08 22:32:03', NULL);
-INSERT INTO sys_role(role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) VALUES (4, '仅本人', 'test2', 4, '5', 1, 1, '0', '0', 'admin', '2021-05-30 01:14:52', 'admin', '2021-05-30 01:18:38', NULL);
-
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 5);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 100);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 101);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 102);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 103);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 104);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 105);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 106);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 107);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 108);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 500);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 501);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1001);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1002);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1003);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1004);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1005);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1006);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1007);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1008);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1009);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1010);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1011);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1012);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1013);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1014);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1015);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1016);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1017);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1018);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1019);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1020);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1021);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1022);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1023);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1024);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1025);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1026);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1027);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1028);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1029);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1030);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1031);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1032);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1033);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1034);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1035);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1036);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1037);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1038);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1039);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1040);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1041);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1042);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1043);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1044);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1045);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1500);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1501);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1502);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1503);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1504);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1505);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1506);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1507);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1508);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1509);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1510);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1511);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 5);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1500);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1501);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1502);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1503);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1504);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1505);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1506);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1507);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1508);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1509);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1510);
-INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1511);
-
-INSERT INTO sys_user(user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) VALUES (3, 108, 'test', '本部门及以下 密码666', '00', '', '', '0', '', '$2a$10$M6tZRpUZbWKq11O/z6YISePQc./Jhru8E18mmVJTr9aV8whzfjacC', '0', '0', '127.0.0.1', '2021-05-30 02:00:37', 'admin', '2021-04-22 09:50:41', 'test', '2021-05-30 02:00:37', NULL);
-INSERT INTO sys_user(user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) VALUES (4, 102, 'test1', '仅本人 密码666', '00', '', '', '0', '', '$2a$10$yBSXp5Ba1m402cxXTPSy4eXUO8CXCGvXfquNVP/XMWwZ8nf9GaoMy', '0', '0', '127.0.0.1', '2021-05-30 01:48:03', 'admin', '2021-05-30 01:16:02', 'test1', '2021-05-30 01:48:03', NULL);
-
-INSERT INTO sys_user_role(user_id, role_id) VALUES (3, 3);
-INSERT INTO sys_user_role(user_id, role_id) VALUES (4, 4);
-
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 102, 4, 1, '测试数据权限', '测试', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 102, 3, 2, '子节点1', '111', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 102, 3, 3, '子节点2', '222', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 108, 4, 4, '测试数据', 'demo', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 108, 3, 13, '子节点11', '1111', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 108, 3, 12, '子节点22', '2222', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 108, 3, 11, '子节点33', '3333', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 108, 3, 10, '子节点44', '4444', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 108, 3, 9, '子节点55', '5555', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 108, 3, 8, '子节点66', '6666', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 108, 3, 7, '子节点77', '7777', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 108, 3, 6, '子节点88', '8888', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 108, 3, 5, '子节点99', '9999', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 0, 102, 4, '测试数据权限', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 1, 102, 3, '子节点1', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 2, 102, 3, '子节点2', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 0, 108, 4, '测试树1', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 4, 108, 3, '子节点11', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 4, 108, 3, '子节点22', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 4, 108, 3, '子节点33', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 5, 108, 3, '子节点44', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 6, 108, 3, '子节点55', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 7, 108, 3, '子节点66', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 7, 108, 3, '子节点77', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 10, 108, 3, '子节点88', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);
-INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 10, 108, 3, '子节点99', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0);