liurunyu
22 小时以前 1ccb8d7c6e0a59a8a85863904ff2616b374227a6
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.dy.pipIrrRemote.video;
 
import com.dy.common.util.DateTime;
import com.dy.pipIrrGlobal.daoVi.ViYsAppMapper;
import com.dy.pipIrrGlobal.pojoVi.ViYsApp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
/**
 * @Author: liurunyu
 * @Date: 2025/6/7 9:14
 * @Description
 */
@Component
public class YsAppSv {
 
    @Autowired
    protected ViYsAppMapper viYsAppDao ;
 
 
    public ViYsApp selectSingleton(){
        List<ViYsApp> all = this.viYsAppDao.selectAll() ;
        if(all == null || all.size() == 0){
            return null ;
        }else{
            return all.get(0) ;
        }
    }
 
    @Transactional(rollbackFor = Exception.class)
    public Long save(String accessToken, Long expireTime){
        ViYsApp po = new ViYsApp() ;
        po.accessToken = accessToken ;
        po.expireTime = expireTime ;
        po.expireDt = DateTime.getDate(expireTime) ;
        this.viYsAppDao.insert(po) ;
        return po.id ;
    }
 
    @Transactional(rollbackFor = Exception.class)
    public void deleteAll(){
        viYsAppDao.deleteAll() ;
    }
}