原创 HashMap多線程下發生死循環原因及解決

可能發生的原因: 1、多線程put操作後,get操作導致死循環。 2、多線程put非null元素後,get操作得到null值。 解決: 1、使用ConcurrentHashMap代替HashMap。 2、使用Collections

原创 Mybatis之查出一張表中一個字段2種不同類型的數據

select id, title, content, picture, timestamp, type, status, country_id from (select * from information order by TI

原创 Mybatis之查詢一張表中一個字段的上下2條數據

select content, country_id, (select title from information WHERE #{id} > id and (status = 1) ORDER BY id DESC limit 1