[Fix-10082]Resource userName is null and udf function manager add a username (#10064)

* Resource userName is null

* [Fix-10082]Resource userName is null and udf function manager add a username

* [Fix-10082]Resource userName is null and udf function manager add a username

* [Fix-10082]Resource userName is null and udf function manager add a username

Co-authored-by: houshitao <shitaohou@163.com>
This commit is contained in:
hstdream 2022-05-18 11:33:08 +08:00 committed by GitHub
parent 537c206c2d
commit 701b535ae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 5 deletions

View File

@ -17,6 +17,7 @@
package org.apache.dolphinscheduler.dao.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import java.util.Date;
@ -88,6 +89,13 @@ public class Resource {
*/
private Date updateTime;
/**
* user name
*/
@TableField(exist = false)
private String userName;
public Resource() {
}
@ -224,6 +232,14 @@ public class Resource {
this.updateTime = updateTime;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public String toString() {
return "Resource{" +
@ -239,6 +255,7 @@ public class Resource {
", size=" + size +
", createTime=" + createTime +
", updateTime=" + updateTime +
",userName=" + userName +
'}';
}

View File

@ -105,6 +105,12 @@ public class UdfFunc {
*/
private Date updateTime;
/**
* user name
*/
@TableField(exist = false)
private String userName;
public int getId() {
return id;
}
@ -202,6 +208,14 @@ public class UdfFunc {
this.updateTime = updateTime;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@ -58,8 +58,9 @@
<include refid="baseSqlV2">
<property name="alias" value="d"/>
</include>
from t_ds_resources d
where d.type=#{type} and d.pid=#{id}
,u.user_name
from t_ds_resources d,t_ds_user u
where d.type=#{type} and d.pid=#{id} and d.user_id=u.id
<if test="userId != 0">
and (
d.user_id=#{userId}

View File

@ -56,8 +56,9 @@
<include refid="baseSql">
<property name="alias" value="udf"/>
</include>
from t_ds_udfs udf
where 1=1
,u.user_name
from t_ds_udfs udf,t_ds_user u
where 1=1 and udf.user_id=u.id
<if test="searchVal!= null and searchVal != ''">
and udf.func_name like concat('%', #{searchVal}, '%')
</if>

View File

@ -37,7 +37,7 @@ public class UdfFuncTest {
udfFunc.setClassName("org.apache.dolphinscheduler.test.mrUpdate");
Assert.assertEquals("{\"id\":0,\"userId\":0,\"resourceType\":\"UDF\",\"funcName\":null,\"className\":\"org.apache.dolphinscheduler.test.mrUpdate\",\"argTypes\":null,\"database\":null,"
+ "\"description\":null,\"resourceId\":2,\"resourceName\":\"dolphin_resource_update\",\"type\":null,\"createTime\":null,\"updateTime\":null}"
+ "\"description\":null,\"resourceId\":2,\"resourceName\":\"dolphin_resource_update\",\"type\":null,\"createTime\":null,\"updateTime\":null,\"userName\":null}"
, udfFunc.toString());
}