xuhy
2024-08-23 3e261beffdab4bfd58ebcf723496e7f78c618e44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.ruoyi.integration.mongodb.service.impl;
 
import com.ruoyi.integration.iotda.constant.IotConstant;
import com.ruoyi.integration.mongodb.model.PlatformRemoteUpdate;
import com.ruoyi.integration.mongodb.service.PlatformRemoteUpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class PlatformRemoteUpdateServiceImpl implements PlatformRemoteUpdateService {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public int create(PlatformRemoteUpdate platformRemoteUpdate) {
        mongoTemplate.save(platformRemoteUpdate);
        return IotConstant.SUCCESS;
    }
 
    @Override
    public PlatformRemoteUpdate findById(String id) {
        return mongoTemplate.findById(id, PlatformRemoteUpdate.class);
    }
 
    @Override
    public List<PlatformRemoteUpdate> findAll() {
        return mongoTemplate.findAll(PlatformRemoteUpdate.class);
    }
}