Bläddra i källkod

智慧环卫垃圾桶接口,修复分页的一些问题

zhj 2 år sedan
förälder
incheckning
eff66afa3f

+ 89 - 0
src/main/java/com/welampiot/controller/TranshController.java

@@ -0,0 +1,89 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.dto.TranshInfoDTO;
+import com.welampiot.service.TranshInfoService;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.TranshInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * ClassName: TranshController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/7 - 11:13
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/api/transhController")
+public class TranshController {
+
+    @Autowired
+    private TranshInfoService transhInfoService;
+
+    @Autowired
+    private ToolUtils toolUtils;
+
+    /**
+     * 获取设备统计信息
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/data", method = RequestMethod.POST)
+    public BaseResult<TranshInfoDTO> data(HttpServletRequest request){
+        TranshInfoVO vo = transhInfoService.getTotalBySectionList(toolUtils.getSectionList(request));
+        return BaseResult.success(vo);
+    }
+
+    /**
+     * 获取设备信息列表
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/getList", method = RequestMethod.POST)
+    public BaseResult<TranshInfoDTO> getList(HttpServletRequest request){
+        Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
+        Integer page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        Integer count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+        String keywords = request.getParameter("keywords") == null ? "" : request.getParameter("keywords");
+
+        TranshInfoDTO dto = new TranshInfoDTO();
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setKeywords(keywords);
+        dto.setSectionList(toolUtils.getSectionList(request));
+
+        TranshInfoVO transhList = transhInfoService.getTranshList(dto,version);
+        return BaseResult.success(transhList);
+    }
+
+    /**
+     * 获取设备日志
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/historyList", method = RequestMethod.POST)
+    public BaseResult<TranshInfoDTO> historyList(HttpServletRequest request){
+        int id = request.getParameter("id") == null ? 0 : Integer.parseInt(request.getParameter("id"));
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+
+        TranshInfoDTO dto = new TranshInfoDTO();
+        dto.setId(id);
+        dto.setPage(count * (page - 1));
+        dto.setCount(count);
+        dto.setSectionList(toolUtils.getSectionList(request));
+
+        TranshInfoVO list = transhInfoService.getHistoryListByDTO(dto);
+        return BaseResult.success(list);
+    }
+}

+ 31 - 0
src/main/java/com/welampiot/dao/TranshInfoDao.java

@@ -0,0 +1,31 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.TranshInfoDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: TranshInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/7 - 11:00
+ * @Version: v1.0
+ */
+public interface TranshInfoDao {
+    Integer getTotalBySectionList(@Param("sectionList") List<TranshInfoDTO> sectionList);
+
+    Integer getOnlineTotalBySectionList(@Param("sectionList") List<TranshInfoDTO> sectionList);
+
+    Integer getAlarmTotalBySectionList(@Param("sectionList") List<TranshInfoDTO> sectionList);
+
+    Integer getNormalTotalBySectionList(@Param("sectionList") List<TranshInfoDTO> sectionList);
+
+    /** 获取设备信息列表 **/
+    List<TranshInfoDTO> getTranshListByDTO(TranshInfoDTO dto);
+
+    /** 获取设备日志 **/
+    List<TranshInfoDTO> getHistoryListByDTO(TranshInfoDTO dto);
+}

+ 128 - 0
src/main/java/com/welampiot/dto/TranshInfoDTO.java

@@ -0,0 +1,128 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: TranshInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/7 - 9:32
+ * @Version: v1.0
+ */
+@Data
+public class TranshInfoDTO implements Serializable {
+    /** 主键 **/
+    private Integer id;
+
+    /** 区、县id **/
+    private Integer areaId;
+
+    /** 路段(街道)id **/
+    private Integer sectionId;
+
+    /** 设备地址 **/
+    private String address;
+
+    /** 设备创建时间(0时区时间) **/
+    private String createTime;
+
+    /** 设备名称 **/
+    private String name;
+
+    /** 设备在线状态(0离线,1在线) **/
+    private Integer online;
+
+    /** 盖子打开角度 **/
+    private Integer angle;
+
+    /** 经度 **/
+    private Double longitude;
+
+    /** 纬度 **/
+    private Double latitude;
+
+    /** 距离 **/
+    private Float distance;
+
+    /** 温度 **/
+    private Integer temperature;
+    
+    /** 电量 **/
+    private Integer batT;
+
+    /** 设备状态信息更新时间(0时区时间) **/
+    private String updateTime;
+
+    /** 信号强度 **/
+    private Integer rssi;
+
+    /** 信号强度 **/
+    private Integer rsRp;
+
+    /** 信噪比 **/
+    private Integer snr;
+
+    /** 盖子打开状态(0 关。1 开) **/
+    private Integer state;
+
+    /** 垃圾桶状态(0空,1满)**/
+    private Integer full;
+
+    /** 设备注册地址 **/
+    private String deviceId;
+
+    /** 设备注册状态(0 未注册,1 已注册)**/
+    private Integer status;
+
+    /** 设备总数 **/
+    private Integer total;
+
+    /** 报警状态(0 正常,1 报警)**/
+    private Integer alarmStatus;
+
+    /** 报警信息内容 **/
+    private String alarmInfo;
+
+    /** 设备位置信息 **/
+    private String location;
+
+    /** 路段名 **/
+    private String section;
+
+    /** 区域名 **/
+    private String area;
+
+    private String chineseName;
+
+    private String englishName;
+
+    private String ruName;
+
+    /** 城市名 **/
+    private String city;
+
+    private String chCity;
+
+    private String ruCity;
+
+    private String enCity;
+
+    /** 时区 **/
+    private Integer timezone;
+
+    /** 获取路段id **/
+    private List<TranshInfoDTO> sectionList;
+
+    private Integer page;
+
+    private Integer count;
+
+    private String keywords;
+
+    private static final long serialVersionUID = 1L;
+}

+ 23 - 0
src/main/java/com/welampiot/service/TranshInfoService.java

@@ -0,0 +1,23 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.TranshInfoDTO;
+import com.welampiot.vo.TranshInfoVO;
+
+import java.util.List;
+
+/**
+ * ClassName: TranshInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/7 - 11:35
+ * @Version: v1.0
+ */
+public interface TranshInfoService {
+    TranshInfoVO getTotalBySectionList(List<TranshInfoDTO> sectionList);
+
+    TranshInfoVO getTranshList(TranshInfoDTO dto, Integer version);
+
+    TranshInfoVO getHistoryListByDTO(TranshInfoDTO dto);
+}

+ 11 - 2
src/main/java/com/welampiot/service/impl/ElectricBoxServiceImpl.java

@@ -7,6 +7,7 @@ import com.welampiot.vo.ElectricBoxReturnVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
@@ -41,12 +42,20 @@ public class ElectricBoxServiceImpl implements ElectricBoxService {
             if (electricBoxDTO.getInstallDate() == null){
                 electricBoxDTO.setInstallDate("");
             }else {
-                electricBoxDTO.setInstallDate(simpleDateFormat.format(electricBoxDTO.getInstallDate()));
+                try {
+                    electricBoxDTO.setInstallDate(simpleDateFormat.format(simpleDateFormat.parse(electricBoxDTO.getInstallDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
             }
             if (electricBoxDTO.getExpirationDate() == null){
                 electricBoxDTO.setExpirationDate("");
             }else {
-                electricBoxDTO.setExpirationDate(simpleDateFormat.format(electricBoxDTO.getExpirationDate()));
+                try {
+                    electricBoxDTO.setExpirationDate(simpleDateFormat.format(simpleDateFormat.parse(electricBoxDTO.getExpirationDate())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
             }
             if (electricBoxDTO.getOnlineCount() != null && electricBoxDTO.getOnlineCount() > 0){
                 electricBoxDTO.setOnline(1);

+ 243 - 0
src/main/java/com/welampiot/service/impl/TranshInfoServiceImpl.java

@@ -0,0 +1,243 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.TranshInfoDao;
+import com.welampiot.dto.TranshInfoDTO;
+import com.welampiot.service.TranshInfoService;
+import com.welampiot.vo.TranshInfoVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * ClassName: TranshInfoServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/7 - 11:36
+ * @Version: v1.0
+ */
+@Service
+public class TranshInfoServiceImpl implements TranshInfoService {
+
+    @Autowired
+    private TranshInfoDao transhInfoDao;
+
+    @Override
+    public TranshInfoVO getTotalBySectionList(List<TranshInfoDTO> sectionList) {
+        TranshInfoVO vo = new TranshInfoVO();
+        vo.setTotal(transhInfoDao.getTotalBySectionList(sectionList));
+        vo.setOnlineCount(transhInfoDao.getOnlineTotalBySectionList(sectionList));
+        vo.setAlarmCount(transhInfoDao.getAlarmTotalBySectionList(sectionList));
+        vo.setNormalCount(transhInfoDao.getNormalTotalBySectionList(sectionList));
+        return vo;
+    }
+
+    @Override
+    public TranshInfoVO getTranshList(TranshInfoDTO dto, Integer version) {
+        TranshInfoVO vo = new TranshInfoVO();
+        List<TranshInfoDTO> transhList = transhInfoDao.getTranshListByDTO(dto);
+        List<TranshInfoDTO> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        transhList.forEach(transhInfoDTO ->{
+            //网络状态:0 离线,1 在线
+            if (transhInfoDTO.getOnline() != null && transhInfoDTO.getOnline() == 1){
+                transhInfoDTO.setOnline(1);
+            }else {
+                transhInfoDTO.setOnline(0);
+            }
+            //设备注册状态
+            if (transhInfoDTO.getDeviceId() != null && !transhInfoDTO.getDeviceId().equals("")){
+                transhInfoDTO.setStatus(1);
+            }else {
+                transhInfoDTO.setStatus(0);
+            }
+            //盖子打开状态:0 关,1 开
+            if (transhInfoDTO.getState() != null && transhInfoDTO.getState() == 1){
+                transhInfoDTO.setState(1);
+            }else {
+                transhInfoDTO.setState(0);
+            }
+            //垃圾桶是否满溢:0 空,1 满
+            if (transhInfoDTO.getFull() != null && transhInfoDTO.getFull() == 1){
+                transhInfoDTO.setFull(1);
+            }else {
+                transhInfoDTO.setFull(0);
+            }
+            //报警状态:0 正常,1 报警(前提是网络在线)
+            if (transhInfoDTO.getOnline() == 1){
+                if (transhInfoDTO.getState() == 1 || transhInfoDTO.getFull() == 1){
+                    transhInfoDTO.setAlarmStatus(1);
+                }else {
+                    transhInfoDTO.setAlarmStatus(0);
+                }
+            }
+            //报警信息内容
+            if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 1){
+                if (transhInfoDTO.getState() == 1 && transhInfoDTO.getFull() == 1){
+                    transhInfoDTO.setAlarmInfo("满溢告警,翻盖告警");
+                }else if (transhInfoDTO.getState() == 1 && transhInfoDTO.getFull() == 0){
+                    transhInfoDTO.setAlarmInfo("翻盖告警");
+                }else {
+                    transhInfoDTO.setAlarmInfo("满溢告警");
+                }
+            }else if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 0){
+                transhInfoDTO.setAlarmInfo("");
+            }
+            //数据更新时间
+            if (transhInfoDTO.getUpdateTime() != null && !transhInfoDTO.getUpdateTime().equals("")){
+                Date cmdTime;
+                try {
+                    cmdTime = simpleDateFormat.parse(transhInfoDTO.getUpdateTime());
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                //判断时区,为null默认东八区
+                long timezone = transhInfoDTO.getTimezone() == null ? 8 : transhInfoDTO.getTimezone();
+                long l = cmdTime.getTime() + timezone * 3600 * 1000;
+                cmdTime = new Date(l);
+                transhInfoDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }else {
+                transhInfoDTO.setUpdateTime("");
+            }
+            //设备创建时间
+            if (transhInfoDTO.getCreateTime() != null){
+                try {
+                    transhInfoDTO.setCreateTime(simpleDateFormat.format(simpleDateFormat.parse(transhInfoDTO.getCreateTime())));
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+            }else {
+                transhInfoDTO.setCreateTime("");
+            }
+            //获取设备位置信息
+            if (version == 0){
+                //获取区域的中文名称
+                if (transhInfoDTO.getChineseName() != null && !transhInfoDTO.getChineseName().equals("")){
+                    transhInfoDTO.setArea(transhInfoDTO.getChineseName());
+                }else {
+                    transhInfoDTO.setArea("");
+                }
+                //获取城市的中文名称
+                if (transhInfoDTO.getChCity() != null && !transhInfoDTO.getChCity().equals("")){
+                    transhInfoDTO.setCity(transhInfoDTO.getChCity());
+                }else {
+                    transhInfoDTO.setCity("");
+                }
+                //获取路段
+                if (transhInfoDTO.getSection() == null){
+                    transhInfoDTO.setSection("");
+                }
+                //组合设备位置名称:城市 + 区域 + 路段
+                transhInfoDTO.setLocation(transhInfoDTO.getCity() + " " + transhInfoDTO.getArea() + " " + transhInfoDTO.getSection());
+            }else if (version == 1){
+                //获取区域的英文名称
+                if (transhInfoDTO.getEnglishName() != null && !transhInfoDTO.getEnglishName().equals("")){
+                    transhInfoDTO.setArea(transhInfoDTO.getEnglishName());
+                }else {
+                    transhInfoDTO.setArea("");
+                }
+                //获取城市的英文名称
+                if (transhInfoDTO.getEnCity() != null && !transhInfoDTO.getEnCity().equals("")){
+                    transhInfoDTO.setCity(transhInfoDTO.getEnCity());
+                }else {
+                    transhInfoDTO.setCity("");
+                }
+                //获取路段
+                if (transhInfoDTO.getSection() == null){
+                    transhInfoDTO.setSection("");
+                }
+                //组合设备位置名称:城市 + 区域 + 路段
+                transhInfoDTO.setLocation(transhInfoDTO.getCity() + " " + transhInfoDTO.getArea() + " " + transhInfoDTO.getSection());
+            }else {
+                //获取区域的俄文名称
+                if (transhInfoDTO.getRuName() != null && !transhInfoDTO.getRuName().equals("")){
+                    transhInfoDTO.setArea(transhInfoDTO.getRuName());
+                }else {
+                    transhInfoDTO.setArea("");
+                }
+                //获取城市的俄文名称
+                if (transhInfoDTO.getRuCity() != null && !transhInfoDTO.getRuCity().equals("")){
+                    transhInfoDTO.setCity(transhInfoDTO.getRuCity());
+                }else {
+                    transhInfoDTO.setCity("");
+                }
+                //获取路段
+                if (transhInfoDTO.getSection() == null){
+                    transhInfoDTO.setSection("");
+                }
+                //组合设备位置名称:城市 + 区域 + 路段
+                transhInfoDTO.setLocation(transhInfoDTO.getCity() + " " + transhInfoDTO.getArea() + " " + transhInfoDTO.getSection());
+            }
+            list.add(transhInfoDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+
+    @Override
+    public TranshInfoVO getHistoryListByDTO(TranshInfoDTO dto) {
+        TranshInfoVO vo = new TranshInfoVO();
+        List<TranshInfoDTO> historyList = transhInfoDao.getHistoryListByDTO(dto);
+        List<TranshInfoDTO> list = new ArrayList<>();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        historyList.forEach(transhInfoDTO ->{
+            if (transhInfoDTO.getState() != null && transhInfoDTO.getState() == 1){
+                transhInfoDTO.setState(1);
+            }else {
+                transhInfoDTO.setState(0);
+            }
+            if (transhInfoDTO.getFull() != null && transhInfoDTO.getFull() == 1){
+                transhInfoDTO.setFull(1);
+            }else {
+                transhInfoDTO.setFull(0);
+            }
+            if (transhInfoDTO.getOnline() != null && transhInfoDTO.getOnline() == 1){
+                transhInfoDTO.setOnline(1);
+            }else {
+                transhInfoDTO.setOnline(0);
+            }
+            if (transhInfoDTO.getOnline() == 1){
+                if (transhInfoDTO.getFull() == 1 || transhInfoDTO.getState() == 1){
+                    transhInfoDTO.setAlarmStatus(1);
+                }else {
+                    transhInfoDTO.setAlarmStatus(0);
+                }
+            }
+            if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 1){
+                if (transhInfoDTO.getFull() == 1 && transhInfoDTO.getState() == 1){
+                    transhInfoDTO.setAlarmInfo("满溢告警,翻盖告警");
+                }else if (transhInfoDTO.getFull() == 1 && transhInfoDTO.getState() == 0){
+                    transhInfoDTO.setAlarmInfo("满溢告警");
+                }else {
+                    transhInfoDTO.setAlarmInfo("翻盖告警");
+                }
+            }else if (transhInfoDTO.getAlarmStatus() != null && transhInfoDTO.getAlarmStatus() == 0){
+                transhInfoDTO.setAlarmInfo("");
+            }
+            if (transhInfoDTO.getUpdateTime() == null){
+                transhInfoDTO.setUpdateTime("");
+            }else {
+                Date cmdTime;
+                try {
+                    cmdTime = simpleDateFormat.parse(transhInfoDTO.getUpdateTime());
+                } catch (ParseException e) {
+                    throw new RuntimeException(e);
+                }
+                //判断时区,为null默认东八区
+                long timezone = transhInfoDTO.getTimezone() == null ? 8 : transhInfoDTO.getTimezone();
+                long l = cmdTime.getTime() + timezone * 3600 * 1000;
+                cmdTime = new Date(l);
+                transhInfoDTO.setUpdateTime(simpleDateFormat.format(cmdTime));
+            }
+            list.add(transhInfoDTO);
+        });
+        vo.setList(list);
+        return vo;
+    }
+}

+ 47 - 0
src/main/java/com/welampiot/vo/TranshInfoVO.java

@@ -0,0 +1,47 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.TranshInfoDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: TranshInfoVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/4/7 - 11:18
+ * @Version: v1.0
+ */
+@Data
+public class TranshInfoVO implements Serializable {
+    /** 设备总数 **/
+    private Integer total;
+
+    /** 正常设备总数 **/
+    private Integer normalCount;
+
+    /** 在线设备数 **/
+    private Integer onlineCount;
+
+    /** 报警数 **/
+    private Integer alarmCount;
+
+    /** 故障数 **/
+    private Integer faultCount;
+
+    /** 已完成故障数 **/
+    private Integer finishFaultCount;
+
+    /** 处理中故障数 **/
+    private Integer ingFaultCount;
+
+    /** 未指派故障数 **/
+    private Integer notFaultCount;
+
+    private List<TranshInfoDTO> list;
+
+    private static final long serialVersionUID = 1L;
+}

+ 1 - 1
src/main/resources/mapper/AirSwitchInfoMapper.xml

@@ -33,7 +33,7 @@
 
     <select id="getCountByBoxIdAndAlarmStatus" resultType="Integer" parameterType="Integer">
         select count(a.id) from air_switch_info a
-        where a.box_id = #{boxId} and a.alarm_status = 1 or a.alarm_statusB = 1 or a.alarm_statusC = 1
+        where a.box_id = #{boxId} and (a.alarm_status = 1 or a.alarm_statusB = 1 or a.alarm_statusC = 1)
     </select>
 
     <select id="getPolicyIdByBoxId" resultType="Integer" parameterType="Integer">

+ 1 - 1
src/main/resources/mapper/ElectricBoxMapper.xml

@@ -25,7 +25,7 @@
                     </foreach>
                 </if>
             order by convert(e.name using gbk) asc,e.id desc
-            <if test="page >= 0">
+            <if test="page >= 0 and count > 0">
                  limit #{page},#{count}
             </if>
     </select>

+ 1 - 1
src/main/resources/mapper/LoopMapper.xml

@@ -21,7 +21,7 @@
                 </foreach>
             </if>
             order by convert(l.name using gbk) asc,l.id desc
-            <if test="page >= 0">
+            <if test="page >= 0 and count > 0">
                 limit #{page},#{count}
             </if>
     </select>

+ 89 - 0
src/main/resources/mapper/TranshInfoMapper.xml

@@ -0,0 +1,89 @@
+<?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.welampiot.dao.TranshInfoDao">
+
+    <select id="getTotalBySectionList" resultType="Integer">
+        select count(t.id) as total from transh_info t
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where t.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getOnlineTotalBySectionList" resultType="Integer">
+        select count(t.id) as onlineTotal from transh_info t
+        where t.online = 1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and t.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getAlarmTotalBySectionList" resultType="Integer">
+        select count(t.id) as alarmTotal from transh_info t
+        where t.online = 1 and (t.full = 1 or t.state = 1)
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and t.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getNormalTotalBySectionList" resultType="Integer">
+        select count(t.id) as normalTotal from transh_info t
+        where t.full = 1 and t.state = 1 and t.online = 1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and t.sectionid in
+            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                #{dto}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getTranshListByDTO" resultType="TranshInfoDTO">
+        select t.id,t.name,t.areaid as areaId,t.sectionid as sectionId,t.address,
+               t.online,t.rssi,t.rsrp as rsRp,t.snr,t.distance,t.state,t.angle,
+               t.longitude,t.latitude,t.batt as batT,t.temperature,t.updateTime,
+               t.createTime,count(t.id) as total,t.full,t.deviceId,s.name as section,
+               g.english_name englishName,g.ru_name ruName,g.chinese_name chineseName,
+               p.chinese_name as chCity,p.english_name as enCity,p.ru_name as ruCity,s.timezone
+        from transh_info t left join section s on t.sectionid = s.id
+            left join global_location g on t.areaid = g.id
+            left join global_location p on g.pid = p.id
+        where 1=1 <if test="sectionList != null and !sectionList.isEmpty()">
+                    and t.sectionid in
+                    <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                        #{dto}
+                    </foreach>
+            </if>
+            <if test="keywords != null and keywords != ''">
+                and (t.name like '%${keywords}%' or t.address like '%${keywords}%')
+            </if>
+            order by convert(t.name using gbk) asc,t.id desc
+            <if test="page >= 0 and count > 0">
+                limit #{page},#{count}
+            </if>
+    </select>
+
+    <select id="getHistoryListByDTO" resultType="TranshInfoDTO">
+        select t.rssi,t.rsrp as rsRp,t.snr,t.distance,t.angle,t.state,t.batt as batT,
+               t.temperature,t.online,t.full,t.updateTime,count(t.id) as total,s.timezone
+        from transh_info t left join section s on t.sectionid = s.id
+        where t.id = #{id}
+            <if test="sectionList != null and !sectionList.isEmpty()">
+                and t.sectionid in
+                <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
+                    #{dto}
+                </foreach>
+            </if>
+            <if test="page >= 0 and count > 0">
+                limit #{page},#{count}
+            </if>
+    </select>
+
+</mapper>