添加租户id相关逻辑(预留)

This commit is contained in:
even 2025-07-30 16:21:06 +08:00
parent 0f2782dacb
commit eb722d84e3
3 changed files with 11 additions and 1 deletions

View File

@ -138,4 +138,5 @@ public class PipPipeline extends PipBaseElement {
* 机器id
* */
private String machineId;
private Long tenantId;
}

View File

@ -109,7 +109,8 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
List<PipTask> pipTaskList = new ArrayList<>(0);
PipPipeline pipeline = pipelineConverter.reqToDO(pipelineReq);
Long tenantId = WebFrameworkUtils.getLoginUser().getTenantId();
pipeline.setTenantId(tenantId);
// 随机颜色
int randomNumber = (int)(Math.random() * 5) + 1;
pipeline.setColor(randomNumber);

View File

@ -40,6 +40,14 @@ public class WebFrameworkUtils {
return null;
}
}
public static LoginUser getLoginUser() {
try {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
return (LoginUser) authentication.getPrincipal();
} catch (Exception e){
return null;
}
}
public static String getLoginUserIdStr(){
Long loginUserId = getLoginUserId();
if (loginUserId!=null) {