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() ;
|
}
|
}
|