Skip to content

Commit

Permalink
添加 updateWorkspaceInfo restful
Browse files Browse the repository at this point in the history
  • Loading branch information
SunPengWan committed Dec 13, 2024
1 parent 8966b20 commit 7bc4793
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public enum TargetTypeEnum {
* 工作流引用默认模板
*/
DSS_EC_CONFIG_TEMPLATE_WORKFLOW("dss_ec_config_template_workflow"),


DSS_WORKSPACE_DEFAULT_TEMPLATE("dss_workspace_default_template"),

;
private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class DSSWorkspace {
private String lastUpdateUser;
private String workspaceType;
private int adminPermission;
private Boolean enabledFlowKeywordsCheck;
private String enabledFlowKeywordsCheck;

private Boolean isDefaultReference;
private String isDefaultReference;

public int getAdminPermission() {
return adminPermission;
Expand Down Expand Up @@ -141,19 +141,20 @@ public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}

public Boolean getEnabledFlowKeywordsCheck() {

public String getEnabledFlowKeywordsCheck() {
return enabledFlowKeywordsCheck;
}

public void setEnabledFlowKeywordsCheck(Boolean enabledFlowKeywordsCheck) {
public void setEnabledFlowKeywordsCheck(String enabledFlowKeywordsCheck) {
this.enabledFlowKeywordsCheck = enabledFlowKeywordsCheck;
}

public Boolean getDefaultReference() {
public String getIsDefaultReference() {
return isDefaultReference;
}

public void setDefaultReference(Boolean defaultReference) {
isDefaultReference = defaultReference;
public void setIsDefaultReference(String isDefaultReference) {
this.isDefaultReference = isDefaultReference;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ void updateDepartmentsForWorkspace(@Param("workspaceId") Long workspaceId, @Para


void updateWorkSpace(DSSWorkspace dssWorkspace);

void updateWorkspaceInfo(DSSWorkspace dssWorkspace);
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,10 @@
where id = #{id}
</update>

<update id="updateWorkspaceInfo" parameterType="com.webank.wedatasphere.dss.framework.workspace.bean.DSSWorkspace">
update dss_workspace set enabled_flow_keywords_check = #{enabledFlowKeywordsCheck},
is_default_reference = #{isDefaultReference}
where id = #{id}
</update>

</mapper>
Original file line number Diff line number Diff line change
Expand Up @@ -474,5 +474,35 @@ public Message deleteFavorite(@PathVariable("workspaceId") Long workspaceId, @Pa
OperateTypeEnum.REM_FROM_FAVORITES, json);
return Message.ok().data("favoriteId", favoriteId);
}


@RequestMapping(value = "/updateWorkspaceInfo",method = RequestMethod.POST)
public Message updateWorkspaceInfo(@RequestBody Map<String, String> json) throws DSSErrorException{

Workspace workspace = SSOHelper.getWorkspace(httpServletRequest);
String username = SecurityFilter.getLoginUsername(httpServletRequest);

String workspaceId= json.getOrDefault("workspaceId",String.valueOf(workspace.getWorkspaceId()));

if(!workspaceId.equals(String.valueOf(workspace.getWorkspaceId()))){
throw new DSSErrorException(90053,"当前工作空间与cookie中的不一致,重新刷新页面后在操作");
}

String enabledFlowKeywordsCheck = json.getOrDefault("enabledFlowKeywordsCheck","0");
String isDefaultReference = json.getOrDefault("isDefaultReference","0");

DSSWorkspace dssWorkspace = new DSSWorkspace();
dssWorkspace.setId(Integer.parseInt(workspaceId));
dssWorkspace.setEnabledFlowKeywordsCheck(enabledFlowKeywordsCheck);
dssWorkspace.setIsDefaultReference(isDefaultReference);

dssWorkspaceService.updateWorkspaceInfo(dssWorkspace);

AuditLogUtils.printLog(username, workspaceId, workspace.getWorkspaceName(), TargetTypeEnum.WORKSPACE, workspaceId, workspace.getWorkspaceName(),
OperateTypeEnum.UPDATE, json);

return Message.ok().data("workspaceId", workspaceId);

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@ List<WorkspaceMenuVo> getWorkspaceAppConns(Workspace workspace, Long workspaceId
int transferWorkspace(String workspaceName,String oldOwner,String newOwner,String desc) throws DSSErrorException;

boolean checkUserIfSettingAdmin(String username);

void updateWorkspaceInfo(DSSWorkspace dssWorkspace);
}
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,10 @@ private void joinWorkspaceForNewUser(String userName, Long userId, int workspace
});
});
}


@Override
public void updateWorkspaceInfo(DSSWorkspace dssWorkspace){
dssWorkspaceMapper.updateWorkspaceInfo(dssWorkspace);
}
}

0 comments on commit 7bc4793

Please sign in to comment.