Changes
parent
267c268179
commit
7031956488
|
@ -1,6 +1,7 @@
|
||||||
package rule.domain;
|
package rule.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
@ -23,31 +24,32 @@ public class Rule {
|
||||||
/**
|
/**
|
||||||
* 规则ID
|
* 规则ID
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "规则ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 规则名称
|
* 规则名称
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "规则名称")
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 规则类型
|
* 规则类型
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "规则类型")
|
||||||
private String ruleType;
|
private String ruleType;
|
||||||
/**
|
/**
|
||||||
* 是否激活
|
* 是否激活
|
||||||
*/
|
*/
|
||||||
|
@Excel(name ="是否激活")
|
||||||
private String isActivate;
|
private String isActivate;
|
||||||
/**
|
/**
|
||||||
* 规则描述
|
* 规则描述
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "规则描述")
|
||||||
private String ruleDesc;
|
private String ruleDesc;
|
||||||
/**
|
/**
|
||||||
* 规则代码
|
* 规则代码
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "规则描述")
|
||||||
private String ruleCode;
|
private String ruleCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.rule.compile;
|
||||||
|
|
||||||
|
import javax.tools.JavaCompiler;
|
||||||
|
import javax.tools.ToolProvider;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
public class SourceCodeCompiler {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
|
int result = compiler.run(null, null, null, "D:\\ll\\Test.java");
|
||||||
|
System.out.println(result == 0 ? "编译成功" : "编译失败");
|
||||||
|
|
||||||
|
//执行java 命令 , 空参数, 所在文件夹
|
||||||
|
Process process = Runtime.getRuntime().exec("java Test", null, new File("D:\\ll\\"));
|
||||||
|
|
||||||
|
|
||||||
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
String str;
|
||||||
|
while ((str = bufferedReader.readLine()) != null) {
|
||||||
|
System.out.println(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,14 @@
|
||||||
package com.muyu.rule.controller;
|
package com.muyu.rule.controller;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.rule.service.RuleService;
|
import com.muyu.rule.service.RuleService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
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 rule.domain.Rule;
|
import rule.domain.Rule;
|
||||||
|
@ -66,5 +72,17 @@ public class RuleController {
|
||||||
return Result.success(ruleService.save(rule));
|
return Result.success(ruleService.save(rule));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
* @param response
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export (HttpServletResponse response, Rule rule) {
|
||||||
|
List<Rule> list = ruleService.select(rule);
|
||||||
|
ExcelUtil<Rule> util = new ExcelUtil<Rule>(Rule.class);
|
||||||
|
util.exportExcel(response, list, "规则");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue