126 lines
3.8 KiB
Java
126 lines
3.8 KiB
Java
package com.muyu.controller;
|
||
|
||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||
import com.muyu.common.core.domain.Result;
|
||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||
import com.muyu.common.core.web.controller.BaseController;
|
||
import com.muyu.domain.EngineMaintenance;
|
||
import com.muyu.domain.EngineVersion;
|
||
import com.muyu.domain.constants.PageResult;
|
||
import com.muyu.req.EngineMaintenanceQueryReq;
|
||
import com.muyu.req.EngineVersionListResp;
|
||
import com.muyu.service.EngIneService;
|
||
import jakarta.servlet.http.HttpServletResponse;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.web.bind.annotation.*;
|
||
|
||
import java.util.List;
|
||
|
||
/**
|
||
* @Author:qdm
|
||
* @Package:com.muyu.controller
|
||
* @Project:cloud-etl-engine
|
||
* @name:EngIneController
|
||
* @Date:2024/8/22 15:36
|
||
*/
|
||
@RestController
|
||
@RequestMapping("/engine")
|
||
public class EngIneController extends BaseController {
|
||
|
||
@Autowired
|
||
EngIneService engIneService;
|
||
|
||
@PostMapping("/getMaintenanceList")
|
||
public Result<PageResult<EngineMaintenance>> getMaintenanceList(@RequestBody EngineMaintenanceQueryReq engineMaintenanceQueryReq) {
|
||
return engIneService.getMaintenanceList(engineMaintenanceQueryReq);
|
||
}
|
||
|
||
public static void main(String[] args) {
|
||
System.out.println("你好");
|
||
}
|
||
|
||
|
||
@PostMapping("/delete/{id}")
|
||
public Integer remove(@PathVariable Long id) {
|
||
return engIneService.deletes(id);
|
||
}
|
||
|
||
@PostMapping("/update")
|
||
public Result<EngineMaintenance> update(@RequestBody EngineMaintenance engineMaintenance) {
|
||
return engIneService.updateMsg(engineMaintenance);
|
||
}
|
||
|
||
|
||
@PostMapping("/insert")
|
||
public Result<EngineMaintenance> insert(@RequestBody EngineMaintenance engineMaintenance) {
|
||
return engIneService.add(engineMaintenance);
|
||
}
|
||
|
||
/**
|
||
* 查询规则引擎版本列表
|
||
*/
|
||
@PutMapping("/getRuleEngineInfo/{id}")
|
||
public Result getRuleEngineInfo(@PathVariable(name = "id") Long id) {
|
||
EngineVersionListResp engineConfigListResp = engIneService.getRuleEngineInfo(id);
|
||
return Result.success(engineConfigListResp);
|
||
}
|
||
|
||
/**
|
||
* 导出
|
||
*/
|
||
@PostMapping("/export")
|
||
public void export(HttpServletResponse httpServletResponse, EngineMaintenance engineMaintenance) {
|
||
List<EngineMaintenance> list = engIneService.list();
|
||
ExcelUtil<EngineMaintenance> engineMaintenanceExcelUtil = new ExcelUtil<>(EngineMaintenance.class);
|
||
engineMaintenanceExcelUtil.exportExcel(httpServletResponse, list, "规则引擎版本");
|
||
}
|
||
|
||
/**
|
||
* 通过引擎维护编号禁用引擎
|
||
*/
|
||
@PostMapping("/forbiddenEngine/{id}")
|
||
public Result forbiddenEngine(@PathVariable Integer id) {
|
||
engIneService.forbiddenEngine(id);
|
||
return Result.success();
|
||
}
|
||
|
||
/**
|
||
* 通过引擎维护编号开启引擎
|
||
*/
|
||
@PostMapping("/onEngine/{id}")
|
||
public Result onEngine(@PathVariable Integer id) {
|
||
engIneService.onEngine(id);
|
||
return Result.success();
|
||
}
|
||
|
||
/**
|
||
* 通过引擎维护编号关闭引擎
|
||
*/
|
||
@PostMapping("/closeEngine/{id}")
|
||
public Result closeEngine(@PathVariable Integer id) {
|
||
engIneService.closeEngine(id);
|
||
return Result.success();
|
||
}
|
||
|
||
/**
|
||
* 通过引擎维护编号激活引擎
|
||
*/
|
||
@PostMapping("/activateEngine/{id}")
|
||
public Result activateEngine(@PathVariable Integer id) {
|
||
engIneService.activateEngine(id);
|
||
return Result.success();
|
||
}
|
||
|
||
/**
|
||
* 通过id查询
|
||
* @param id
|
||
* @return
|
||
*/
|
||
@GetMapping("/findById/{id}")
|
||
public Result findById(@PathVariable Long id){
|
||
return Result.success(engIneService.list(new LambdaQueryWrapper<>(){{
|
||
eq(EngineMaintenance::getId,id);
|
||
}}));
|
||
}
|
||
}
|