1. 程式人生 > 其它 >mybatis實體類屬性名跟資料庫表名不一致

mybatis實體類屬性名跟資料庫表名不一致

獲取網路標準時間出錯

LocalDateTime.ofEpochSecond(ld,0, ZoneOffset.ofHours(8));

轉換成LocalDateTime時出錯,日期和本地時間對不上,連年份和月份都對不上。

原因:

獲取的時間戳需要除以1000

    /**
     * 從中國科學院國家授時中心獲取標準時間
     * @return
     */
    public static LocalDateTime standardTime(){
        try {
            URL url = new URL("http://www.ntsc.ac.cn");// 取得資源物件
            URLConnection uc = url.openConnection();// 生成連線物件
            uc.connect();// 發出連線
            long ld = uc.getDate();// 讀取網站日期時間
            return LocalDateTime.ofEpochSecond(ld/1000,0, ZoneOffset.ofHours(8));// 轉換為標準時間物件

        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("獲取標準時間失敗,改為獲取伺服器時間");
            return LocalDateTime.now();
        }
    }

    /**
     * 獲取完整的時間,自定義格式
     * @param formatStr 時間格式化欄位
     * @param locale 地點
     * @return
     */
    public static String getStandardTimeCustomize(String formatStr,Locale locale){
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(formatStr, locale);
        return dateTimeFormatter.format(DateUtil.standardTime());
    }

打包啟動 中沒有主清單屬性

我是用的是一個自建的巢狀專案,在最外層的pom檔案中也添加了“maven”得打包,導致下面的子專案打包時沒有注清單屬性

啟動引數

linux下啟動,新增引數,選擇需要的配置

java -jar  xxx.jar  --spring.profiles.active=xxx

linux我的常用指令

遞迴刪除資料夾:rm -rf 資料夾名 (遞迴刪除,預設全部

重新命名資料夾:mv 舊資料夾名稱 新資料夾名稱 (本質上是移動操作,將一個資料夾下的所有檔案移動到了另一個資料夾下

解壓縮檔案:7za x 需要解壓的資料夾

檢視當前執行程式:ps -aux 或 ps -ef (只是兩種顯示風格,可以追加“|grep XXX”來對結果進行過濾

檢視後臺執行的java程式:jobs

各類開發生產環境縮寫