Просмотр исходного кода

编辑删除噪声监控设备、灯杆列表概览数据、故障列表、获取故障数

zhj 2 лет назад
Родитель
Сommit
4dc69cc28a
21 измененных файлов с 387 добавлено и 9 удалено
  1. 1 0
      src/main/java/com/welampiot/common/InterfaceResultEnum.java
  2. 60 0
      src/main/java/com/welampiot/controller/NewLampPoleController.java
  3. 74 8
      src/main/java/com/welampiot/controller/NoiseDevInfoController.java
  4. 2 0
      src/main/java/com/welampiot/dao/AllAlarmInfoLogDao.java
  5. 4 0
      src/main/java/com/welampiot/dao/LampPoleDao.java
  6. 9 0
      src/main/java/com/welampiot/dao/NoiseDevInfoDao.java
  7. 2 0
      src/main/java/com/welampiot/dao/NoiseDevInfoLogDao.java
  8. 4 0
      src/main/java/com/welampiot/dto/NoiseDevInfoDTO.java
  9. 2 0
      src/main/java/com/welampiot/service/AllAlarmInfoLogService.java
  10. 4 0
      src/main/java/com/welampiot/service/LampPoleService.java
  11. 2 0
      src/main/java/com/welampiot/service/NoiseDevInfoLogService.java
  12. 8 0
      src/main/java/com/welampiot/service/NoiseDevInfoService.java
  13. 5 0
      src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java
  14. 20 0
      src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java
  15. 5 0
      src/main/java/com/welampiot/service/impl/NoiseDevInfoLogServiceImpl.java
  16. 20 0
      src/main/java/com/welampiot/service/impl/NoiseDevInfoServiceImpl.java
  17. 5 0
      src/main/java/com/welampiot/vo/LampPoleVO.java
  18. 17 0
      src/main/resources/mapper/AllAlarmInfoLogMapper.xml
  19. 85 1
      src/main/resources/mapper/LampPoleMapper.xml
  20. 6 0
      src/main/resources/mapper/NoiseDevInfoLogMapper.xml
  21. 52 0
      src/main/resources/mapper/NoiseDevInfoMapper.xml

+ 1 - 0
src/main/java/com/welampiot/common/InterfaceResultEnum.java

@@ -130,6 +130,7 @@ public enum InterfaceResultEnum {
     EMAIL_FORMAT_ERROR("0323","邮箱格式错误","Mailbox format error","Ошибка в формате почтового ящика"),
     REPAIR_GROUP_UNIQUE_NAME("0324","维修分组名称重复","Maintenance group names are repeated","Название группы техобслуживания повторяется"),
     REPAIR_GROUP_UNIQUE_NUMBER("0325","维修分组编号重复","Maintenance group number are repeated","Номера групп техобслуживания повторяются"),
+    NOISE_NAME_UNIQUE_ERROR("0326","噪声监测设备名称重复","The name of the noise monitoring device is repeated","Название устройства мониторинга шума повторяется"),
     ;
     private String code;
     private String msgCn;

+ 60 - 0
src/main/java/com/welampiot/controller/NewLampPoleController.java

@@ -64,6 +64,8 @@ public class NewLampPoleController {
     private LampInfoLogNewService lampInfoLogNewService;
     @Autowired
     private VideoMonitorService videoMonitorService;
+    @Autowired
+    private AllAlarmInfoLogService allAlarmInfoLogService;
 
     @RequestMapping(value = "/info",method = RequestMethod.POST)
     public BaseResult info(HttpServletRequest request){
@@ -1125,4 +1127,62 @@ public class NewLampPoleController {
         vo.setUseCount(videoUsableTotal);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
     }
+
+    /**
+     * 灯杆列表数据概览
+     * @param request sectionList、areaId、sectionId
+     * @return 灯杆列表数据概览
+     */
+    @RequestMapping(value = "/lampPoleInfoData", method = RequestMethod.POST)
+    public BaseResult<?> lampPoleInfoData(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request, "areaId", 1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request, "sectionId", 1);
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setAreaId(areaId);
+        lampPoleVO.setSectionId(sectionId);
+        lampPoleVO.setSectionList(toolUtils.getSectionList(request));
+        Integer deviceCount = lampPoleService.getLampPoleInstallTotal(lampPoleVO);
+        Integer faultCount = lampPoleService.getLampPoleAlarmTotal(lampPoleVO);
+        Integer newCount = lampPoleService.getNewCreateLampPoleCount(lampPoleVO);
+        LampPoleVO vo = new LampPoleVO();
+        vo.setDeviceCount(deviceCount);
+        vo.setFaultCount(faultCount);
+        vo.setNewCount(newCount);
+        vo.setRunCount(deviceCount - faultCount);
+        vo.setDisableCount(0);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
+    }
+
+    /**
+     * 故障列表
+     * @param request sectionList
+     * @return 故障列表
+     */
+    @RequestMapping(value = "/alarmList", method = RequestMethod.POST)
+    public BaseResult<?> alarmList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        AllAlarmInfoLogVO allAlarmInfoLogVO = new AllAlarmInfoLogVO();
+        allAlarmInfoLogVO.setSectionList(toolUtils.getSectionList(request));
+        List<AllAlarmInfoLogDTO> list = allAlarmInfoLogService.getLampAlarmInfoList(allAlarmInfoLogVO);
+        AllAlarmInfoLogVO alarmInfoLogVO = new AllAlarmInfoLogVO();
+        alarmInfoLogVO.setList(list);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,alarmInfoLogVO);
+    }
+
+    /**
+     * 获取故障数
+     * @param request sectionList
+     * @return 获取故障数
+     */
+    @RequestMapping(value = "/getAlarmCount", method = RequestMethod.POST)
+    public BaseResult<?> getAlarmCount(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        LampPoleVO lampPoleVO = new LampPoleVO();
+        lampPoleVO.setSectionList(toolUtils.getSectionList(request));
+        Integer lampPoleAlarmTotal = lampPoleService.getLampPoleAlarmTotal(lampPoleVO);
+        LampPoleVO lampPoleVO1 = new LampPoleVO();
+        lampPoleVO1.setFaultCount(lampPoleAlarmTotal);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleVO1);
+    }
 }

+ 74 - 8
src/main/java/com/welampiot/controller/NoiseDevInfoController.java

@@ -2,8 +2,10 @@ package com.welampiot.controller;
 
 import com.welampiot.common.BaseResult;
 import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.LampPoleDTO;
 import com.welampiot.dto.NoiseDevInfoDTO;
 import com.welampiot.dto.NoiseDevInfoLogDTO;
+import com.welampiot.service.LampPoleService;
 import com.welampiot.service.NoiseDevInfoLogService;
 import com.welampiot.service.NoiseDevInfoService;
 import com.welampiot.utils.ToolUtils;
@@ -18,10 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.http.HttpServletRequest;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 /**
  * ClassName: NoiseDevInfoController
@@ -42,6 +41,9 @@ public class NoiseDevInfoController {
     @Autowired
     private NoiseDevInfoLogService noiseDevInfoLogService;
 
+    @Autowired
+    private LampPoleService lampPoleService;
+
     @Autowired
     private ToolUtils toolUtils;
 
@@ -52,7 +54,7 @@ public class NoiseDevInfoController {
      * @return
      */
     @RequestMapping(value = "/devList", method = RequestMethod.POST)
-    public BaseResult<NoiseDevInfoDTO> devList(HttpServletRequest request) {
+    public BaseResult<?> devList(HttpServletRequest request) {
         int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
         int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
         int online = request.getParameter("online") == null ? 0 : Integer.parseInt(request.getParameter("online"));
@@ -76,7 +78,7 @@ public class NoiseDevInfoController {
      * @return
      */
     @RequestMapping(value = "/devInfo", method = RequestMethod.POST)
-    public BaseResult<NoiseDevInfoDTO> devInfo(HttpServletRequest request) {
+    public BaseResult<?> devInfo(HttpServletRequest request) {
         int id = request.getParameter("id") == null || request.getParameter("id").length() == 0 ? 0 : Integer.parseInt(request.getParameter("id"));
         int version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
         if (id == 0) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL, version);
@@ -90,12 +92,11 @@ public class NoiseDevInfoController {
 
     /**
      * 获取噪声监控设备统计信息
-     *
      * @param request
      * @return
      */
     @RequestMapping(value = "/devStatistics", method = RequestMethod.POST)
-    public BaseResult devStatistics(HttpServletRequest request) throws ParseException {
+    public BaseResult<?> devStatistics(HttpServletRequest request) throws ParseException {
         Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
         Integer id = (Integer) toolUtils.getRequestContent(request, "id", 1);
         if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR, version);
@@ -173,4 +174,69 @@ public class NoiseDevInfoController {
         noiseDevInfoLogVO.setDateList(dateList);
         return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS, version, noiseDevInfoLogVO);
     }
+
+    /**
+     * 编辑噪声监控设备
+     * @param request 噪声监控设备属性
+     * @return 编辑噪声监控设备
+     */
+    @RequestMapping(value = "/devUpdate", method = RequestMethod.POST)
+    public BaseResult<?> devUpdate(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer id = (Integer) toolUtils.getRequestContent(request, "id", 1);
+        String name = (String) toolUtils.getRequestContent(request, "name", 2);
+        String address = (String) toolUtils.getRequestContent(request, "address", 2);
+        Integer serialPort = (Integer) toolUtils.getRequestContent(request, "serialPort", 1);
+        String warringValue1 = (String) toolUtils.getRequestContent(request, "warringValue1", 2);
+        String warringValue2 = (String) toolUtils.getRequestContent(request, "warringValue2", 2);
+        if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        if (name.length() == 0 || address.length() == 0 || warringValue1.length() == 0 || warringValue2.length() == 0)
+            return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
+        NoiseDevInfoDTO noiseDevInfoDTO = new NoiseDevInfoDTO();
+        noiseDevInfoDTO.setId(id);
+        noiseDevInfoDTO.setName(name);
+        NoiseDevInfoDTO dto = noiseDevInfoService.getNoiseLampPole(id);
+        noiseDevInfoDTO.setSectionId(dto.getSectionId());
+        if (noiseDevInfoService.checkNoiseName(noiseDevInfoDTO) > 0)
+            return toolUtils.response(InterfaceResultEnum.NOISE_NAME_UNIQUE_ERROR,version);
+        noiseDevInfoDTO.setAddress(address);
+        noiseDevInfoDTO.setSerialPort(serialPort);
+        noiseDevInfoDTO.setWarringValue1(Float.valueOf(warringValue1));
+        noiseDevInfoDTO.setWarringValue2(Float.valueOf(warringValue2));
+        long l = System.currentTimeMillis();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String format = simpleDateFormat.format(l);
+        noiseDevInfoDTO.setUpdateTime(format);
+        noiseDevInfoService.updateNoiseDevData(noiseDevInfoDTO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 删除噪声监控设备
+     * @param request 噪声监控设备id
+     * @return 删除噪声监控设备
+     */
+    @RequestMapping(value = "/devDel", method = RequestMethod.POST)
+    public BaseResult<?> devDel(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
+        Integer id = (Integer) toolUtils.getRequestContent(request, "id", 1);
+        if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        noiseDevInfoService.deleteNoiseData(id);
+        noiseDevInfoLogService.deleteNoiseLogData(id);
+        NoiseDevInfoDTO dto = noiseDevInfoService.getNoiseLampPole(id);
+        String devType = dto.getDevType();
+        String[] split = devType.split(",");
+        StringJoiner joiner = new StringJoiner(",");
+        for (String s : split) {
+            if (!s.equals("17")) {
+                joiner.add(s);
+            }
+        }
+        String newDevType = joiner.toString();
+        LampPoleDTO lampPoleDTO = new LampPoleDTO();
+        lampPoleDTO.setId(dto.getId());
+        lampPoleDTO.setDevType(newDevType);
+        lampPoleService.updateLampPoleDevType(lampPoleDTO);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
 }

+ 2 - 0
src/main/java/com/welampiot/dao/AllAlarmInfoLogDao.java

@@ -46,4 +46,6 @@ public interface AllAlarmInfoLogDao {
     void deleteAlarmData(@Param("id") Integer id);
 
     List<AllAlarmInfoLogDTO> getAlarmOperationList(AllAlarmInfoLogVO vo);
+
+    List<AllAlarmInfoLogDTO> getLampAlarmInfoList(AllAlarmInfoLogVO vo);
 }

+ 4 - 0
src/main/java/com/welampiot/dao/LampPoleDao.java

@@ -31,4 +31,8 @@ public interface LampPoleDao {
     Integer getSectionIdByLampPoleId(@Param("id") Integer id);
     void changeLampPoleLocationById(LampPoleDTO dto);
     LampPoleDTO getLampPoleDTOById(@Param("id") Integer id);
+    Integer getLampPoleAlarmTotal(LampPoleVO vo);
+    Integer getNewCreateLampPoleCount(LampPoleVO vo);
+    Integer getLampPoleInstallTotal(LampPoleVO vo);
+    void updateLampPoleDevType(LampPoleDTO dto);
 }

+ 9 - 0
src/main/java/com/welampiot/dao/NoiseDevInfoDao.java

@@ -1,6 +1,7 @@
 package com.welampiot.dao;
 
 import com.welampiot.dto.NoiseDevInfoDTO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -21,4 +22,12 @@ public interface NoiseDevInfoDao {
     Integer getOnlineTotalByNoiseDevInfoDTO(NoiseDevInfoDTO dto);
 
     NoiseDevInfoDTO getDevInfoByNoiseDevInfoDTO(NoiseDevInfoDTO dto);
+
+    void updateNoiseDevData(NoiseDevInfoDTO dto);
+
+    Integer checkNoiseName(NoiseDevInfoDTO dto);
+
+    NoiseDevInfoDTO getNoiseLampPole(@Param("id") Integer id);
+
+    void deleteNoiseData(@Param("id") Integer id);
 }

+ 2 - 0
src/main/java/com/welampiot/dao/NoiseDevInfoLogDao.java

@@ -18,4 +18,6 @@ public interface NoiseDevInfoLogDao {
     List<NoiseDevInfoLogDTO> getDevStatisticsByDTO(NoiseDevInfoLogDTO dto);
 
     Integer getTimezoneById(@Param("id") Integer id);
+
+    void deleteNoiseLogData(@Param("id") Integer id);
 }

+ 4 - 0
src/main/java/com/welampiot/dto/NoiseDevInfoDTO.java

@@ -67,6 +67,10 @@ public class NoiseDevInfoDTO implements Serializable {
 
     private String keyword;
 
+    private Integer sectionId;
+
+    private String devType;
+
     private List<Integer> sectionList;
 
     private static final long serialVersionUID = 1L;

+ 2 - 0
src/main/java/com/welampiot/service/AllAlarmInfoLogService.java

@@ -45,4 +45,6 @@ public interface AllAlarmInfoLogService {
     void deleteAlarmData(Integer id);
 
     List<AllAlarmInfoLogDTO> getAlarmOperationList(AllAlarmInfoLogVO vo);
+
+    List<AllAlarmInfoLogDTO> getLampAlarmInfoList(AllAlarmInfoLogVO vo);
 }

+ 4 - 0
src/main/java/com/welampiot/service/LampPoleService.java

@@ -25,4 +25,8 @@ public interface LampPoleService {
     Integer getSectionIdByLampPoleId(Integer id);
     void changeLampPoleLocationById(LampPoleDTO dto);
     LampPoleDTO getLampPoleDTOById(Integer id);
+    Integer getLampPoleAlarmTotal(LampPoleVO vo);
+    Integer getNewCreateLampPoleCount(LampPoleVO vo);
+    Integer getLampPoleInstallTotal(LampPoleVO vo);
+    void updateLampPoleDevType(LampPoleDTO dto);
 }

+ 2 - 0
src/main/java/com/welampiot/service/NoiseDevInfoLogService.java

@@ -17,4 +17,6 @@ public interface NoiseDevInfoLogService {
     List<NoiseDevInfoLogDTO> getDevStatisticsByDTO(NoiseDevInfoLogDTO dto);
 
     Integer getTimezoneById(Integer id);
+
+    void deleteNoiseLogData(Integer id);
 }

+ 8 - 0
src/main/java/com/welampiot/service/NoiseDevInfoService.java

@@ -16,4 +16,12 @@ public interface NoiseDevInfoService {
     NoiseDevInfoVO getDevListByNoiseDevInfoDTO(NoiseDevInfoDTO dto);
 
     NoiseDevInfoVO getDevInfoByNoiseDevInfoDTO(NoiseDevInfoDTO dto);
+
+    void updateNoiseDevData(NoiseDevInfoDTO dto);
+
+    Integer checkNoiseName(NoiseDevInfoDTO dto);
+
+    NoiseDevInfoDTO getNoiseLampPole(Integer id);
+
+    void deleteNoiseData(Integer id);
 }

+ 5 - 0
src/main/java/com/welampiot/service/impl/AllAlarmInfoLogServiceImpl.java

@@ -192,4 +192,9 @@ public class AllAlarmInfoLogServiceImpl implements AllAlarmInfoLogService {
     public List<AllAlarmInfoLogDTO> getAlarmOperationList(AllAlarmInfoLogVO vo) {
         return allAlarmInfoLogDao.getAlarmOperationList(vo);
     }
+
+    @Override
+    public List<AllAlarmInfoLogDTO> getLampAlarmInfoList(AllAlarmInfoLogVO vo) {
+        return allAlarmInfoLogDao.getLampAlarmInfoList(vo);
+    }
 }

+ 20 - 0
src/main/java/com/welampiot/service/impl/LampPoleServiceImpl.java

@@ -408,4 +408,24 @@ public class LampPoleServiceImpl implements LampPoleService {
     public LampPoleDTO getLampPoleDTOById(Integer id) {
         return lampPoleDao.getLampPoleDTOById(id);
     }
+
+    @Override
+    public Integer getLampPoleAlarmTotal(LampPoleVO vo) {
+        return lampPoleDao.getLampPoleAlarmTotal(vo);
+    }
+
+    @Override
+    public Integer getNewCreateLampPoleCount(LampPoleVO vo) {
+        return lampPoleDao.getNewCreateLampPoleCount(vo);
+    }
+
+    @Override
+    public Integer getLampPoleInstallTotal(LampPoleVO vo) {
+        return lampPoleDao.getLampPoleInstallTotal(vo);
+    }
+
+    @Override
+    public void updateLampPoleDevType(LampPoleDTO dto) {
+        lampPoleDao.updateLampPoleDevType(dto);
+    }
 }

+ 5 - 0
src/main/java/com/welampiot/service/impl/NoiseDevInfoLogServiceImpl.java

@@ -31,4 +31,9 @@ public class NoiseDevInfoLogServiceImpl implements NoiseDevInfoLogService {
     public Integer getTimezoneById(Integer id) {
         return noiseDevInfoLogDao.getTimezoneById(id);
     }
+
+    @Override
+    public void deleteNoiseLogData(Integer id) {
+        noiseDevInfoLogDao.deleteNoiseLogData(id);
+    }
 }

+ 20 - 0
src/main/java/com/welampiot/service/impl/NoiseDevInfoServiceImpl.java

@@ -132,4 +132,24 @@ public class NoiseDevInfoServiceImpl implements NoiseDevInfoService {
         BeanUtils.copyProperties(devInfoDTO,vo);
         return vo;
     }
+
+    @Override
+    public void updateNoiseDevData(NoiseDevInfoDTO dto) {
+        noiseDevInfoDao.updateNoiseDevData(dto);
+    }
+
+    @Override
+    public Integer checkNoiseName(NoiseDevInfoDTO dto) {
+        return noiseDevInfoDao.checkNoiseName(dto);
+    }
+
+    @Override
+    public NoiseDevInfoDTO getNoiseLampPole(Integer id) {
+        return noiseDevInfoDao.getNoiseLampPole(id);
+    }
+
+    @Override
+    public void deleteNoiseData(Integer id) {
+        noiseDevInfoDao.deleteNoiseData(id);
+    }
 }

+ 5 - 0
src/main/java/com/welampiot/vo/LampPoleVO.java

@@ -34,5 +34,10 @@ public class LampPoleVO implements Serializable {
     private Integer createId;
     private Float longitude;
     private Float latitude;
+    private Integer deviceCount; // 设备总数
+    private Integer runCount; // 运行数
+    private Integer faultCount; // 故障数
+    private Integer newCount; // 近期创建数
+    private Integer disableCount; // 禁用数
     private List<LampPoleDTO> list;
 }

+ 17 - 0
src/main/resources/mapper/AllAlarmInfoLogMapper.xml

@@ -874,4 +874,21 @@
         limit 100
     </select>
 
+    <select id="getLampAlarmInfoList" resultType="AllAlarmInfoLogDTO">
+        select
+            a.updatetime as updateTime,
+            lp.name,
+            a.stralarmtype as strAlarmType
+        from all_alarm_info_log a
+        left join lamp_pole lp on a.lampid = lp.id
+        where a.devType = 1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and a.sectionId in
+            <foreach collection="sectionList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        order by a.updatetime desc
+    </select>
+
 </mapper>

+ 85 - 1
src/main/resources/mapper/LampPoleMapper.xml

@@ -250,7 +250,7 @@
     <select id="getLampPoleInstallTotalByDTO" resultType="Integer">
         select count(l.id)
         from lamp_pole l
-        where 1=1
+        where l.id != 0
         <if test="sectionList != null and !sectionList.isEmpty()">
             and l.sectionid in
             <foreach collection="sectionList" item="item" open="(" separator="," close=")">
@@ -260,6 +260,9 @@
         <if test="areaId != null and areaId != 0">
             and l.areaid = #{areaId}
         </if>
+        <if test="sectionId != null and sectionId != 0">
+            and l.sectionid = #{sectionId}
+        </if>
     </select>
 
     <!-- 摄像头数量 -->
@@ -442,5 +445,86 @@
         from lamp_pole l
         where l.id = #{id}
     </select>
+
+    <select id="getLampPoleAlarmTotal" resultType="Integer">
+        select count(*) as total
+        from (SELECT
+                  l.id,
+                  a.id AS alarmId,
+                  MAX(a.updatetime) as maxTime,
+                  a.lampid,
+                  a.`status`,
+                  a.devType
+              FROM
+                  lamp_pole l
+              LEFT JOIN
+                  all_alarm_info_log a
+              ON a.lampid = l.id
+              WHERE
+                  a.devType = 1
+              AND a.`status` != 2
+              <if test="sectionList != null and !sectionList.isEmpty()">
+                  and l.sectionid in
+                  <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                    #{item}
+                  </foreach>
+              </if>
+              <if test="areaId != null and areaId != 0">
+                  and l.areaid = #{areaId}
+              </if>
+              <if test="sectionId != null and sectionId != 0">
+                  and l.sectionid = #{sectionId}
+              </if>
+              GROUP BY
+                  a.lampid
+              ORDER BY maxTime) a
+    </select>
+
+    <select id="getNewCreateLampPoleCount" resultType="Integer">
+        select count(*) as total
+        from lamp_pole l
+        where l.id != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and l.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="areaId != null and areaId != 0">
+            and l.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and l.sectionid = #{sectionId}
+        </if>
+        and l.createtime >= curdate() - interval 30 day
+    </select>
+
+    <!-- 灯杆安装总数 -->
+    <select id="getLampPoleInstallTotal" resultType="Integer">
+        select count(l.id)
+        from lamp_pole l
+        where l.id != 0
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and l.sectionid in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="areaId != null and areaId != 0">
+            and l.areaid = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and l.sectionid = #{sectionId}
+        </if>
+    </select>
+
+    <update id="updateLampPoleDevType" parameterType="LampPoleDTO">
+        update
+            lamp_pole l
+        set
+            l.devtype = #{devType}
+        where
+            l.id = #{id}
+    </update>
     
 </mapper>

+ 6 - 0
src/main/resources/mapper/NoiseDevInfoLogMapper.xml

@@ -20,5 +20,11 @@
                               left join section s on lp.sectionid = s.id
         where n.id = #{id}
     </select>
+
+    <delete id="deleteNoiseLogData">
+        delete
+        from noise_dev_info_log
+        where dev_id = #{id};
+    </delete>
     
 </mapper>

+ 52 - 0
src/main/resources/mapper/NoiseDevInfoMapper.xml

@@ -68,4 +68,56 @@
             </if>
     </select>
 
+    <update id="updateNoiseDevData" parameterType="NoiseDevInfoDTO">
+        UPDATE
+            noise_dev_info n
+        SET
+            n.name = #{name},
+            n.address = #{address},
+            n.serial_port = #{serialPort},
+            n.warring_value1 = #{warringValue1},
+            n.warring_value2 = #{warringValue2},
+            n.updatetime = #{updateTime}
+        WHERE
+            n.id = #{id}
+    </update>
+
+    <select id="checkNoiseName" resultType="Integer">
+        SELECT
+            COUNT(*)
+        FROM
+            noise_dev_info n
+        LEFT JOIN
+            lamp_pole lp
+        ON
+            lp.id = n.lamp_pole_id
+        WHERE
+            1=1
+            <if test="sectionId != null and sectionId != 0">
+                and lp.sectionid = #{sectionId}
+            </if>
+            <if test="name != null and name != ''">
+                and n.name = #{name}
+            </if>
+            <if test="id != null and id != 0">
+                and n.id != #{id}
+            </if>
+    </select>
+
+    <select id="getNoiseLampPole" resultType="NoiseDevInfoDTO">
+        select
+            lp.sectionid as sectionId,
+            lp.id,
+            lp.devtype as devType
+        from noise_dev_info n
+        left join lamp_pole lp on lp.id = n.lamp_pole_id
+        where n.id = #{id}
+    </select>
+
+    <delete id="deleteNoiseData">
+        delete
+        from noise_dev_info
+        where id = #{id};
+    </delete>
+
 </mapper>