From a7aaeabc7873a0eafb4a7ecad7f65b018b7a9bc9 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 24 Feb 2023 19:31:23 +0800
Subject: [PATCH] What's new? 1. Add license for dock. 2. Modify the logic corresponding to the firmware file and device type. 3. Add multiple mqtt clients options. 4. Modify the structure of the interface for obtaining the device list. 5. Fixed some issues.

---
 src/main/java/com/dji/sample/manage/dao/IDeviceFirmwareMapper.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/dji/sample/manage/dao/IDeviceFirmwareMapper.java b/src/main/java/com/dji/sample/manage/dao/IDeviceFirmwareMapper.java
index 55653f5..bc4c4a2 100644
--- a/src/main/java/com/dji/sample/manage/dao/IDeviceFirmwareMapper.java
+++ b/src/main/java/com/dji/sample/manage/dao/IDeviceFirmwareMapper.java
@@ -1,7 +1,12 @@
 package com.dji.sample.manage.dao;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dji.sample.manage.model.entity.DeviceFirmwareEntity;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 /**
  * @author sean
@@ -9,4 +14,26 @@
  * @date 2022/8/16
  */
 public interface IDeviceFirmwareMapper extends BaseMapper<DeviceFirmwareEntity> {
+    String sql = "<script> \n" +
+                "SELECT \n" +
+                "  * \n" +
+                "from \n" +
+                "  (\n" +
+                "    select \n" +
+                "      a.*, \n" +
+                "      group_concat(b.device_name) device_name \n" +
+                "    from \n" +
+                "      manage_device_firmware a \n" +
+                "      join manage_firmware_model b on a.firmware_id = b.firmware_id \n" +
+                "   <if test='device_name != null and device_name != \"\"'> \n" +
+                "       and b.device_name = #{device_name} \n" +
+                "   </if> \n" +
+                "   group by firmware_id \n" +
+                "  ) c ${ew.customSqlSegment} \n";
+
+    @Select(sql + "</script>")
+    Page<DeviceFirmwareEntity> selectPage(Page page, @Param(Constants.WRAPPER)Wrapper<DeviceFirmwareEntity> wrapper, @Param("device_name") String deviceName);
+
+    @Select(sql + " limit 1 </script>")
+    DeviceFirmwareEntity selectOne(@Param(Constants.WRAPPER)Wrapper<DeviceFirmwareEntity> wrapper, @Param("device_name") String deviceName);
 }

--
Gitblit v1.9.3