整理一下當年的學習筆記之 poi匯入匯出

2021-07-30 06:53:14 字數 1705 閱讀 7636

或許只有我知道我寫的是什麼

匯出的例子----------------------------------

public void daochu() throws exception

service層**:

public class ypxximportserviceimpl implements hxlsoptrowsinte***ce 

//新增唯一校驗

//校驗通用名、劑型、規格、轉換係數、生產企業、商品名

//思路:根據通用名、劑型、規格、轉換係數、生產企業、商品名,查詢,如果查詢到記錄,說明 存在重覆記錄

//.....

ypxx ypxx = new ypxx();

ypxx.setid(uuidbuild.getuuid());

ypxx.setmc(mc);

ypxx.setjx(jx);

ypxx.setgg(gg);

ypxx.setzhxs(zhxs);

ypxx.setscqymc(scqymc);

ypxx.setspmc(spmc);

ypxx.setzbjg(float.parsefloat(zbjg));

ypxx.setjyzt(jyzt);

} catch (exception e)

return "success";

}}

action:

//藥品匯入提交

public @responsebody submitresultinfo importypxxsubmit(

//寫上傳的檔案

multipartfile ypxximportfile

)throws exception

//將記憶體中的檔案寫磁碟

ypxximportfile.transferto(file);

//上傳檔案磁碟上路徑

string absolutepath = file.getabsolutepath();

//呼叫工具類進行藥品目錄 匯入

hxlsread xls2csv = null;

try catch (filenotfoundexception e) catch (ioexception e) catch (sqlexception e)

//提示匯入成功條數

long success_num = xls2csv.getoptrows_success();

//匯入失敗數量

long failure_num = xls2csv.getoptrows_failure();

//對匯入失敗記錄處理

//獲取匯入失敗記錄

//獲取匯入記錄的title

//獲取匯入失敗原因

//將上邊獲取到的失敗記錄、title、失敗原因,匯出成乙個 excel

//......

return resultutil.createsubmitresult(resultutil.createsuccess(config.message, 314, new object));

}

整理一下Entity Framework的查詢

entity framework是個好東西,雖然沒有hibernate功能強大,但使用更簡便。今天整理一下常見sql如何用ef來表達,func形式和linq形式都會列出來 本人更喜歡func形式 1 簡單查詢 sql select from clients where type 1 and dele...

整理一下Entity Framework的查詢

entity framework是個好東西,雖然沒有hibernate功能強大,但使用更簡便。今天整理一下常見sql如何用ef來表達,func形式和linq形式都會列出來 本人更喜歡func形式 1 簡單查詢 sql select from clients where type 1 and dele...

整理了一下買的電腦書,整理了一下學習思路

這幾天,整理了整理以前買的電腦技術書籍,發現有不少書還沒有看過,挑了一本 程式設計師修練之道 先看著,這本書兩年多前就買了,以前在學校裡的時候看了大概四分之一,記得看到這部分的時候覺得內容於實際不太搞界,看起來比較吃力,所以就擱下了。一直沒看,這幾天終於把全本書看完了。由於自已現在從事軟體開發,所以...