From 9a689cac65c0207896efd88b269afff7362b1e11 Mon Sep 17 00:00:00 2001 From: fanxb Date: Sat, 23 Apr 2022 14:26:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dhost=5Ficon=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/bookmark/dao/HostIconDao.java | 16 +++++++++++----- .../service/impl/BookmarkServiceImpl.java | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/HostIconDao.java b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/HostIconDao.java index 915100b..cf8f3bf 100644 --- a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/HostIconDao.java +++ b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/HostIconDao.java @@ -1,9 +1,6 @@ package com.fanxb.bookmark.business.bookmark.dao; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.*; /** * @author fanxb @@ -28,6 +25,15 @@ public interface HostIconDao { * @return {@link String} * @author fanxb */ - @Select("select iconPath from host_icon where host=#{host}") + @Select("select iconPath from host_icon where host=#{host} limit 1") String selectByHost(String host); + + /** + * 删除一条 + * + * @param host host + * @author FleyX + */ + @Delete("delete from host_icon where host=#{host}") + void deleteByHost(String host); } diff --git a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/impl/BookmarkServiceImpl.java b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/impl/BookmarkServiceImpl.java index bf15fcc..e212e03 100644 --- a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/impl/BookmarkServiceImpl.java +++ b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/impl/BookmarkServiceImpl.java @@ -345,6 +345,7 @@ public class BookmarkServiceImpl implements BookmarkService { try { byte[] b = Base64Decoder.decode(icon.substring(icon.indexOf(",") + 1)); String iconPath = saveToFile(iconUrl, host, b); + hostIconDao.deleteByHost(host); hostIconDao.insert(host, iconPath); return iconPath; } catch (Exception e) {