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) {