Skip to content

Instantly share code, notes, and snippets.

View Jandaes's full-sized avatar
💬

等待时候 Jandaes

💬
View GitHub Profile
@Jandaes
Jandaes / TimestampToDate(javascript)
Created March 12, 2018 07:24
js时间戳转时间
/*时间戳转时间*/
timestamp = 1520839465;
var time = new Date(timestamp);
var year = time.getFullYear();
var month = (time.getMonth() + 1) > 9 && (time.getMonth() + 1) || ("0" + (time.getMonth() + 1))
var date = time.getDate() > 9 && time.getDate() || ("0" + time.getDate())
var hour = time.getHours() > 9 && time.getHours() || ("0" + time.getHours())
var minute = time.getMinutes() > 9 && time.getMinutes() || ("0" + time.getMinutes())
var second = time.getSeconds() > 9 && time.getSeconds() || ("0" + time.getSeconds())
var YmdHis = year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
@Jandaes
Jandaes / SpringBootCache.md
Created October 30, 2017 02:17
Spring Boot CachePut缓存 #Spring #Cache

Spring CachePut 是Spring自带的缓存、只需要添加注解即可使用

   /**
     * @CachePut缓存新增或更新数据到缓存,其中缓存名称为people,数据key是people的id
     * @param person
     * @return
     */
    @Override
    @CachePut(value = "people",key = "#person.id")
 public Person save(Person person) {
@Jandaes
Jandaes / SpringTransactional.java
Created October 30, 2017 02:11
Spring事务回滚代码片段 #Transactional #Spring
/**
* 遇到异常回滚事务
* @param person
* @return
*/
@Override
@Transactional(rollbackFor = {IllegalArgumentException.class})
public Person savePersonWithRollBack(Person person) {
Person p=personRepository.save(person);
if(person.getName().equals("73")){