代码规范笔记
1.不要出现魔法值(数字),定义常量或者枚举
2.防止空指针
3.throws Exception() 表示上层必须try catch捕获
4. 创建new Timestamp(System.currentTimeMillis())
5. timestamp转string
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(timestamp==null){
return "";
}
return df.format(timestamp);