mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-25 18:57:11 +08:00
build: continew-starter 2.9.0 => 2.10.0
1.适配限流模块、链路追踪模块、访问日志等配置调整 2.适配Crud模块 API 命名变化(add => create、detail => get) 3.适配 sa-token、snail-job 升级变化
This commit is contained in:
@@ -22,5 +22,5 @@ import ${packageName}.service.${classNamePrefix}Service;
|
||||
*/
|
||||
@Tag(name = "${businessName}管理 API")
|
||||
@RestController
|
||||
@CrudRequestMapping(value = "/${apiModuleName}/${apiName}", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT})
|
||||
@CrudRequestMapping(value = "/${apiModuleName}/${apiName}", api = {Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE, Api.EXPORT})
|
||||
public class ${className} extends BaseController<${classNamePrefix}Service, ${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req> {}
|
||||
@@ -10,8 +10,8 @@ INSERT INTO `sys_menu`
|
||||
(`id`, `title`, `parent_id`, `type`, `permission`, `sort`, `status`, `create_user`, `create_time`)
|
||||
VALUES
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '列表', @parentId, 3, '${apiModuleName}:${apiName}:list', 1, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '详情', @parentId, 3, '${apiModuleName}:${apiName}:detail', 2, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '新增', @parentId, 3, '${apiModuleName}:${apiName}:add', 3, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '详情', @parentId, 3, '${apiModuleName}:${apiName}:get', 2, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '新增', @parentId, 3, '${apiModuleName}:${apiName}:create', 3, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '修改', @parentId, 3, '${apiModuleName}:${apiName}:update', 4, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '删除', @parentId, 3, '${apiModuleName}:${apiName}:delete', 5, 1, 1, NOW()),
|
||||
(${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '导出', @parentId, 3, '${apiModuleName}:${apiName}:export', 6, 1, 1, NOW());
|
||||
@@ -32,8 +32,8 @@ VALUES
|
||||
<#-- ("id", "title", "parent_id", "type", "permission", "sort", "status", "create_user", "create_time")-->
|
||||
<#-- VALUES-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '列表', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:list', 1, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '详情', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:detail', 2, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '新增', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:add', 3, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '详情', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:get', 2, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '新增', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:create', 3, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '修改', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:update', 4, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '删除', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:delete', 5, 1, 1, NOW()),-->
|
||||
<#-- (${statics["cn.hutool.core.util.IdUtil"].getSnowflakeNextId()?c}, '导出', sys_menu_id_seq, 3, '${apiModuleName}:${apiName}:export', 6, 1, 1, NOW());-->
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</a-button>
|
||||
</template>
|
||||
<template #toolbar-right>
|
||||
<a-button v-permission="['${apiModuleName}:${apiName}:add']" type="primary" @click="onAdd">
|
||||
<a-button v-permission="['${apiModuleName}:${apiName}:create']" type="primary" @click="onAdd">
|
||||
<template #icon><icon-plus /></template>
|
||||
<template #default>新增</template>
|
||||
</a-button>
|
||||
@@ -81,7 +81,7 @@
|
||||
</#list>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-link v-permission="['${apiModuleName}:${apiName}:detail']" title="详情" @click="onDetail(record)">详情</a-link>
|
||||
<a-link v-permission="['${apiModuleName}:${apiName}:get']" title="详情" @click="onDetail(record)">详情</a-link>
|
||||
<a-link v-permission="['${apiModuleName}:${apiName}:update']" title="修改" @click="onUpdate(record)">修改</a-link>
|
||||
<a-link
|
||||
v-permission="['${apiModuleName}:${apiName}:delete']"
|
||||
@@ -154,7 +154,7 @@ const columns: TableInstance['columns'] = [
|
||||
width: 160,
|
||||
align: 'center',
|
||||
fixed: !isMobile() ? 'right' : undefined,
|
||||
show: has.hasPermOr(['${apiModuleName}:${apiName}:detail', '${apiModuleName}:${apiName}:update', '${apiModuleName}:${apiName}:delete'])
|
||||
show: has.hasPermOr(['${apiModuleName}:${apiName}:get', '${apiModuleName}:${apiName}:update', '${apiModuleName}:${apiName}:delete'])
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
public class AppServiceImpl extends BaseServiceImpl<AppMapper, AppDO, AppResp, AppDetailResp, AppQuery, AppReq> implements AppService {
|
||||
|
||||
@Override
|
||||
public void beforeAdd(AppReq req) {
|
||||
public void beforeCreate(AppReq req) {
|
||||
req.setAccessKey(Base64.encode(IdUtil.fastSimpleUUID())
|
||||
.replace(StringConstants.SLASH, StringConstants.EMPTY)
|
||||
.replace(StringConstants.PLUS, StringConstants.EMPTY)
|
||||
|
||||
@@ -20,7 +20,7 @@ import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Open Api 工具类
|
||||
@@ -41,7 +41,7 @@ public class OpenApiUtils {
|
||||
*/
|
||||
public static boolean isSignParamExists() {
|
||||
SaRequest saRequest = SaHolder.getRequest();
|
||||
List<String> paramNames = saRequest.getParamNames();
|
||||
Collection<String> paramNames = saRequest.getParamNames();
|
||||
return paramNames.stream().anyMatch(SaSignTemplate.sign::equals);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ package top.continew.admin.schedule.api;
|
||||
import com.aizuda.snailjob.common.core.model.Result;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.service.annotation.*;
|
||||
import top.continew.admin.schedule.model.JobPageResult;
|
||||
import top.continew.admin.schedule.model.req.JobReq;
|
||||
import top.continew.admin.schedule.model.req.JobStatusReq;
|
||||
import top.continew.admin.schedule.model.req.JobTriggerReq;
|
||||
import top.continew.admin.schedule.model.resp.JobResp;
|
||||
|
||||
import java.util.List;
|
||||
@@ -65,7 +65,7 @@ public interface JobApi {
|
||||
* @return 响应信息
|
||||
*/
|
||||
@PostExchange("/job")
|
||||
ResponseEntity<Result<Boolean>> add(@RequestBody JobReq req);
|
||||
ResponseEntity<Result<Boolean>> create(@RequestBody JobReq req);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
@@ -97,11 +97,11 @@ public interface JobApi {
|
||||
/**
|
||||
* 执行
|
||||
*
|
||||
* @param id ID
|
||||
* @param req 参数
|
||||
* @return 响应信息
|
||||
*/
|
||||
@PostExchange("/job/trigger/{id}")
|
||||
ResponseEntity<Result<Boolean>> trigger(@PathVariable("id") Long id);
|
||||
@PostExchange("/job/trigger")
|
||||
ResponseEntity<Result<Boolean>> trigger(@RequestBody JobTriggerReq req);
|
||||
|
||||
/**
|
||||
* 查询分组列表
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed 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 top.continew.admin.schedule.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 执行任务参数
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/3/26 21:50
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "执行任务参数")
|
||||
public class JobTriggerReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(description = "ID", example = "1")
|
||||
@NotNull(message = "ID不能为空")
|
||||
private Long jobId;
|
||||
|
||||
/**
|
||||
* 方法参数
|
||||
*/
|
||||
@Schema(description = "方法参数")
|
||||
private String tmpArgsStr;
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package top.continew.admin.schedule.service;
|
||||
import top.continew.admin.schedule.model.query.JobQuery;
|
||||
import top.continew.admin.schedule.model.req.JobReq;
|
||||
import top.continew.admin.schedule.model.req.JobStatusReq;
|
||||
import top.continew.admin.schedule.model.req.JobTriggerReq;
|
||||
import top.continew.admin.schedule.model.resp.JobResp;
|
||||
import top.continew.starter.extension.crud.model.resp.PageResp;
|
||||
|
||||
@@ -47,7 +48,7 @@ public interface JobService {
|
||||
* @param req 创建信息
|
||||
* @return 新增结果
|
||||
*/
|
||||
boolean add(JobReq req);
|
||||
boolean create(JobReq req);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
@@ -78,10 +79,10 @@ public interface JobService {
|
||||
/**
|
||||
* 执行
|
||||
*
|
||||
* @param id ID
|
||||
* @param req 参数
|
||||
* @return 执行结果
|
||||
*/
|
||||
boolean trigger(Long id);
|
||||
boolean trigger(JobTriggerReq req);
|
||||
|
||||
/**
|
||||
* 查询分组列表
|
||||
|
||||
@@ -23,6 +23,7 @@ import top.continew.admin.schedule.api.JobClient;
|
||||
import top.continew.admin.schedule.model.query.JobQuery;
|
||||
import top.continew.admin.schedule.model.req.JobReq;
|
||||
import top.continew.admin.schedule.model.req.JobStatusReq;
|
||||
import top.continew.admin.schedule.model.req.JobTriggerReq;
|
||||
import top.continew.admin.schedule.model.resp.JobResp;
|
||||
import top.continew.admin.schedule.service.JobService;
|
||||
import top.continew.starter.extension.crud.model.resp.PageResp;
|
||||
@@ -51,8 +52,8 @@ public class JobServiceImpl implements JobService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(JobReq req) {
|
||||
return Boolean.TRUE.equals(jobClient.request(() -> jobApi.add(req)));
|
||||
public boolean create(JobReq req) {
|
||||
return Boolean.TRUE.equals(jobClient.request(() -> jobApi.create(req)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,8 +74,8 @@ public class JobServiceImpl implements JobService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger(Long id) {
|
||||
return Boolean.TRUE.equals(jobClient.request(() -> jobApi.trigger(id)));
|
||||
public boolean trigger(JobTriggerReq req) {
|
||||
return Boolean.TRUE.equals(jobClient.request(() -> jobApi.trigger(req)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user