public List findRoomDevice(TRoomdevice roomdevice) throws Exception { StringBuffer query = new StringBuffer(" from TRoomdevice rd where 1=1 "); if (StringUtils.isNotEmpty(roomdevice.getId().getRoomId())) { query.append(" and rd.id.roomId ='").append(roomdevice.getId().getRoomId()).append("'"); } if (roomdevice.getId().getDeviceId() != null && !"".equals(roomdevice.getId().getDeviceId().toString())) { query.append(" and rd.id.deviceId =").append(roomdevice.getId().getDeviceId()); } List result = roomDAO.find(query.toString()); return result; }