fix(新增): Quarter的CURD和部分job类
This commit is contained in:
parent
837de6ae10
commit
48b489f4e5
|
@ -6,7 +6,7 @@ import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||||
import cn.bunny.dao.dto.schedulers.SchedulersAddDto;
|
import cn.bunny.dao.dto.schedulers.SchedulersAddDto;
|
||||||
import cn.bunny.dao.dto.schedulers.SchedulersDto;
|
import cn.bunny.dao.dto.schedulers.SchedulersDto;
|
||||||
import cn.bunny.dao.dto.schedulers.SchedulersUpdateDto;
|
import cn.bunny.dao.dto.schedulers.SchedulersUpdateDto;
|
||||||
import cn.bunny.dao.entity.view.Schedulers;
|
import cn.bunny.dao.entity.schedulers.Schedulers;
|
||||||
import cn.bunny.dao.vo.schedulers.SchedulersVo;
|
import cn.bunny.dao.vo.schedulers.SchedulersVo;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
|
@ -40,9 +40,9 @@ public class WebGeneratorCode {
|
||||||
// 生成API请求路径
|
// 生成API请求路径
|
||||||
public static String apiPath = commonPath + "\\api\\v1\\";
|
public static String apiPath = commonPath + "\\api\\v1\\";
|
||||||
// 生成vue路径
|
// 生成vue路径
|
||||||
public static String vuePath = commonPath + "\\views\\system\\";
|
public static String vuePath = commonPath + "\\views\\monitor\\";
|
||||||
// 生成仓库路径
|
// 生成仓库路径
|
||||||
public static String storePath = commonPath + "\\store\\system\\";
|
public static String storePath = commonPath + "\\store\\monitor\\";
|
||||||
// 后端controller
|
// 后端controller
|
||||||
public static String controllerPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
public static String controllerPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
||||||
public static String servicePath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
public static String servicePath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import PureTableBar from '@/components/TableBar/src/bar';
|
import PureTableBar from '@/components/TableBar/src/bar';
|
||||||
import AddFill from '@iconify-icons/ri/add-circle-line';
|
import AddFill from '@iconify-icons/ri/add-circle-line';
|
||||||
import PureTable from '@pureadmin/table';
|
import PureTable from '@pureadmin/table';
|
||||||
import { onAdd, onDelete, onSearch, onUpdate, deleteIds } from '${hookPath}';
|
import { deleteIds, onAdd, onDelete, onDeleteBatch, onSearch, onUpdate } from '${hookPath}';
|
||||||
import Delete from '@iconify-icons/ep/delete';
|
import Delete from '@iconify-icons/ep/delete';
|
||||||
import EditPen from '@iconify-icons/ep/edit-pen';
|
import EditPen from '@iconify-icons/ep/edit-pen';
|
||||||
import Refresh from '@iconify-icons/ep/refresh';
|
import Refresh from '@iconify-icons/ep/refresh';
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
import { $t } from '@/plugins/i18n';
|
import { $t } from '@/plugins/i18n';
|
||||||
import { use${originalName}Store } from '${storePath}';
|
import { use${originalName}Store } from '${storePath}';
|
||||||
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
||||||
|
import { FormInstance } from "element-plus";
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
@ -99,6 +100,7 @@ onMounted(() => {
|
||||||
table-layout="auto"
|
table-layout="auto"
|
||||||
:pagination="${lowercaseName}Store.pagination"
|
:pagination="${lowercaseName}Store.pagination"
|
||||||
@page-size-change="onPageSizeChange"
|
@page-size-change="onPageSizeChange"
|
||||||
|
@selection-change="onSelectionChange"
|
||||||
@page-current-change="onCurrentPageChange"
|
@page-current-change="onCurrentPageChange"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ onMounted(() => {
|
||||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||||
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary" @click="onAdd"> {{ $t('add_new') }} </el-button>
|
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary" @click="onAdd"> {{ $t('add_new') }} </el-button>
|
||||||
<!-- TODO 待完成 -->
|
<!-- TODO 待完成 -->
|
||||||
<el-popconfirm :title="`${$t('delete')}${row.email}?`" @confirm="onDelete(row)">
|
<el-popconfirm :title="`${leftBrace}$t('delete')}${row.email}?`" @confirm="onDelete(row)">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||||
{{ $t('delete') }}
|
{{ $t('delete') }}
|
||||||
|
|
|
@ -53,3 +53,4 @@ public class SchedulersAddDto {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.bunny.dao.dto.schedulers;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "SchedulersOperationDto对象", title = "Schedulers公共操作表单", description = "Schedulers公共操作表单")
|
||||||
|
public class SchedulersOperationDto {
|
||||||
|
|
||||||
|
@Schema(name = "jobName", title = "任务名称")
|
||||||
|
@NotBlank(message = "任务名称不能为空")
|
||||||
|
@NotNull(message = "任务名称不能为空")
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
@Schema(name = "jobGroup", title = "任务分组")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobGroup;
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.entity.view;
|
package cn.bunny.dao.entity.schedulers;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
@ -1,48 +1,94 @@
|
||||||
package cn.bunny.services.controller;
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.schedulers.SchedulersAddDto;
|
import cn.bunny.dao.dto.schedulers.SchedulersAddDto;
|
||||||
import cn.bunny.dao.entity.view.Schedulers;
|
import cn.bunny.dao.dto.schedulers.SchedulersDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersOperationDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersUpdateDto;
|
||||||
|
import cn.bunny.dao.entity.schedulers.Schedulers;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.pojo.result.Result;
|
import cn.bunny.dao.pojo.result.Result;
|
||||||
|
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||||
|
import cn.bunny.dao.vo.schedulers.SchedulersVo;
|
||||||
import cn.bunny.services.service.SchedulersService;
|
import cn.bunny.services.service.SchedulersService;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* VIEW 前端控制器
|
* Schedulers视图表 前端控制器
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-10-14
|
* @since 2024-10-14 20:59:25
|
||||||
*/
|
*/
|
||||||
@Tag(name = "定时任务", description = "定时任务相关接口")
|
@Tag(name = "Schedulers视图", description = "Schedulers视图相关接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("admin/schedulers")
|
@RequestMapping("admin/schedulers")
|
||||||
public class SchedulersController {
|
public class SchedulersController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SchedulersService schedulersService;
|
private SchedulersService schedulersService;
|
||||||
|
|
||||||
@Operation(summary = "分页查询所有任务", description = "分页查询所有任务")
|
@Operation(summary = "分页查询Schedulers视图", description = "分页查询Schedulers视图")
|
||||||
@PostMapping("getSchedulerList/{page}/{limit}")
|
@GetMapping("getSchedulersList/{page}/{limit}")
|
||||||
public Result<PageResult<Schedulers>> getSchedulerList(
|
public Mono<Result<PageResult<SchedulersVo>>> getSchedulersList(
|
||||||
@Parameter(name = "page", description = "当前页", required = true)
|
@Parameter(name = "page", description = "当前页", required = true)
|
||||||
@PathVariable("page") Integer page,
|
@PathVariable("page") Integer page,
|
||||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||||
@PathVariable("limit") Integer limit) {
|
@PathVariable("limit") Integer limit,
|
||||||
|
SchedulersDto dto) {
|
||||||
Page<Schedulers> pageParams = new Page<>(page, limit);
|
Page<Schedulers> pageParams = new Page<>(page, limit);
|
||||||
PageResult<Schedulers> pageResult = schedulersService.getSchedulerList(pageParams);
|
PageResult<SchedulersVo> pageResult = schedulersService.getSchedulersList(pageParams, dto);
|
||||||
return Result.success(pageResult);
|
return Mono.just(Result.success(pageResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "添加任务", description = "添加任务")
|
@Operation(summary = "添加Schedulers视图", description = "添加Schedulers视图")
|
||||||
@PostMapping("/addScheduler")
|
@PostMapping("addSchedulers")
|
||||||
public Result<String> addScheduler(@RequestBody SchedulersAddDto dto) {
|
public Mono<Result<String>> addSchedulers(@Valid @RequestBody SchedulersAddDto dto) {
|
||||||
schedulersService.addScheduler(dto);
|
schedulersService.addSchedulers(dto);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新Schedulers视图", description = "更新Schedulers视图")
|
||||||
|
@PutMapping("updateSchedulers")
|
||||||
|
public Mono<Result<String>> updateSchedulers(@Valid @RequestBody SchedulersUpdateDto dto) {
|
||||||
|
schedulersService.updateSchedulers(dto);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除Schedulers视图", description = "删除Schedulers视图")
|
||||||
|
@DeleteMapping("deleteSchedulers")
|
||||||
|
public Mono<Result<String>> deleteSchedulers(@RequestBody List<Long> ids) {
|
||||||
|
schedulersService.deleteSchedulers(ids);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "暂停Schedulers任务", description = "暂停任务")
|
||||||
|
@PutMapping("/pauseScheduler")
|
||||||
|
public Result<String> pause(@RequestBody SchedulersOperationDto dto) {
|
||||||
|
schedulersService.pauseScheduler(dto);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "恢复Schedulers任务", description = "恢复任务")
|
||||||
|
@PutMapping("/resumeScheduler")
|
||||||
|
public Result<String> resume(@RequestBody SchedulersOperationDto dto) {
|
||||||
|
schedulersService.resumeScheduler(dto);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "移出Schedulers任务", description = "移出任务")
|
||||||
|
@DeleteMapping("/removeScheduler")
|
||||||
|
public Result<String> remove(@RequestBody SchedulersOperationDto dto) {
|
||||||
|
schedulersService.removeScheduler(dto);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,39 @@
|
||||||
package cn.bunny.services.mapper;
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
import cn.bunny.dao.entity.view.Schedulers;
|
import cn.bunny.dao.dto.schedulers.SchedulersDto;
|
||||||
|
import cn.bunny.dao.entity.schedulers.Schedulers;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* VIEW Mapper 接口
|
* Schedulers视图 Mapper 接口
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-10-14
|
* @since 2024-10-14 20:59:25
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SchedulersMapper extends BaseMapper<Schedulers> {
|
public interface SchedulersMapper extends BaseMapper<Schedulers> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 分页查询Schedulers视图内容
|
||||||
|
*
|
||||||
|
* @param pageParams Schedulers视图分页参数
|
||||||
|
* @param dto Schedulers视图查询表单
|
||||||
|
* @return Schedulers视图分页结果
|
||||||
|
*/
|
||||||
|
IPage<Schedulers> selectListByPage(@Param("page") Page<Schedulers> pageParams, @Param("dto") SchedulersDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物理删除Schedulers视图
|
||||||
|
*
|
||||||
|
* @param ids 删除 id 列表
|
||||||
|
*/
|
||||||
|
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.bunny.services.quartz.job;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class JobHello implements Job {
|
||||||
|
public void start() {
|
||||||
|
log.error("执行任务--JobHello。。。。。。。。。");
|
||||||
|
System.out.print("执行任务--JobHello。。。。。。。。。");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.bunny.services.quartz.job;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class JobHello2 implements Job {
|
||||||
|
public void start() {
|
||||||
|
log.error("执行任务---JobHello2。。。。。。。。。");
|
||||||
|
System.out.print("执行任务--JobHello2。。。。。。。。。");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,74 @@
|
||||||
package cn.bunny.services.service;
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
import cn.bunny.dao.entity.view.Schedulers;
|
import cn.bunny.dao.dto.schedulers.SchedulersAddDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersOperationDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersUpdateDto;
|
||||||
|
import cn.bunny.dao.entity.schedulers.Schedulers;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.vo.schedulers.SchedulersVo;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* VIEW 服务类
|
* Schedulers视图 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-10-14
|
* @since 2024-10-14 20:59:25
|
||||||
*/
|
*/
|
||||||
public interface SchedulersService extends IService<Schedulers> {
|
public interface SchedulersService extends IService<Schedulers> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 获取Schedulers视图列表
|
||||||
|
*
|
||||||
|
* @return Schedulers视图返回列表
|
||||||
|
*/
|
||||||
|
PageResult<SchedulersVo> getSchedulersList(Page<Schedulers> pageParams, SchedulersDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 添加Schedulers视图
|
||||||
|
*
|
||||||
|
* @param dto 添加表单
|
||||||
|
*/
|
||||||
|
void addSchedulers(@Valid SchedulersAddDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 更新Schedulers视图
|
||||||
|
*
|
||||||
|
* @param dto 更新表单
|
||||||
|
*/
|
||||||
|
void updateSchedulers(@Valid SchedulersUpdateDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 删除|批量删除Schedulers视图类型
|
||||||
|
*
|
||||||
|
* @param ids 删除id列表
|
||||||
|
*/
|
||||||
|
void deleteSchedulers(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 暂停Schedulers任务
|
||||||
|
*
|
||||||
|
* @param dto Schedulers公共操作表单
|
||||||
|
*/
|
||||||
|
void pauseScheduler(SchedulersOperationDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 恢复Schedulers任务
|
||||||
|
*
|
||||||
|
* @param dto Schedulers公共操作表单
|
||||||
|
*/
|
||||||
|
void resumeScheduler(SchedulersOperationDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 移出Schedulers任务
|
||||||
|
*
|
||||||
|
* @param dto Schedulers公共操作表单
|
||||||
|
*/
|
||||||
|
void removeScheduler(SchedulersOperationDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,123 @@
|
||||||
package cn.bunny.services.service.impl;
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
import cn.bunny.dao.entity.view.Schedulers;
|
import cn.bunny.dao.dto.schedulers.SchedulersAddDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersOperationDto;
|
||||||
|
import cn.bunny.dao.dto.schedulers.SchedulersUpdateDto;
|
||||||
|
import cn.bunny.dao.entity.schedulers.Schedulers;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.vo.schedulers.SchedulersVo;
|
||||||
import cn.bunny.services.mapper.SchedulersMapper;
|
import cn.bunny.services.mapper.SchedulersMapper;
|
||||||
import cn.bunny.services.service.SchedulersService;
|
import cn.bunny.services.service.SchedulersService;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* VIEW 服务实现类
|
* Schedulers视图 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Bunny
|
* @author Bunny
|
||||||
* @since 2024-10-14
|
* @since 2024-10-14 20:59:25
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SchedulersServiceImpl extends ServiceImpl<SchedulersMapper, Schedulers> implements SchedulersService {
|
public class SchedulersServiceImpl extends ServiceImpl<SchedulersMapper, Schedulers> implements SchedulersService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * Schedulers视图 服务实现类
|
||||||
|
*
|
||||||
|
* @param pageParams Schedulers视图分页查询page对象
|
||||||
|
* @param dto Schedulers视图分页查询对象
|
||||||
|
* @return 查询分页Schedulers视图返回对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<SchedulersVo> getSchedulersList(Page<Schedulers> pageParams, SchedulersDto dto) {
|
||||||
|
// 分页查询菜单图标
|
||||||
|
IPage<Schedulers> page = baseMapper.selectListByPage(pageParams, dto);
|
||||||
|
|
||||||
|
List<SchedulersVo> voList = page.getRecords().stream().map(schedulers -> {
|
||||||
|
SchedulersVo schedulersVo = new SchedulersVo();
|
||||||
|
BeanUtils.copyProperties(schedulers, schedulersVo);
|
||||||
|
return schedulersVo;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return PageResult.<SchedulersVo>builder()
|
||||||
|
.list(voList)
|
||||||
|
.pageNo(page.getCurrent())
|
||||||
|
.pageSize(page.getSize())
|
||||||
|
.total(page.getTotal())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加Schedulers视图
|
||||||
|
*
|
||||||
|
* @param dto Schedulers视图添加
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addSchedulers(@Valid SchedulersAddDto dto) {
|
||||||
|
// 保存数据
|
||||||
|
Schedulers schedulers = new Schedulers();
|
||||||
|
BeanUtils.copyProperties(dto, schedulers);
|
||||||
|
save(schedulers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新Schedulers视图
|
||||||
|
*
|
||||||
|
* @param dto Schedulers视图更新
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateSchedulers(@Valid SchedulersUpdateDto dto) {
|
||||||
|
// 更新内容
|
||||||
|
Schedulers schedulers = new Schedulers();
|
||||||
|
BeanUtils.copyProperties(dto, schedulers);
|
||||||
|
updateById(schedulers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除|批量删除Schedulers视图
|
||||||
|
*
|
||||||
|
* @param ids 删除id列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteSchedulers(List<Long> ids) {
|
||||||
|
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 暂停Schedulers任务
|
||||||
|
*
|
||||||
|
* @param dto Schedulers公共操作表单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void pauseScheduler(SchedulersOperationDto dto) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 恢复Schedulers任务
|
||||||
|
*
|
||||||
|
* @param dto Schedulers公共操作表单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void resumeScheduler(SchedulersOperationDto dto) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 移出Schedulers任务
|
||||||
|
*
|
||||||
|
* @param dto Schedulers公共操作表单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeScheduler(SchedulersOperationDto dto) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
<mapper namespace="cn.bunny.services.mapper.SchedulersMapper">
|
<mapper namespace="cn.bunny.services.mapper.SchedulersMapper">
|
||||||
|
|
||||||
<!-- 通用查询映射结果 -->
|
<!-- 通用查询映射结果 -->
|
||||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.view.Schedulers">
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.schedulers.Schedulers">
|
||||||
<result column="job_name" property="jobName"/>
|
<id column="job_name" property="jobName"/>
|
||||||
<result column="job_group" property="jobGroup"/>
|
<id column="job_group" property="jobGroup"/>
|
||||||
<result column="description" property="description"/>
|
<id column="description" property="description"/>
|
||||||
<result column="job_class_name" property="jobClassName"/>
|
<id column="job_class_name" property="jobClassName"/>
|
||||||
<result column="cron_expression" property="cronExpression"/>
|
<id column="cron_expression" property="cronExpression"/>
|
||||||
<result column="trigger_name" property="triggerName"/>
|
<id column="trigger_name" property="triggerName"/>
|
||||||
<result column="trigger_state" property="triggerState"/>
|
<id column="trigger_state" property="triggerState"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
|
@ -18,4 +18,42 @@
|
||||||
job_name, job_group, description, job_class_name, cron_expression, trigger_name, trigger_state
|
job_name, job_group, description, job_class_name, cron_expression, trigger_name, trigger_state
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询Schedulers视图内容 -->
|
||||||
|
<select id="selectListByPage" resultType="cn.bunny.dao.entity.schedulers.Schedulers">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from v_schedulers
|
||||||
|
<where>
|
||||||
|
<if test="dto.jobName != null and dto.jobName != ''">
|
||||||
|
and job_name like CONCAT('%',#{dto.jobName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.jobGroup != null and dto.jobGroup != ''">
|
||||||
|
and job_group like CONCAT('%',#{dto.jobGroup},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.description != null and dto.description != ''">
|
||||||
|
and description like CONCAT('%',#{dto.description},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.jobClassName != null and dto.jobClassName != ''">
|
||||||
|
and job_class_name like CONCAT('%',#{dto.jobClassName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.triggerName != null and dto.triggerName != ''">
|
||||||
|
and trigger_name like CONCAT('%',#{dto.triggerName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.triggerState != null and dto.triggerState != ''">
|
||||||
|
and trigger_state like CONCAT('%',#{dto.triggerState},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by update_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 物理删除Schedulers视图 -->
|
||||||
|
<delete id="deleteBatchIdsWithPhysics">
|
||||||
|
delete
|
||||||
|
from v_schedulers
|
||||||
|
where id in
|
||||||
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue