Browse Source

[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>
3.1.0-release
hstdream 3 years ago committed by GitHub
parent
commit
701b535ae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Resource.java
  2. 14
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/UdfFunc.java
  3. 5
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
  4. 5
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapper.xml
  5. 2
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/entity/UdfFuncTest.java

17
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Resource.java

@ -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 +
'}';
}

14
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/UdfFunc.java

@ -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) {

5
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml

@ -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}

5
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapper.xml

@ -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>

2
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/entity/UdfFuncTest.java

@ -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());
}

Loading…
Cancel
Save