</pre><pre name="code" class="sql">INSERT INTO invite_rejectlog_num ( player_id, MONTH, count, last_modify_time ) VALUES (#{playerId},#{month},#{count},#{lastModifyTime}) ON DUPLICATE KEY UPDATE count=count+1;
需要唯一约束 id和月份
ava月份计算比较
Calendar calDelM = Calendar.getInstance(); calDelM.set(Calendar.MONTH, 0); System.out.println(calDelM.get(Calendar.MONTH)); calDelM.add(Calendar.MONTH, -1); System.out.println(calDelM.get(Calendar.MONTH)); // ix 遍历需要删除的月份 int isdel = calDelM.get(Calendar.MONTH); int ix = 8;// 缓存最小月份 Calendar calDelM2 = Calendar.getInstance(); calDelM2.set(Calendar.MONTH, ix); ix = calDelM2.get(Calendar.MONTH); // ix<isdel Calendar calDelM3 = Calendar.getInstance(); calDelM3.set(Calendar.MONTH, calDelM.get(Calendar.MONTH)); for (; calDelM2.compareTo(calDelM3) != -1;) { System.out.println("================"); System.out.println("calDelM2:" + calDelM2.get(Calendar.MONTH) + " " + " calDelM:" + calDelM.get(Calendar.MONTH)+ " calDelM3: " + calDelM3.get(Calendar.MONTH)); System.out.println(calDelM2.compareTo(calDelM3)); calDelM.add(Calendar.MONTH, -1); isdel = calDelM.get(Calendar.MONTH); calDelM3.set(Calendar.MONTH, calDelM.get(Calendar.MONTH)); System.out.println("del:" + isdel); System.out.println("================"); }
时间: 2024-10-09 06:03:35