Ship target detection technology is crucial for ship intelligence, maritime security, and military applications. Deep neural networks, trained with high-quality data, have shown impressive results in this field. However, due to the biased distribution of datasets, the data used to train the model often cannot fully reflect the various complex situations in real-world applications. if models trained on specific datasets are directly applied to target datasets with different distributions, the detection performance of the models will be greatly reduced. To address these issues, we propose a domain adaptation algorithm consisting of an image-level domain adaptation module and an instance-level domain adaptation module. In the image-level domain adaptation module, domain query vectors are utilized to aggregate global context information from source and target domain, facilitating image-level feature alignment. Meanwhile, in the instance-level domain adaptation module, the alignment of token features output by the encoder and decoder enables local and instance-level feature alignment. Results on four representative datasets demonstrate the effectiveness of our method in weather adaptation and synthetic-to-real data adaptation scenarios.