久久99国产精品片久久99蜜桃_久久精品99国产精品蜜桃_久久久亚洲AV成人网站_欧美精品色婷婷五月综合_亚洲精品乱码久久久久久蜜桃图片_夜夜高潮夜夜爽国产伦精品_69无人区乱码一二三四区别_日产一码二码三码区别_大香区一二三四区2021_国产精品爱久久久久久久,日本高清视频成人网www,国产亚洲一二三区精品免费视频观看,久久久精品国产SM调教网站

推廣 熱搜: 后臺  位置  帝國cms  網(wǎng)站  Wordpress教程  帝國cms建站  內(nèi)容  DESTOON  郵箱  destoon7.0 

易讀小說拒絕重復(fù)采集的解決辦法

   日期:2019-09-23     瀏覽:196    違規(guī)舉報
 
騰訊云服務(wù)器優(yōu)惠

易讀小說系統(tǒng)是一款開源的JAVA小說程序,,可以幫你快速搭建自己的小說系統(tǒng),但是往來自不同網(wǎng)站的數(shù)據(jù)會重復(fù),,如何解決數(shù)據(jù)重復(fù)的問題,,有網(wǎng)友分享了以下的解決辦法。

  1. ssh登陸服務(wù)器

  2. 執(zhí)行命令:

        su - postgres

        如果出現(xiàn)輸入密碼窗口, 輸入postgres

        psql -U postgres -d 你的數(shù)據(jù)庫名

        create unique index unique_index_articleno_chaptername ON t_chapter(articleno,chaptername);
        create unique index unique_index_articlename_author ON t_article(articlename,author);


如果安裝過程是默認(rèn)的,, 你的數(shù)據(jù)庫名就是yidu,, 如果改了, 就到web目錄下進入WEB-INF/classes,, 在jdbc.properties中找到數(shù)據(jù)庫名    jdbc.url=jdbc:postgresql://127.0.0.1:5432/你的數(shù)據(jù)庫名


添加兩個唯一索引之前必須確保數(shù)據(jù)庫中不存在重復(fù)章節(jié),、重復(fù)小說


以下兩條sql分別查詢重復(fù)章節(jié)和重復(fù)小說


--查詢重復(fù)章節(jié)
select articleno,chapterno from t_chapter where chapterno in (
    select max(chapterno) from t_chapter tc inner join (
        select articleno ,chaptername from t_chapter
        group by articleno,chaptername having count(1)>1
    ) tc1 on tc.chaptername = tc1.chaptername and tc.articleno = tc1.articleno
);

--查詢重復(fù)小說
select articleno,articlename from t_article where articleno in (
    select max(articleno) from t_article tc inner join (
        select articlename from t_article
        group by articlename having count(1)>1
    ) tc1 on tc.articlename = tc1.articlename
);


查詢結(jié)果正確的話, 將select xxxx from 修改為 delete from 重新執(zhí)行即可,。



刪除重復(fù)章節(jié)
delete from t_chapter where chapterno in (
   select max(chapterno) from t_chapter tc inner join (
       select articleno ,chaptername from t_chapter
       group by articleno,chaptername having count(1)>1
   ) tc1 on tc.chaptername = tc1.chaptername and tc.articleno = tc1.articleno
);
刪除重復(fù)小說
delete from t_article where articleno in (
   select max(articleno) from t_article tc inner join (
       select articlename from t_article
       group by articlename having count(1)>1
   ) tc1 on tc.articlename = tc1.articlename
);

刪除指定小說全部章節(jié)

delete from t_chapter where articleno = 數(shù)字id;

--查詢重復(fù)章節(jié)

select * from (

    select tc.articleno,tc.chapterno,row_number() over(partition by tc.chaptername order by tc.chapterno asc) mark

    from t_chapter tc inner join (

        select articleno ,chaptername from t_chapter

        group by articleno,chaptername having count(1)>1

    ) tc1 on tc.chaptername = tc1.chaptername and tc.articleno = tc1.articleno

) temp where mark<>1;

--查詢重復(fù)小說

select * from (

    select tc.articleno,tc.articlename,row_number() over(partition by tc.articlename order by articleno asc) mark 

    from t_article tc inner join (

           select articlename from t_article

           group by articlename having count(1)>1

      ) tc1 on tc.articlename = tc1.articlename

) temp where mark<>1;



免責(zé)聲明:
1,、本站所收集的部分公開資料來源于互聯(lián)網(wǎng),轉(zhuǎn)載的目的在于傳遞更多信息及用于網(wǎng)絡(luò)分享,,并不代表本站贊同其觀點和對其真實性負(fù)責(zé),,也不構(gòu)成任何其他建議。
2,、本站部分作品內(nèi)容是由網(wǎng)友自主投稿和發(fā)布,、編輯整理上傳,對此類內(nèi)容本站僅提供交流平臺,,不為其版權(quán)負(fù)責(zé),,更不為其觀點承擔(dān)任何責(zé)任。
3,、因行業(yè)及專業(yè)性有限,,故未能核驗會員發(fā)布內(nèi)容的真實性及有效性,不為其負(fù)責(zé),,如有虛假或違規(guī)內(nèi)容敬請準(zhǔn)備材料圖片發(fā)郵件到info@n#舉報,,本站核實后積極配合刪除。
4,、如果您發(fā)現(xiàn)網(wǎng)站上有侵犯您的知識產(chǎn)權(quán)的作品,,請與我們?nèi)〉寐?lián)系,我們會及時處理或刪除,。
 
打賞
 
更多>同類網(wǎng)站技術(shù)
0相關(guān)評論

推薦圖文
推薦網(wǎng)站技術(shù)
點擊排行
網(wǎng)站首頁  |  關(guān)于我們  |  聯(lián)系方式  |  使用協(xié)議  |  免責(zé)聲明  |  版權(quán)隱私  |  信息發(fā)布規(guī)則  |  網(wǎng)站地圖  |  排名推廣  |  廣告服務(wù)  |  積分換禮  |  網(wǎng)站留言  |  RSS訂閱  |  違規(guī)舉報  |  粵ICP備2020081222號
Powered By DESTOON