JeecgBoot 3.1.0 版本发布,基于代码生成器的企业级低代码平台

This commit is contained in:
zhangdaiscott
2022-02-24 15:13:05 +08:00
parent 8c143f35f8
commit f8c7ddd223
304 changed files with 40313 additions and 230872 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>jeecg-boot-parent</artifactId>
<groupId>org.jeecgframework.boot</groupId>
<version>3.0</version>
<version>3.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -31,7 +31,7 @@ public class MockController {
* @return
*/
@RequestMapping(value = "/json/{filename}", method = RequestMethod.GET)
public String getJsonData(@PathVariable String filename) {
public String getJsonData(@PathVariable("filename") String filename) {
String jsonpath = "classpath:org/jeecg/modules/demo/mock/json/"+filename+".json";
return readJson(jsonpath);
}

View File

@ -0,0 +1,117 @@
package org.jeecg.modules.demo.online;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* Online表单开发 demo 示例
*
* @author sunjianlei
* @date 2021-12-16
*/
@Slf4j
@RestController("onlCgformDemoController")
@RequestMapping("/demo/online/cgform")
public class OnlCgformDemoController {
/**
* Online表单 http 增强list增强示例
* @param params
* @return
*/
@PostMapping("/enhanceJavaListHttp")
public Result<?> enhanceJavaListHttp(@RequestBody JSONObject params) {
log.info(" --- params" + params.toJSONString());
JSONArray dataList = params.getJSONArray("dataList");
List<DictModel> dict = virtualDictData();
for (int i = 0; i < dataList.size(); i++) {
JSONObject record = dataList.getJSONObject(i);
String province = record.getString("province");
if (province == null) {
continue;
}
String text = dict.stream()
.filter(p -> province.equals(p.getValue()))
.map(DictModel::getText)
.findAny()
.orElse(province);
record.put("province", text);
}
Result<?> res = Result.OK(dataList);
res.setCode(1);
return res;
}
/**
* 模拟字典数据
*
* @return
*/
private List<DictModel> virtualDictData() {
List<DictModel> dict = new ArrayList<>();
dict.add(new DictModel("bj", "北京"));
dict.add(new DictModel("sd", "山东"));
dict.add(new DictModel("ah", "安徽"));
return dict;
}
/**
* Online表单 http 增强add、edit增强示例
* @param params
* @return
*/
@PostMapping("/enhanceJavaHttp")
public Result<?> enhanceJavaHttp(@RequestBody JSONObject params) {
log.info(" --- params" + params.toJSONString());
String tableName = params.getString("tableName");
JSONObject record = params.getJSONObject("record");
/*
* 业务场景一: 获取提交表单数据,进行其他业务关联操作
* (比如:根据入库单,同步更改库存)
*/
log.info(" --- tableName" + tableName);
log.info(" --- 行数据:" + record.toJSONString());
/*
* 业务场景二: 保存数据之前进行数据的校验
* 直接返回错误状态即可
*/
String phone = record.getString("phone");
if (oConvertUtils.isEmpty(phone)) {
return Result.error("手机号不能为空!");
}
/*
* 业务场景三: 保存数据之对数据的处理
* 直接操作 record 即可
*/
record.put("phone", "010-" + phone);
/* 其他业务场景自行实现 */
// 返回场景一: 不对 record 做任何修改的情况下,可以直接返回 code
// 返回 0 = 丢弃当前数据
// 返回 1 = 新增当前数据
// 返回 2 = 修改当前数据 TODO存疑
// return Result.OK(1);
// 返回场景二: 需要对 record 做修改的情况下需要返回一个JSONObject对象或者Map也行
JSONObject res = new JSONObject();
res.put("code", 1);
// 将 record 返回以进行修改
res.put("record", record);
// TODO 不要 code 的概念
return Result.OK(res);
}
}

View File

@ -59,9 +59,10 @@ public class JeecgDemoController extends JeecgController<JeecgDemo, IJeecgDemoSe
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
@GetMapping(value = "/list")
@PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
public Result<IPage<JeecgDemo>> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);
IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
@ -92,9 +93,9 @@ public class JeecgDemoController extends JeecgController<JeecgDemo, IJeecgDemoSe
* @param jeecgDemo
* @return
*/
@PutMapping(value = "/edit")
@ApiOperation(value = "编辑DEMO", notes = "编辑DEMO")
@AutoLog(value = "编辑DEMO", operateType = CommonConstant.OPERATE_TYPE_3)
@ApiOperation(value = "编辑DEMO", notes = "编辑DEMO")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit(@RequestBody JeecgDemo jeecgDemo) {
jeecgDemoService.updateById(jeecgDemo);
return Result.OK("更新成功!");
@ -316,5 +317,9 @@ public class JeecgDemoController extends JeecgController<JeecgDemo, IJeecgDemoSe
return Result.OK("1");
}
@GetMapping(value = "/hello")
public String hello(HttpServletRequest req) {
return "hello world!";
}
}

View File

@ -1,10 +1,9 @@
package org.jeecg.modules.demo.test.controller;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
@ -16,20 +15,10 @@ import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
import org.jeecg.modules.demo.test.vo.JeecgOrderMainPage;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
/**
* @Description: 一对多示例ERP TAB风格
@ -40,7 +29,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/test/order")
public class JeecgOrderTabMainController {
public class JeecgOrderErpMainController {
@Autowired
private IJeecgOrderMainService jeecgOrderMainService;
@ -89,7 +78,7 @@ public class JeecgOrderTabMainController {
* @param jeecgOrderMainPage
* @return
*/
@PutMapping("/edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
JeecgOrderMain jeecgOrderMain = new JeecgOrderMain();
BeanUtils.copyProperties(jeecgOrderMainPage, jeecgOrderMain);
@ -186,7 +175,7 @@ public class JeecgOrderTabMainController {
* @param jeecgOrderCustomer
* @return
*/
@PutMapping("/editCustomer")
@RequestMapping(value = "/editCustomer", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> editCustomer(@RequestBody JeecgOrderCustomer jeecgOrderCustomer) {
jeecgOrderCustomerService.updateById(jeecgOrderCustomer);
return Result.ok("添加成功!");
@ -234,7 +223,7 @@ public class JeecgOrderTabMainController {
* @param jeecgOrderTicket
* @return
*/
@PutMapping("/editTicket")
@RequestMapping(value = "/editTicket", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> editTicket(@RequestBody JeecgOrderTicket jeecgOrderTicket) {
jeecgOrderTicketService.updateById(jeecgOrderTicket);
return Result.ok("编辑成功!");

View File

@ -104,7 +104,7 @@ public class JeecgOrderMainController extends JeecgController<JeecgOrderMain, IJ
* @param jeecgOrderMainPage
* @return
*/
@PutMapping(value = "/edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> eidt(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
JeecgOrderMain jeecgOrderMain = new JeecgOrderMain();
BeanUtils.copyProperties(jeecgOrderMainPage, jeecgOrderMain);