小编Ghi*_*tfi的帖子

在集合字段中查找元素 Spring Data JPA 查询

我有一个实体包含一个集合字段

@Entity
@Table(name = "SERVICE")
    public class Service {

@Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQUENCE")
    @SequenceGenerator(name = "SEQUENCE", sequenceName = "SEQUENCE")
    @Column(name = "ID_SERVICE")
    private Integer id;

        @ElementCollection
    @CollectionTable(name = "SERVICE_JOB",
            joinColumns = @JoinColumn(name = "ID_SERVICE", referencedColumnName = "ID_SERVICE"))
    @Column(name = "JOB")
    private List<String> jobs = new ArrayList<String>();
    }
Run Code Online (Sandbox Code Playgroud)

我想返回现场工作包含我的变量“工作”的服务

@Query("SELECT DISTINCT s FROM Service s WHERE ?1 in (s.jobs)")
List<Service> findByJob(String job);
Run Code Online (Sandbox Code Playgroud)

尽管字段作业包含我的变量,但它始终返回一个空列表

有什么建议吗?

java spring jpa spring-data-jpa

7
推荐指数
1
解决办法
9426
查看次数

如何使用signedUrl将文件上传到谷歌云存储桶

我正在开发一个 Angular 应用程序,用于显示谷歌云存储桶的内容。对于后面,我在nodeJS中使用谷歌云功能

正如他们在上传文件的文档中提到的,我创建了一个函数来生成签名 url,但是当我使用签名 url 发送文件时,我在浏览器中收到了 cors 错误

我用邮递员测试,它上传一个空文件

这是我的 lambda 函数:

// Imports the Google Cloud client library
const {Storage} = require('@google-cloud/storage');

// Creates a client
const storage = new Storage();

exports.generateSignedUrl = (req, res) => {
// generate signed url to use for file upload

const filename = req.query.fileName;
console.log('filename ', filename);

const filetype = req.query.fileType;
console.log('filetype ', filetype);

const bucketName = 'nx-terega-omega';

res.set('Access-Control-Allow-Origin', "*");
res.set('Access-Control-Allow-Headers', "Origin, X-Requested-With, 
Content-Type, Accept, Authorization");

if (req.query.fileName !== null && req.query.fileName …
Run Code Online (Sandbox Code Playgroud)

node.js cors google-cloud-storage google-cloud-platform angular

3
推荐指数
1
解决办法
3463
查看次数

如何找到添加到传单层的多个标记的边界

我正在 Angular 6 项目中使用 ngx-leaflet,我在我的地图中绘制了多个标记,我想在多个标记上居中和缩放传单地图

在官方文档中,您可以使用 [L.latlngBounds] 来完成,并使用其他解决方案 L.featureGroup

由于我使用的是 ngx-leaflet,我没有L变量,所以我找不到latlngBoundsfeatureGroup

这是我的组件:

import {latLng, tileLayer, polygon, marker, Icon, LatLngBounds} from 'leaflet';

export class CustomComponent implements OnInit {

  options = {
    layers: [
      tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {maxZoom: 18})
    ],
    zoom: 5,
    center: latLng(46.879966, -121.726909)
  };

  layers = [];
  fitBounds: LatLngBounds;
}

ngOnInit() {
    for (let i = 0; i < this.locations.length; i++) {
        this.layers.push(this.locations[i].y, this.locations[i].x].setIcon(
            new Icon({
                iconSize: [25, 41],
                iconAnchor: [13, 41],
                iconUrl: 'assets/icons/marker-icon.png',
                shadowUrl: 'assets/icons/marker-shadow.png'
        }))); …
Run Code Online (Sandbox Code Playgroud)

leaflet angular ngx-leaflet

2
推荐指数
1
解决办法
1227
查看次数