-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][UDF]feature_add_udf_manage (#2476)
* feature_add_udf_manage * feature_add_udf_manage * support udf register manage web * feature_add_udf_manage * feature_add_udf_manage * feature_add_udf_manage * feature_add_udf_manage * feature_add_udf_manage --------- Co-authored-by: zhu-mingye <[email protected]>
- Loading branch information
1 parent
1cdfd5f
commit 089efcd
Showing
41 changed files
with
1,258 additions
and
212 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
dinky-admin/src/main/java/org/dinky/controller/UDFController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.controller; | ||
|
||
import org.dinky.data.dto.CommonDTO; | ||
import org.dinky.data.model.Resources; | ||
import org.dinky.data.model.UDFManage; | ||
import org.dinky.data.result.Result; | ||
import org.dinky.data.vo.UDFManageVO; | ||
import org.dinky.service.UDFService; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.swagger.annotations.Api; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* Flink udf controller | ||
*/ | ||
@Slf4j | ||
@Api(tags = "UDF Controller") | ||
@RestController | ||
@RequestMapping("/api/udf") | ||
@RequiredArgsConstructor | ||
public class UDFController { | ||
private final UDFService udfService; | ||
|
||
/** | ||
* update udf name by id | ||
* | ||
* @return Result | ||
*/ | ||
@GetMapping("/list") | ||
public Result<List<UDFManageVO>> list() { | ||
return Result.succeed(udfService.selectAll()); | ||
} | ||
|
||
/** | ||
* update udf | ||
* | ||
* @param udfManage udfManage | ||
* @return Result | ||
*/ | ||
@PostMapping("/update") | ||
public Result<Void> update(@RequestBody UDFManage udfManage) { | ||
udfService.update(udfManage); | ||
return Result.succeed(); | ||
} | ||
|
||
/** | ||
* get udf resources list | ||
* | ||
* @return Result | ||
*/ | ||
@GetMapping("/udfResourcesList") | ||
public Result<List<Resources>> udfResourcesList() { | ||
return Result.succeed(udfService.udfResourcesList()); | ||
} | ||
|
||
/** | ||
* add or update by resource id | ||
* | ||
* @param dto dto | ||
* @return Result | ||
*/ | ||
@PostMapping("/addOrUpdateByResourceId") | ||
public Result<Void> saveOrUpdate(@RequestBody CommonDTO<List<Integer>> dto) { | ||
udfService.addOrUpdateByResourceId(dto.getData()); | ||
return Result.succeed(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
dinky-admin/src/main/java/org/dinky/data/dto/CommonDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.data.dto; | ||
|
||
import org.apache.poi.ss.formula.functions.T; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* When using post, the dto passed as a parameter(使用post时,一个参数传递的dto) | ||
* @param <T> params | ||
*/ | ||
@Data | ||
public class CommonDTO<T> { | ||
private T data; | ||
} |
51 changes: 51 additions & 0 deletions
51
dinky-admin/src/main/java/org/dinky/data/model/UDFManage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.data.model; | ||
|
||
import org.dinky.mybatis.model.SuperEntity; | ||
|
||
import com.baomidou.mybatisplus.annotation.TableName; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = false) | ||
@TableName("dinky_udf_manage") | ||
@ApiModel(value = "UDFTemplate", description = "User-Defined Function Template") | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UDFManage extends SuperEntity<UDFManage> { | ||
|
||
@ApiModelProperty(value = "Class Name", dataType = "String", notes = "Class Name") | ||
private String className; | ||
|
||
@ApiModelProperty(value = "Task Id", dataType = "Integer", notes = "Task Id") | ||
private Integer taskId; | ||
|
||
@ApiModelProperty(value = "Resources Id", dataType = "Integer", notes = "Resources Id") | ||
private Integer resourcesId; | ||
} |
44 changes: 44 additions & 0 deletions
44
dinky-admin/src/main/java/org/dinky/data/vo/UDFManageVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.data.vo; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class UDFManageVO implements Serializable { | ||
private Integer id; | ||
private String name; | ||
private Boolean enabled; | ||
private String className; | ||
private Integer taskId; | ||
private Integer resourcesId; | ||
/** | ||
* develop or resources | ||
*/ | ||
private String source; | ||
|
||
private String dialect; | ||
private String fileName; | ||
private Date createTime; | ||
private Date updateTime; | ||
} |
36 changes: 36 additions & 0 deletions
36
dinky-admin/src/main/java/org/dinky/mapper/UDFManageMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.mapper; | ||
|
||
import org.dinky.data.model.UDFManage; | ||
import org.dinky.data.vo.UDFManageVO; | ||
import org.dinky.mybatis.mapper.SuperMapper; | ||
|
||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* UDFManageMapper | ||
*/ | ||
@Mapper | ||
public interface UDFManageMapper extends SuperMapper<UDFManage> { | ||
List<UDFManageVO> selectAll(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.