mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 03:45:28 +08:00
JeecgBoot 2.4.2 积木报表版本发布,基于SpringBoot的低代码平台
This commit is contained in:
@ -1,16 +1,14 @@
|
||||
/*
|
||||
package org.jeecg;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class JeecgDemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JeecgDemoApplication.class, args);
|
||||
}
|
||||
}
|
||||
*/
|
||||
//package org.jeecg;
|
||||
//
|
||||
//import org.springframework.boot.SpringApplication;
|
||||
//import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
//import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
//
|
||||
//@SpringBootApplication
|
||||
//@EnableFeignClients
|
||||
//public class JeecgDemoApplication {
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// SpringApplication.run(JeecgDemoApplication.class, args);
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.VXESocketConst;
|
||||
import org.jeecg.common.system.query.MatchTypeEnum;
|
||||
|
||||
@ -175,7 +175,7 @@ public class JoaDemoController {
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param requestFieldPresenceUtil
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
* @Date 2020/1/12 17:19
|
||||
* @Description: Minio文件服务测试
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/minio")
|
||||
public class MinioController {
|
||||
|
||||
//minio服务的IP端口
|
||||
private static String url = "http://111.225.?.?:9000";
|
||||
private static String accessKey = "admin";
|
||||
private static String secretKey = "??";
|
||||
private static String bucketName = "??";
|
||||
|
||||
/**
|
||||
* 上传文件到minio服务
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("upload")
|
||||
public String upload(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
InputStream is = file.getInputStream(); //得到文件流
|
||||
String fileName = "/upload/img/" + file.getOriginalFilename(); //文件名
|
||||
String contentType = file.getContentType(); //类型
|
||||
minioClient.putObject(bucketName, fileName, is, contentType); //把文件放置Minio桶(文件夹)
|
||||
return "上传成功";
|
||||
} catch (Exception e) {
|
||||
return "上传失败";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载minio服务的文件
|
||||
*
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("download")
|
||||
public String download(HttpServletResponse response) {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
InputStream fileInputStream = minioClient.getObject(bucketName, "11.jpg");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + "11.jpg");
|
||||
response.setContentType("application/force-download");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
IOUtils.copy(fileInputStream, response.getOutputStream());
|
||||
return "下载完成";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "下载失败";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取minio文件的下载地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("url")
|
||||
public String getUrl() {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
String url = minioClient.presignedGetObject(bucketName, "11.jpg");
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "获取失败";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.MatchTypeEnum;
|
||||
import org.jeecg.common.system.query.QueryCondition;
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
package org.jeecg;
|
||||
|
||||
import org.jeecg.modules.demo.mock.MockController;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class SampleTest {
|
||||
|
||||
@Resource
|
||||
private JeecgDemoMapper jeecgDemoMapper;
|
||||
@Resource
|
||||
private IJeecgDemoService jeecgDemoService;
|
||||
// @Resource
|
||||
// private ISysDataLogService sysDataLogService;
|
||||
@Resource
|
||||
private MockController mock;
|
||||
|
||||
@Test
|
||||
public void testSelect() {
|
||||
System.out.println(("----- selectAll method test ------"));
|
||||
List<JeecgDemo> userList = jeecgDemoMapper.selectList(null);
|
||||
Assert.assertEquals(5, userList.size());
|
||||
userList.forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testXmlSql() {
|
||||
System.out.println(("----- selectAll method test ------"));
|
||||
List<JeecgDemo> userList = jeecgDemoMapper.getDemoByName("Sandy12");
|
||||
userList.forEach(System.out::println);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试事务
|
||||
*/
|
||||
@Test
|
||||
public void testTran() {
|
||||
jeecgDemoService.testTran();
|
||||
}
|
||||
|
||||
//author:lvdandan-----date:20190315---for:添加数据日志测试----
|
||||
/**
|
||||
* 测试数据日志添加
|
||||
*/
|
||||
// @Test
|
||||
// public void testDataLogSave() {
|
||||
// System.out.println(("----- datalog test ------"));
|
||||
// String tableName = "jeecg_demo";
|
||||
// String dataId = "4028ef81550c1a7901550c1cd6e70001";
|
||||
// String dataContent = mock.sysDataLogJson();
|
||||
// sysDataLogService.addDataLog(tableName, dataId, dataContent);
|
||||
// }
|
||||
//author:lvdandan-----date:20190315---for:添加数据日志测试----
|
||||
}
|
||||
Reference in New Issue
Block a user