|
|
|
@ -9,6 +9,7 @@ import com.ruoyi.common.core.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.annotation.Log; |
|
|
|
import com.ruoyi.common.enums.BusinessType; |
|
|
|
import com.ruoyi.common.core.page.TableDataInfo; |
|
|
|
import com.ruoyi.system.domain.RoomPlatformIcon; |
|
|
|
import com.ruoyi.system.service.IRoomPlatformIconService; |
|
|
|
|
|
|
|
@ -26,16 +27,46 @@ public class RoomPlatformIconController extends BaseController { |
|
|
|
private RedisTemplate<String, Object> redisTemplate; |
|
|
|
|
|
|
|
/** |
|
|
|
* 按房间ID查询该房间下所有地图平台图标(不分页) |
|
|
|
* 查询房间地图平台图标列表(分页) |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('system:roomPlatformIcon:list')") |
|
|
|
@GetMapping("/list") |
|
|
|
public AjaxResult list(@RequestParam Long roomId) { |
|
|
|
public TableDataInfo list(RoomPlatformIcon roomPlatformIcon) { |
|
|
|
// 兜底:若前端将未选择的筛选值传为 0,则按“未传入”处理,避免 where room_id=0 导致空表
|
|
|
|
if (roomPlatformIcon != null) { |
|
|
|
if (roomPlatformIcon.getRoomId() != null && roomPlatformIcon.getRoomId() <= 0) { |
|
|
|
roomPlatformIcon.setRoomId(null); |
|
|
|
} |
|
|
|
if (roomPlatformIcon.getPlatformId() != null && roomPlatformIcon.getPlatformId() <= 0) { |
|
|
|
roomPlatformIcon.setPlatformId(null); |
|
|
|
} |
|
|
|
} |
|
|
|
startPage(); |
|
|
|
List<RoomPlatformIcon> list = roomPlatformIconService.selectRoomPlatformIconList(roomPlatformIcon); |
|
|
|
return getDataTable(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 按房间ID查询该房间下所有地图平台图标(不分页,用于 Cesium 地图渲染) |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('system:roomPlatformIcon:list')") |
|
|
|
@GetMapping("/listByRoomId") |
|
|
|
public AjaxResult listByRoomId(@RequestParam Long roomId) { |
|
|
|
List<RoomPlatformIcon> list = roomPlatformIconService.selectListByRoomId(roomId); |
|
|
|
return success(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询房间地图平台图标详细信息 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('system:roomPlatformIcon:list')") |
|
|
|
@GetMapping("/{id}") |
|
|
|
public AjaxResult getInfo(@PathVariable Long id) { |
|
|
|
RoomPlatformIcon icon = roomPlatformIconService.selectById(id); |
|
|
|
return success(icon); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增 |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('system:roomPlatformIcon:add')") |
|
|
|
@ -61,8 +92,13 @@ public class RoomPlatformIconController extends BaseController { |
|
|
|
*/ |
|
|
|
@PreAuthorize("@ss.hasPermi('system:roomPlatformIcon:remove')") |
|
|
|
@Log(title = "房间地图平台图标", businessType = BusinessType.DELETE) |
|
|
|
@DeleteMapping("/{id}") |
|
|
|
public AjaxResult remove(@PathVariable Long id) { |
|
|
|
@DeleteMapping("/{ids}") |
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) { |
|
|
|
int rows = 0; |
|
|
|
if (ids == null || ids.length == 0) return success(); |
|
|
|
|
|
|
|
for (Long id : ids) { |
|
|
|
if (id == null) continue; |
|
|
|
RoomPlatformIcon icon = roomPlatformIconService.selectById(id); |
|
|
|
if (icon != null && icon.getRoomId() != null) { |
|
|
|
String key = "room:" + icon.getRoomId() + ":platformIcons:platforms"; |
|
|
|
@ -70,6 +106,8 @@ public class RoomPlatformIconController extends BaseController { |
|
|
|
String oldKey = "room:" + icon.getRoomId() + ":route:0:platforms"; |
|
|
|
redisTemplate.opsForHash().delete(oldKey, String.valueOf(id)); |
|
|
|
} |
|
|
|
return toAjax(roomPlatformIconService.deleteById(id)); |
|
|
|
rows += roomPlatformIconService.deleteById(id); |
|
|
|
} |
|
|
|
return toAjax(rows); |
|
|
|
} |
|
|
|
} |
|
|
|
|