Skip to content

Commit 724197e

Browse files
committed
make scriptis entrance always on page top.
1 parent d0b2116 commit 724197e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceMapper.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,13 @@ public interface DSSWorkspaceMapper {
5353
"</script>"
5454
})
5555
void setDefaultComponentRoles(@Param("privs") List<DSSWorkspaceComponentPriv> dssWorkspaceComponentPrivs);
56+
57+
@Select("select count(1) from dss_workspace_user_favorites_appconn where menu_appconn_id=#{menuAppId} and workspace_id=#{workspaceId}" +
58+
" and username=#{userName} and type=#{type}")
59+
int getByMenuAppIdAndUser(@Param("menuAppId") Long menuAppId, @Param("workspaceId") Long workspaceId,
60+
@Param("userName") String userName, @Param("type") String type);
61+
62+
@Select("select id from dss_workspace_menu_appconn where title_en=#{appName}")
63+
Long getMenuAppIdByName(@Param("appName") String appName);
64+
5665
}

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/impl/DSSWorkspaceServiceImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,25 @@ public List<WorkspaceMenuVo> getWorkspaceAppConns(Long workspaceId, String usern
590590

591591
@Override
592592
public List<WorkspaceFavoriteVo> getWorkspaceFavorites(Long workspaceId, String username, boolean isChinese, String type) {
593+
checkScriptis(workspaceId, username, "dingyiding");
593594
return isChinese ? workspaceMapper.getWorkspaceFavoritesCn(username, workspaceId, type) : workspaceMapper.getWorkspaceFavoritesEn(username, workspaceId, type);
594595
}
595596

597+
/**
598+
* 保证Scriptis入口一直在页面上方
599+
*
600+
* @param workspaceId
601+
* @param username
602+
* @param type
603+
*/
604+
private void checkScriptis(Long workspaceId, String username, String type) {
605+
Long scriptisMenuAppId = dssWorkspaceMapper.getMenuAppIdByName("Scriptis");
606+
int exists = dssWorkspaceMapper.getByMenuAppIdAndUser(scriptisMenuAppId, workspaceId, username, type);
607+
if (exists < 1) {
608+
addFavorite(username, workspaceId, scriptisMenuAppId, type);
609+
}
610+
}
611+
596612
@Override
597613
public Long addFavorite(String username, Long workspaceId, Long menuApplicationId, String type) {
598614
DSSFavorite dssFavorite = new DSSFavorite();

0 commit comments

Comments
 (0)