设备列表查询新增多个区域信息
Signed-off-by: rain <1679827795@qq.com>
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "列表", notes = "传入isAreaSelect、areaId、status") |
| | | @ApiOperation(value = "列表", notes = "传入isAreaSelect、areaId、areaIds、status") |
| | | public R<List<FwDeviceVO>> list(@RequestParam(value = "isAreaSelect", required = false) Integer isAreaSelect, |
| | | @RequestParam(value = "areaId", required = false) Long areaId, |
| | | @RequestParam(value = "areaIds", required = false) String areaIds, |
| | | @RequestParam(value = "status", required = false) Integer status, |
| | | @RequestParam(value = "isTrack", required = false) Integer isTrack) { |
| | | List<FwDeviceEntity> list = fwDeviceService.selectFwDeviceList(isAreaSelect, areaId, status, isTrack); |
| | | List<Long> areaIdList = Func.toLongList(areaIds); |
| | | List<FwDeviceEntity> list = fwDeviceService.selectFwDeviceList(isAreaSelect, areaId, areaIdList, status, isTrack); |
| | | FwDeviceWrapper wrapper = FwDeviceWrapper.build(); |
| | | return R.data(list.stream().map(wrapper::entityVO).collect(Collectors.toList())); |
| | | } |
| | |
| | | * |
| | | * @param isAreaSelect |
| | | * @param areaId |
| | | * @param areaIds |
| | | * @return |
| | | */ |
| | | List<FwDeviceEntity> selectFwDeviceList(@Param("isAreaSelect") Integer isAreaSelect, @Param("areaId") Long areaId, |
| | | @Param("status") Integer status, @Param("isTrack") Integer isTrack); |
| | | @Param("areaIds") List<Long> areaIds, @Param("status") Integer status, @Param("isTrack") Integer isTrack); |
| | | |
| | | /** |
| | | * 根据多边形查询设备列表 |
| | |
| | | is_deleted = 0 |
| | | <if test="isAreaSelect != null and isAreaSelect == 1"> |
| | | and ( |
| | | <choose> |
| | | <when test="areaId != null"> |
| | | exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | <choose> |
| | | <when test="areaIds != null and areaIds.size > 0"> |
| | | exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | where ad.is_deleted = 0 |
| | | and ad.id in |
| | | <foreach collection="areaIds" item="areaIdItem" separator="," open="(" close=")"> |
| | | #{areaIdItem} |
| | | </foreach> |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | and find_in_set(ja_fw_device.id, ad.device_ids) |
| | | ) |
| | | or not exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | where ad.is_deleted = 0 |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | and find_in_set(ja_fw_device.id, ad.device_ids) |
| | | and ad.id not in |
| | | <foreach collection="areaIds" item="areaIdItem" separator="," open="(" close=")"> |
| | | #{areaIdItem} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <when test="areaId != null"> |
| | | exists ( |
| | | select 1 |
| | | from ja_fw_area_divide ad |
| | | where ad.is_deleted = 0 |
| | | and ad.id = #{areaId} |
| | | and ad.device_ids is not null |
| | |
| | | * |
| | | * @param isAreaSelect 是否过滤区域 |
| | | * @param areaId 设备被关联区域id |
| | | * @param areaIds 设备被关联区域id集合 |
| | | * @param status 设备状态 |
| | | * @return |
| | | */ |
| | | List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status, Integer isTrack); |
| | | List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, List<Long> areaIds, Integer status, Integer isTrack); |
| | | |
| | | /** |
| | | * 根据多边形查询设备列表 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, Integer status, Integer isTrack) { |
| | | return baseMapper.selectFwDeviceList(isAreaSelect, areaId, status, isTrack); |
| | | public List<FwDeviceEntity> selectFwDeviceList(Integer isAreaSelect, Long areaId, List<Long> areaIds, Integer status, Integer isTrack) { |
| | | return baseMapper.selectFwDeviceList(isAreaSelect, areaId, areaIds, status, isTrack); |
| | | } |
| | | |
| | | @Override |