关于Date

1.java DateUtil工具包可将"Wed, 21 Dec 2022 14:20:00 GMT"格式的字符串专程Date类型:

Date expiration = DateUtil.parseRfc822Date("Wed, 21 Dec 2022 14:20:00 GMT");

2.mysql有now()之类的函数

mysql还有ON DUPLICATE KEY触发器

@SQL("INSERT INTO $T_ORDER_EXTEND (order_id, IMEI_extend) values ( :1, :2) ON DUPLICATE KEY UPDATE IMEI_extend = :2 , update_time = :3")
int updateIMEIExtendCode(Integer orderId, Long IMEIExtendCode, String date);

3.过期时间

private final Long cacheTime = 60 * 60 * 1000 * 4L;
private Long initTime = 0L;

private void refreshDictionary() {
        Long nowTime = System.currentTimeMillis();
        if (nowTime >= initTime) {
            initTime = nowTime + cacheTime;
            List<CardDictionary> list = dictionaryMapper.getAll();
            if (CollectionUtils.isNotEmpty(list)) {
                for (CardDictionary card : list) {
                    cardNoAndName.put(card.getCardNo()+"_"+card.getCardName(), card.getCardName());
                }
            }
        }
    }

每次查询都先refreshDictionary()

4.Java8 LocalDateTime

http://blog.csdn.net/u011277123/article/details/53665028


LocalDateTime 与 Date的转换
https://www.cnblogs.com/exmyth/p/6425878.html

原文地址:https://www.cnblogs.com/peanutk/p/8494087.html