6 2 店鋪資訊編輯之Service層的實現

2021-09-19 15:58:25 字數 1010 閱讀 7432

1、修改介面

public inte***ce shopservice
2、介面實現類

@override

public shop getbyshopid(long shopid)

@override

public shopexecution modifyshop(shop shop, inputstream shopimginputstream, string filename)

throws shopoperationexception else

addshopimg(shop, shopimginputstream, filename);

}// 2、更新店鋪資訊

shop.setlastedittime(new date());

int effectednum = shopdao.updateshop(shop);

if (effectednum <= 0) else

} catch (exception e)

} }

注意:判斷string是不是空的寫法

3、刪除的工具類方法

/**

* storepath是檔案路徑還是目錄路徑

* 如果是檔案路徑,則刪除該檔案

* 如果是目錄路徑,則刪除該目錄下的所有檔案

* @param storepath

*/public static void deletefileorpath(string storepath)

}fileorpath.delete();

} }

4、測試類

@test

public void testmodifyshop() throws shopoperationexception,filenotfoundexception

爬取 京客隆超市 店鋪資訊

爬取 京客隆超市 店鋪資訊 匯入所需庫 import requests import pandas as pd from lxml import etree爬取各區鏈結 url headers response requests.get url,headers headers text html e...

外掛程式62 從表中讀取資訊

外掛程式說明 根據提供的表名和使用者名稱,外掛程式將讀取這個使用者的記錄並返回給呼叫程式。若操作成功,則返回乙個兩元素的陣列,其中第乙個元素的值為true,而第二個元素是乙個陣列,儲存使用者的各項資料。若操作失敗,則返回乙個元素陣列,這個元素的值為false.他需要的引數 table 資料表名。ha...

1119 Day62 drf之渲染模組

目錄根據使用者請求url或使用者可接受的型別,篩選出合適的渲染元件。使用者請求url 通過原始碼,我們可以知道渲染內容主要是jsonrenderer browsableapirenderer 匯入 from rest framework.renderers import jsonrenderer f...