跳过无数据
This commit is contained in:
		@@ -631,6 +631,10 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
					find = find.Preload(item)
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if len(ids) == 0 {
 | 
			
		||||
					return map[string]interface{}{"list": []Image{}, "total": 0}, nil
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				orderClause := fmt.Sprintf("FIELD(id, %s)", regexp.MustCompile(`[\[\]]`).ReplaceAllString(strings.Join(strings.Fields(fmt.Sprint(ids)), ","), ""))
 | 
			
		||||
				if err := find.Order(orderClause).Find(&images).Error; err != nil {
 | 
			
		||||
					fmt.Println("获取图像列表失败", err)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user