Browse Source

Revert "优化设备上传功能"

This reverts commit 858b02a03c28dafa76e47050848a84d3126f5ed4.
Simon 1 year ago
parent
commit
e2970d560b

+ 4 - 16
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDeviceListController.java

@@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletResponse;
 
 
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TServiceManage;
-import com.ruoyi.system.domain.TUserProfile;
 import com.ruoyi.system.domain.dto.*;
 import com.ruoyi.system.domain.dto.*;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -112,31 +111,20 @@ public class TDeviceListController extends BaseController
         util.importTemplateExcel(response, "设备列表模板");
         util.importTemplateExcel(response, "设备列表模板");
     }
     }
 
 
-//    /**
-//     * 导入
-//     */
-//    @Log(title = "设备列表", businessType = BusinessType.IMPORT)
-//    @PostMapping("/importData")
-//    @ResponseBody
-//    public AjaxResult importData(MultipartFile file) throws Exception
-//    {
-//        ExcelUtil<TDeviceList> util = new ExcelUtil<TDeviceList>(TDeviceList.class);
-//        List<TDeviceList> tDeviceLists = util.importExcel(file.getInputStream());
-//        String message = tDeviceListService.importTDeviceList(tDeviceLists);
-//        return AjaxResult.success(message);
-//    }
     /**
     /**
      * 导入
      * 导入
      */
      */
     @Log(title = "设备列表", businessType = BusinessType.IMPORT)
     @Log(title = "设备列表", businessType = BusinessType.IMPORT)
     @PostMapping("/importData")
     @PostMapping("/importData")
     @ResponseBody
     @ResponseBody
-    public AjaxResult importDataV2(MultipartFile file) throws Exception {
+    public AjaxResult importData(MultipartFile file) throws Exception
+    {
         ExcelUtil<TDeviceList> util = new ExcelUtil<TDeviceList>(TDeviceList.class);
         ExcelUtil<TDeviceList> util = new ExcelUtil<TDeviceList>(TDeviceList.class);
         List<TDeviceList> tDeviceLists = util.importExcel(file.getInputStream());
         List<TDeviceList> tDeviceLists = util.importExcel(file.getInputStream());
-        String message = tDeviceListService.importTDeviceListV2(tDeviceLists);
+        String message = tDeviceListService.importTDeviceList(tDeviceLists);
         return AjaxResult.success(message);
         return AjaxResult.success(message);
     }
     }
+
     /**
     /**
      * 查询心率列表
      * 查询心率列表
      */
      */

+ 2 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -56,9 +56,9 @@ spring:
     # 测试环境
     # 测试环境
     #    active: test
     #    active: test
     # 开发环境
     # 开发环境
-    active: dev
+#    active: dev
     # 生产环境
     # 生产环境
-#    active: druid
+    active: druid
 
 
   # 文件上传
   # 文件上传
   servlet:
   servlet:

+ 9 - 16
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TFacilityMapper.java

@@ -4,34 +4,27 @@ import java.util.List;
 
 
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.enums.DataSourceType;
-import com.ruoyi.system.domain.TDeviceList;
 import com.ruoyi.system.domain.TFacility;
 import com.ruoyi.system.domain.TFacility;
 
 
 /**
 /**
  * 手环设备Mapper接口
  * 手环设备Mapper接口
- *
+ * 
  * @author zhengjie
  * @author zhengjie
  * @date 2023-08-12
  * @date 2023-08-12
  */
  */
-public interface TFacilityMapper {
+public interface TFacilityMapper 
+{
     /**
     /**
      * 查询手环设备
      * 查询手环设备
-     *
+     * 
      * @param id 手环设备主键
      * @param id 手环设备主键
      * @return 手环设备
      * @return 手环设备
      */
      */
     public TFacility selectTFacilityById(Long id);
     public TFacility selectTFacilityById(Long id);
 
 
-    /**
-     * 查询设备列列表
-     *
-     * @return 设备列集合
-     */
-    public List<TFacility> selectTDeviceListListByDeviceId(String device_id_code);
-
     /**
     /**
      * 查询手环设备列表
      * 查询手环设备列表
-     *
+     * 
      * @param tFacility 手环设备
      * @param tFacility 手环设备
      * @return 手环设备集合
      * @return 手环设备集合
      */
      */
@@ -39,7 +32,7 @@ public interface TFacilityMapper {
 
 
     /**
     /**
      * 新增手环设备
      * 新增手环设备
-     *
+     * 
      * @param tFacility 手环设备
      * @param tFacility 手环设备
      * @return 结果
      * @return 结果
      */
      */
@@ -47,7 +40,7 @@ public interface TFacilityMapper {
 
 
     /**
     /**
      * 修改手环设备
      * 修改手环设备
-     *
+     * 
      * @param tFacility 手环设备
      * @param tFacility 手环设备
      * @return 结果
      * @return 结果
      */
      */
@@ -55,7 +48,7 @@ public interface TFacilityMapper {
 
 
     /**
     /**
      * 删除手环设备
      * 删除手环设备
-     *
+     * 
      * @param id 手环设备主键
      * @param id 手环设备主键
      * @return 结果
      * @return 结果
      */
      */
@@ -63,7 +56,7 @@ public interface TFacilityMapper {
 
 
     /**
     /**
      * 批量删除手环设备
      * 批量删除手环设备
-     *
+     * 
      * @param ids 需要删除的数据主键集合
      * @param ids 需要删除的数据主键集合
      * @return 结果
      * @return 结果
      */
      */

+ 9 - 17
ruoyi-system/src/main/java/com/ruoyi/system/service/ITDeviceListService.java

@@ -1,21 +1,21 @@
 package com.ruoyi.system.service;
 package com.ruoyi.system.service;
 
 
 import java.util.List;
 import java.util.List;
-
 import com.ruoyi.system.domain.TDeviceList;
 import com.ruoyi.system.domain.TDeviceList;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.dto.*;
 import com.ruoyi.system.domain.dto.*;
 
 
 /**
 /**
  * 设备列Service接口
  * 设备列Service接口
- *
+ * 
  * @author zhengjie
  * @author zhengjie
  * @date 2023-08-30
  * @date 2023-08-30
  */
  */
-public interface ITDeviceListService {
+public interface ITDeviceListService 
+{
     /**
     /**
      * 查询设备列
      * 查询设备列
-     *
+     * 
      * @param id 设备列主键
      * @param id 设备列主键
      * @return 设备列
      * @return 设备列
      */
      */
@@ -23,7 +23,7 @@ public interface ITDeviceListService {
 
 
     /**
     /**
      * 查询设备列列表
      * 查询设备列列表
-     *
+     * 
      * @param tDeviceList 设备列
      * @param tDeviceList 设备列
      * @return 设备列集合
      * @return 设备列集合
      */
      */
@@ -93,17 +93,9 @@ public interface ITDeviceListService {
      */
      */
     public String importTDeviceList(List<TDeviceList> tDeviceLists);
     public String importTDeviceList(List<TDeviceList> tDeviceLists);
 
 
-    /**
-     * 导入设备列表数据
-     *
-     * @param tDeviceLists 设备列表列表
-     * @return 结果
-     */
-    public String importTDeviceListV2(List<TDeviceList> tDeviceLists);
-
     /**
     /**
      * 新增设备列
      * 新增设备列
-     *
+     * 
      * @param tDeviceList 设备列
      * @param tDeviceList 设备列
      * @return 结果
      * @return 结果
      */
      */
@@ -111,7 +103,7 @@ public interface ITDeviceListService {
 
 
     /**
     /**
      * 修改设备列
      * 修改设备列
-     *
+     * 
      * @param tDeviceList 设备列
      * @param tDeviceList 设备列
      * @return 结果
      * @return 结果
      */
      */
@@ -119,7 +111,7 @@ public interface ITDeviceListService {
 
 
     /**
     /**
      * 批量删除设备列
      * 批量删除设备列
-     *
+     * 
      * @param ids 需要删除的设备列主键集合
      * @param ids 需要删除的设备列主键集合
      * @return 结果
      * @return 结果
      */
      */
@@ -127,7 +119,7 @@ public interface ITDeviceListService {
 
 
     /**
     /**
      * 删除设备列信息
      * 删除设备列信息
-     *
+     * 
      * @param id 设备列主键
      * @param id 设备列主键
      * @return 结果
      * @return 结果
      */
      */

+ 57 - 126
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceListServiceImpl.java

@@ -17,16 +17,16 @@ import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.TDeviceListMapper;
 import com.ruoyi.system.mapper.TDeviceListMapper;
 import com.ruoyi.system.domain.TDeviceList;
 import com.ruoyi.system.domain.TDeviceList;
 import com.ruoyi.system.service.ITDeviceListService;
 import com.ruoyi.system.service.ITDeviceListService;
-import org.springframework.transaction.annotation.Transactional;
 
 
 /**
 /**
  * 设备列Service业务层处理
  * 设备列Service业务层处理
- *
+ * 
  * @author zhengjie
  * @author zhengjie
  * @date 2023-08-30
  * @date 2023-08-30
  */
  */
 @Service
 @Service
-public class TDeviceListServiceImpl implements ITDeviceListService {
+public class TDeviceListServiceImpl implements ITDeviceListService 
+{
     @Autowired
     @Autowired
     private TDeviceListMapper tDeviceListMapper;
     private TDeviceListMapper tDeviceListMapper;
     @Autowired
     @Autowired
@@ -36,23 +36,25 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
 
 
     /**
     /**
      * 查询设备列
      * 查询设备列
-     *
+     * 
      * @param id 设备列主键
      * @param id 设备列主键
      * @return 设备列
      * @return 设备列
      */
      */
     @Override
     @Override
-    public TDeviceList selectTDeviceListById(Integer id) {
+    public TDeviceList selectTDeviceListById(Integer id)
+    {
         return tDeviceListMapper.selectTDeviceListById(id);
         return tDeviceListMapper.selectTDeviceListById(id);
     }
     }
 
 
     /**
     /**
      * 查询设备列列表
      * 查询设备列列表
-     *
+     * 
      * @param tDeviceList 设备列
      * @param tDeviceList 设备列
      * @return 设备列
      * @return 设备列
      */
      */
     @Override
     @Override
-    public List<TDeviceList> selectTDeviceListList(TDeviceList tDeviceList) {
+    public List<TDeviceList> selectTDeviceListList(TDeviceList tDeviceList)
+    {
         return tDeviceListMapper.selectTDeviceListList(tDeviceList);
         return tDeviceListMapper.selectTDeviceListList(tDeviceList);
     }
     }
 
 
@@ -93,19 +95,19 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
 
 
     /**
     /**
      * 新增设备列
      * 新增设备列
-     *
+     * 
      * @param tDeviceList 设备列
      * @param tDeviceList 设备列
      * @return 结果
      * @return 结果
      */
      */
-    @Transactional
     @Override
     @Override
-    public int insertTDeviceList(TDeviceList tDeviceList) {
+    public int insertTDeviceList(TDeviceList tDeviceList)
+    {
         TFacility tFacility = new TFacility();
         TFacility tFacility = new TFacility();
-        if (StringUtils.isNotNull(tDeviceList.getDeviceId())) {
+        if (StringUtils.isNotNull(tDeviceList.getDeviceId())){
             tFacility.setCode(tDeviceList.getDeviceId());
             tFacility.setCode(tDeviceList.getDeviceId());
-        } else if (StringUtils.isNotNull(tDeviceList.getSimCode())) {
+        }else if (StringUtils.isNotNull(tDeviceList.getSimCode())){
             tFacility.setTelno(tDeviceList.getSimCode());
             tFacility.setTelno(tDeviceList.getSimCode());
-        } else if (StringUtils.isNotNull(tDeviceList.getSerialNumber())) {
+        }else if (StringUtils.isNotNull(tDeviceList.getSerialNumber())){
             tFacility.setIccid(tDeviceList.getSerialNumber());
             tFacility.setIccid(tDeviceList.getSerialNumber());
         }
         }
         tFacility.setCreateTime(DateUtils.getNowDate());
         tFacility.setCreateTime(DateUtils.getNowDate());
@@ -116,163 +118,92 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
 
 
     /**
     /**
      * 修改设备列
      * 修改设备列
-     *
+     * 
      * @param tDeviceList 设备列
      * @param tDeviceList 设备列
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int updateTDeviceList(TDeviceList tDeviceList) {
+    public int updateTDeviceList(TDeviceList tDeviceList)
+    {
         return tDeviceListMapper.updateTDeviceList(tDeviceList);
         return tDeviceListMapper.updateTDeviceList(tDeviceList);
     }
     }
 
 
     /**
     /**
      * 批量删除设备列
      * 批量删除设备列
-     *
+     * 
      * @param ids 需要删除的设备列主键
      * @param ids 需要删除的设备列主键
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int deleteTDeviceListByIds(Integer[] ids) {
+    public int deleteTDeviceListByIds(Integer[] ids)
+    {
         return tDeviceListMapper.deleteTDeviceListByIds(ids);
         return tDeviceListMapper.deleteTDeviceListByIds(ids);
     }
     }
 
 
     /**
     /**
      * 删除设备列信息
      * 删除设备列信息
-     *
+     * 
      * @param id 设备列主键
      * @param id 设备列主键
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int deleteTDeviceListById(Integer id) {
+    public int deleteTDeviceListById(Integer id)
+    {
         return tDeviceListMapper.deleteTDeviceListById(id);
         return tDeviceListMapper.deleteTDeviceListById(id);
     }
     }
 
 
     @Override
     @Override
     public String importTDeviceList(List<TDeviceList> tDeviceLists) {
     public String importTDeviceList(List<TDeviceList> tDeviceLists) {
 
 
-        if (StringUtils.isNull(tDeviceLists) || tDeviceLists.size() == 0) {
+        if (StringUtils.isNull(tDeviceLists) || tDeviceLists.size() == 0)
+        {
             throw new ServiceException("导入设备列表信息数据不能为空!");
             throw new ServiceException("导入设备列表信息数据不能为空!");
         }
         }
         int successNum = 0;
         int successNum = 0;
         int failureNum = 0;
         int failureNum = 0;
         StringBuilder successMsg = new StringBuilder();
         StringBuilder successMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
-        for (TDeviceList tDeviceList : tDeviceLists) {
-            try {
+        for (TDeviceList tDeviceList : tDeviceLists)
+        {
+            try
+            {
                 TUserProfile user = tUserProfileMapper.selectTUserProfileBySfzId(tDeviceList.getSfzid());
                 TUserProfile user = tUserProfileMapper.selectTUserProfileBySfzId(tDeviceList.getSfzid());
                 TDeviceList device = tDeviceListMapper.selectTDeviceListListByDeviceId(tDeviceList.getDeviceId());
                 TDeviceList device = tDeviceListMapper.selectTDeviceListListByDeviceId(tDeviceList.getDeviceId());
-                if (StringUtils.isNotNull(user) && StringUtils.isNull(device)) {
+                if (StringUtils.isNotNull(user) && StringUtils.isNull(device))
+                {
                     tDeviceList.setUserid(user.getId());
                     tDeviceList.setUserid(user.getId());
                     tDeviceList.setSfzid(user.getSfzid());
                     tDeviceList.setSfzid(user.getSfzid());
                     tDeviceList.setTelno(user.getTelOne());
                     tDeviceList.setTelno(user.getTelOne());
                     this.insertTDeviceList(tDeviceList);
                     this.insertTDeviceList(tDeviceList);
                     successNum++;
                     successNum++;
                     successMsg.append("<br/>" + successNum + "设备列表信息" + " 导入成功");
                     successMsg.append("<br/>" + successNum + "设备列表信息" + " 导入成功");
-                } else {
+                }
+                else
+                {
                     failureNum++;
                     failureNum++;
                     failureMsg.append("<br/>" + failureNum + "设备列表信息" + " 信息不完整");
                     failureMsg.append("<br/>" + failureNum + "设备列表信息" + " 信息不完整");
                 }
                 }
-            } catch (Exception e) {
+            }
+            catch (Exception e)
+            {
                 failureNum++;
                 failureNum++;
                 String msg = "<br/>" + failureNum + "设备列表信息" + " 导入失败:";
                 String msg = "<br/>" + failureNum + "设备列表信息" + " 导入失败:";
                 failureMsg.append(msg + e.getMessage());
                 failureMsg.append(msg + e.getMessage());
             }
             }
         }
         }
-        if (failureNum > 0) {
+        if (failureNum > 0)
+        {
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             throw new ServiceException(failureMsg.toString());
             throw new ServiceException(failureMsg.toString());
-        } else {
+        }
+        else
+        {
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
         }
         }
         return successMsg.toString();
         return successMsg.toString();
 
 
     }
     }
 
 
-    @Transactional
-    @Override
-    public String importTDeviceListV2(List<TDeviceList> tDeviceLists) {
-        if (tDeviceLists == null || tDeviceLists.isEmpty()) {
-            throw new ServiceException("导入设备列表信息数据不能为空!");
-        }
-        //批量导入设备数据
-        for (TDeviceList deviceListEntity : tDeviceLists) {
-            //判断提交数据格式是否正确
-            if (deviceListEntity.getSfzid() == null || deviceListEntity.getSfzid().isEmpty()) {
-                throw new ServiceException("导入设备数信息身份证号格式异常!");
-            }
-            //根据身份证号查询数据库中的用户信息
-            TUserProfile user = tUserProfileMapper.selectTUserProfileBySfzId(deviceListEntity.getSfzid());
-            if (user == null) {
-                //如果表中有该用户则提示
-                StringBuilder stringBuilder = new StringBuilder();
-                stringBuilder.append("导入设备数信息未匹配到用户");
-                //如果有设备标识ID,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getDeviceId())) {
-                    stringBuilder.append(", 设备标识ID:" + deviceListEntity.getDeviceId());
-                }
-                //如果有设备标识ID,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getName())) {
-                    stringBuilder.append(", 用户名:" + deviceListEntity.getName());
-                }
-                //如果有身份证号,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getSfzid())) {
-                    stringBuilder.append(", 身份证号:" + deviceListEntity.getSfzid());
-                }
-                stringBuilder.append("!");
-                throw new ServiceException(stringBuilder.toString());
-            }
-            //根据设备ID查询数据库中的设备信息
-            List<TFacility> facilityList = tFacilityMapper.selectTDeviceListListByDeviceId(deviceListEntity.getDeviceId());
-            if (facilityList != null && !facilityList.isEmpty()) {
-                //如果表中有该用户则提示
-                StringBuilder stringBuilder = new StringBuilder();
-                stringBuilder.append("导入设备信息已存在");
-                //如果有设备标识ID,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getDeviceId())) {
-                    stringBuilder.append(", 设备标识ID:" + deviceListEntity.getDeviceId());
-                }
-                //如果有设备标识ID,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getName())) {
-                    stringBuilder.append(", 用户名:" + deviceListEntity.getName());
-                }
-                //如果有身份证号,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getSfzid())) {
-                    stringBuilder.append(", 身份证号:" + deviceListEntity.getSfzid());
-                }
-                stringBuilder.append("!");
-                throw new ServiceException(stringBuilder.toString());
-            }
-            //根据设备ID查询数据库中的设备信息
-            TDeviceList device = tDeviceListMapper.selectTDeviceListListByDeviceId(deviceListEntity.getDeviceId());
-            if (device != null) {
-                //如果表中有该用户则提示
-                StringBuilder stringBuilder = new StringBuilder();
-                stringBuilder.append("导入设备信息已存在");
-                //如果有设备标识ID,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getDeviceId())) {
-                    stringBuilder.append(", 设备标识ID:" + deviceListEntity.getDeviceId());
-                }
-                //如果有设备标识ID,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getName())) {
-                    stringBuilder.append(", 用户名:" + deviceListEntity.getName());
-                }
-                //如果有身份证号,则提示
-                if (!StringUtils.isEmpty(deviceListEntity.getSfzid())) {
-                    stringBuilder.append(", 身份证号:" + deviceListEntity.getSfzid());
-                }
-                stringBuilder.append("!");
-                throw new ServiceException(stringBuilder.toString());
-            }
-            deviceListEntity.setUserid(user.getId());
-            deviceListEntity.setSfzid(user.getSfzid());
-            deviceListEntity.setTelno(user.getTelOne());
-            this.insertTDeviceList(deviceListEntity);
-        }
-        StringBuilder successMsg = new StringBuilder();
-        successMsg.append("恭喜您,数据已全部导入成功!共 " + tDeviceLists.size() + " 条,数据如下:");
-        return successMsg.toString();
-    }
-
     /**
     /**
      * 判断报警信息
      * 判断报警信息
      *
      *
@@ -280,8 +211,8 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public String checkMessage(Integer alarm_type) {
-        switch (alarm_type) {
+    public String checkMessage(Integer alarm_type){
+        switch (alarm_type){
             case 16:
             case 16:
                 return "SOS报警";
                 return "SOS报警";
             case 17:
             case 17:
@@ -305,39 +236,39 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
 
 
     @Override
     @Override
     public int deviceValue(CallPoliceDto callPoliceDto) {
     public int deviceValue(CallPoliceDto callPoliceDto) {
-        if (StringUtils.isNotNull(callPoliceDto)) {
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_high_max())) {
+        if (StringUtils.isNotNull(callPoliceDto)){
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_high_max())){
                 tDeviceListMapper.updateTSettingshouhuan_blood_high_max(callPoliceDto.getShouhuan_blood_high_max());
                 tDeviceListMapper.updateTSettingshouhuan_blood_high_max(callPoliceDto.getShouhuan_blood_high_max());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_high_min())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_high_min())){
                 tDeviceListMapper.updateTSettingshouhuan_blood_high_min(callPoliceDto.getShouhuan_blood_high_min());
                 tDeviceListMapper.updateTSettingshouhuan_blood_high_min(callPoliceDto.getShouhuan_blood_high_min());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_low_max())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_low_max())){
                 tDeviceListMapper.updateTSettingshouhuan_blood_low_max(callPoliceDto.getShouhuan_blood_low_max());
                 tDeviceListMapper.updateTSettingshouhuan_blood_low_max(callPoliceDto.getShouhuan_blood_low_max());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_low_min())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_blood_low_min())){
                 tDeviceListMapper.updateTSettingshouhuan_blood_low_min(callPoliceDto.getShouhuan_blood_low_min());
                 tDeviceListMapper.updateTSettingshouhuan_blood_low_min(callPoliceDto.getShouhuan_blood_low_min());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_body_max())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_body_max())){
                 tDeviceListMapper.updateTSettingshouhuan_body_max(callPoliceDto.getShouhuan_body_max());
                 tDeviceListMapper.updateTSettingshouhuan_body_max(callPoliceDto.getShouhuan_body_max());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_body_min())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_body_min())){
                 tDeviceListMapper.updateTSettingshouhuan_body_min(callPoliceDto.getShouhuan_body_min());
                 tDeviceListMapper.updateTSettingshouhuan_body_min(callPoliceDto.getShouhuan_body_min());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_oxygen_max())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_oxygen_max())){
                 tDeviceListMapper.updateTSettingshouhuan_oxygen_max(callPoliceDto.getShouhuan_oxygen_max());
                 tDeviceListMapper.updateTSettingshouhuan_oxygen_max(callPoliceDto.getShouhuan_oxygen_max());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_oxygen_min())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_oxygen_min())){
                 tDeviceListMapper.updateTSettingshouhuan_oxygen_min(callPoliceDto.getShouhuan_oxygen_min());
                 tDeviceListMapper.updateTSettingshouhuan_oxygen_min(callPoliceDto.getShouhuan_oxygen_min());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_heart_max())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_heart_max())){
                 tDeviceListMapper.updateTSettingshouhuan_heart_max(callPoliceDto.getShouhuan_heart_max());
                 tDeviceListMapper.updateTSettingshouhuan_heart_max(callPoliceDto.getShouhuan_heart_max());
             }
             }
-            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_heart_min())) {
+            if (StringUtils.isNotNull(callPoliceDto.getShouhuan_heart_min())){
                 tDeviceListMapper.updateTSettingshouhuan_heart_min(callPoliceDto.getShouhuan_heart_min());
                 tDeviceListMapper.updateTSettingshouhuan_heart_min(callPoliceDto.getShouhuan_heart_min());
             }
             }
             return 1;
             return 1;
-        } else {
+        }else{
             return 0;
             return 0;
         }
         }
     }
     }

+ 28 - 44
ruoyi-system/src/main/resources/mapper/system/TFacilityMapper.xml

@@ -1,58 +1,44 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
 <!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.system.mapper.TFacilityMapper">
 <mapper namespace="com.ruoyi.system.mapper.TFacilityMapper">
-
+    
     <resultMap type="TFacility" id="TFacilityResult">
     <resultMap type="TFacility" id="TFacilityResult">
-        <result property="id" column="id"/>
-        <result property="kind" column="kind"/>
-        <result property="code" column="code"/>
-        <result property="telno" column="telno"/>
-        <result property="comCode" column="com_code"/>
-        <result property="createTime" column="createtime"/>
-        <result property="status" column="status"/>
-        <result property="iccid" column="iccid"/>
-        <result property="puk" column="puk"/>
+        <result property="id"    column="id"    />
+        <result property="kind"    column="kind"    />
+        <result property="code"    column="code"    />
+        <result property="telno"    column="telno"    />
+        <result property="comCode"    column="com_code"    />
+        <result property="createTime"    column="createtime"    />
+        <result property="status"    column="status"    />
+        <result property="iccid"    column="iccid"    />
+        <result property="puk"    column="puk"    />
     </resultMap>
     </resultMap>
 
 
     <sql id="selectTFacilityVo">
     <sql id="selectTFacilityVo">
-        select id,
-               kind,
-               code,
-               telno,
-               com_code,
-               createtime,
-               status,
-               iccid,
-               puk
-        from t_facility
+        select id, kind, code, telno, com_code, createtime, status, iccid, puk from t_facility
     </sql>
     </sql>
 
 
     <select id="selectTFacilityList" parameterType="TFacility" resultMap="TFacilityResult">
     <select id="selectTFacilityList" parameterType="TFacility" resultMap="TFacilityResult">
         <include refid="selectTFacilityVo"/>
         <include refid="selectTFacilityVo"/>
-        <where>
-            <if test="kind != null ">and kind = #{kind}</if>
-            <if test="code != null  and code != ''">and code = #{code}</if>
-            <if test="telno != null  and telno != ''">and telno = #{telno}</if>
-            <if test="comCode != null  and comCode != ''">and com_code = #{comCode}</if>
-            <if test="createTime != null ">and createtime = #{createTime}</if>
-            <if test="status != null ">and status = #{status}</if>
-            <if test="iccid != null ">and iccid = #{iccid}</if>
-            <if test="puk != null ">and puk = #{puk}</if>
+        <where>  
+            <if test="kind != null "> and kind = #{kind}</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="telno != null  and telno != ''"> and telno = #{telno}</if>
+            <if test="comCode != null  and comCode != ''"> and com_code = #{comCode}</if>
+            <if test="createTime != null "> and createtime = #{createTime}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="iccid != null "> and iccid = #{iccid}</if>
+            <if test="puk != null "> and puk = #{puk}</if>
         </where>
         </where>
     </select>
     </select>
-
+    
     <select id="selectTFacilityById" parameterType="Long" resultMap="TFacilityResult">
     <select id="selectTFacilityById" parameterType="Long" resultMap="TFacilityResult">
         <include refid="selectTFacilityVo"/>
         <include refid="selectTFacilityVo"/>
         where id = #{id}
         where id = #{id}
     </select>
     </select>
-
-    <select id="selectTDeviceListListByDeviceId" parameterType="string" resultMap="TFacilityResult">
-        <include refid="selectTFacilityVo"/>
-        where code = #{code}
-    </select>
-
+        
     <insert id="insertTFacility" parameterType="TFacility" useGeneratedKeys="true" keyProperty="id">
     <insert id="insertTFacility" parameterType="TFacility" useGeneratedKeys="true" keyProperty="id">
         insert into t_facility
         insert into t_facility
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -64,7 +50,7 @@
             <if test="status != null">status,</if>
             <if test="status != null">status,</if>
             <if test="iccid != null">iccid,</if>
             <if test="iccid != null">iccid,</if>
             <if test="puk != null">puk,</if>
             <if test="puk != null">puk,</if>
-        </trim>
+         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="kind != null">#{kind},</if>
             <if test="kind != null">#{kind},</if>
             <if test="code != null">#{code},</if>
             <if test="code != null">#{code},</if>
@@ -74,7 +60,7 @@
             <if test="status != null">#{status},</if>
             <if test="status != null">#{status},</if>
             <if test="iccid != null">#{iccid},</if>
             <if test="iccid != null">#{iccid},</if>
             <if test="puk != null">#{puk},</if>
             <if test="puk != null">#{puk},</if>
-        </trim>
+         </trim>
     </insert>
     </insert>
 
 
     <update id="updateTFacility" parameterType="TFacility">
     <update id="updateTFacility" parameterType="TFacility">
@@ -93,13 +79,11 @@
     </update>
     </update>
 
 
     <delete id="deleteTFacilityById" parameterType="Long">
     <delete id="deleteTFacilityById" parameterType="Long">
-        delete
-        from t_facility
-        where id = #{id}
+        delete from t_facility where id = #{id}
     </delete>
     </delete>
 
 
     <delete id="deleteTFacilityByIds" parameterType="String">
     <delete id="deleteTFacilityByIds" parameterType="String">
-        delete from t_facility where id in
+        delete from t_facility where id in 
         <foreach item="id" collection="array" open="(" separator="," close=")">
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
             #{id}
         </foreach>
         </foreach>