查询摄像头优化

This commit is contained in:
wuweida 2022-05-10 13:54:13 +08:00
parent 5399a21056
commit 4d6a6a3649
4 changed files with 50 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package com.hisense.monitormanage.controller;
import com.hisense.monitormanage.dto.CameraChannelDto;
import com.hisense.monitormanage.dto.ChannelLabelDto;
import com.hisense.monitormanage.dto.ChengguanDto;
import com.hisense.monitormanage.dto.ScenicCameraDto;
@ -9,13 +10,9 @@ import com.hisense.monitormanage.service.MonitorService;
import com.hisense.monitormanage.service.SedimentTrailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Method;
import java.time.Clock;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -101,9 +98,26 @@ public class Controller {
* @return
*/
@RequestMapping("selectAll")
public Result selectAll(CameraChannel cameraChannel){
public Result selectAll(CameraChannel cameraChannel,Integer page,Integer pageSize){
List<CameraChannel> list = cameraChannelMapper.selectAll(cameraChannel);
List<CameraChannelDto> list = cameraChannelMapper.selectAll(cameraChannel,page,pageSize);
Result success = Result.success(list);
return success;
}
/**
* 根据channelId查询摄像头详细信息
* @param channelId
* @return
*/
@RequestMapping("selectByChannelId")
public Result selectByChannelId(String channelId){
List<CameraChannel> list = cameraChannelMapper.selectByChannelId(channelId);
Result success = Result.success(list);

View File

@ -0,0 +1,14 @@
package com.hisense.monitormanage.dto;
import lombok.Data;
@Data
public class CameraChannelDto {
private String channelCode;
private String gpsX;
private String gpsY;
}

View File

@ -1,6 +1,7 @@
package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.dto.CameraChannelDto;
import com.hisense.monitormanage.dto.ChannelLabelDto;
import com.hisense.monitormanage.dto.ChengguanDto;
import com.hisense.monitormanage.entity.CameraChannel;
@ -12,9 +13,11 @@ import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
@Select("select c.* from t_camera_channel c where (c.gps_x NOT IN('0.0','0','') " +
"OR c.gps_y NOT IN('0.0','0','')) AND c.status != 0")
List<CameraChannel> selectAll(CameraChannel cameraChannel);
List<CameraChannelDto> selectAll(CameraChannel cameraChannel,@Param("page") Integer page,@Param("pageSize") Integer pageSize);
@Select("select * from t_camera_channel where channel_id = #{channelId}")
List<CameraChannel> selectByChannelId(@Param("channelId") String channelId);
@Select("select * from t_camera_channel where parent_id = #{parentId}")
List<CameraChannel> selectByParentId(@Param("parentId") String parentId);
@ -28,10 +31,10 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
@Select("select * from t_label")
List<Label> selectAllLabel(Label label);
@Select("select * from t_label where label_name like concat('%',${labelName},'%')")
@Select("select * from t_label where label_name like concat('%',#{labelName},'%')")
List<Label> selectByLabelName(String labelName);
@Select("select * from t_camera_channel where channel_name like concat('%',${channelName},'%')")
@Select("select * from t_camera_channel where channel_name like concat('%',#{channelName},'%')")
List<CameraChannel> selectByChannelName(String channelName);

View File

@ -9,4 +9,12 @@
</update>
<select id="selectAll" resultType="com.hisense.monitormanage.dto.CameraChannelDto">
select c.* from t_camera_channel c
where (c.gps_x NOT IN('0.0','0','','-1000.0') OR c.gps_y NOT IN('0.0','0','','-1000.0'))
AND c.status != 0 order by channel_id desc
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
</select>
</mapper>