Merge branch 'dev' of fanxb/bookmark into master

This commit is contained in:
fanxb 2022-04-23 14:27:18 +08:00 committed by Gogs
commit 9a5a4cae52
2 changed files with 12 additions and 5 deletions

View File

@ -1,9 +1,6 @@
package com.fanxb.bookmark.business.bookmark.dao; package com.fanxb.bookmark.business.bookmark.dao;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/** /**
* @author fanxb * @author fanxb
@ -28,6 +25,15 @@ public interface HostIconDao {
* @return {@link String} * @return {@link String}
* @author fanxb * @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); String selectByHost(String host);
/**
* 删除一条
*
* @param host host
* @author FleyX
*/
@Delete("delete from host_icon where host=#{host}")
void deleteByHost(String host);
} }

View File

@ -345,6 +345,7 @@ public class BookmarkServiceImpl implements BookmarkService {
try { try {
byte[] b = Base64Decoder.decode(icon.substring(icon.indexOf(",") + 1)); byte[] b = Base64Decoder.decode(icon.substring(icon.indexOf(",") + 1));
String iconPath = saveToFile(iconUrl, host, b); String iconPath = saveToFile(iconUrl, host, b);
hostIconDao.deleteByHost(host);
hostIconDao.insert(host, iconPath); hostIconDao.insert(host, iconPath);
return iconPath; return iconPath;
} catch (Exception e) { } catch (Exception e) {