mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2026-09-10 19:27:20 +08:00
v3.0 beta version
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<!-- Bootstrap 4 -->
|
||||
<link href="//cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="//cdn.staticfile.org/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Font Awesome -->
|
||||
<link href="//cdn.staticfile.org/font-awesome/5.11.2/css/fontawesome.min.css" rel="stylesheet">
|
||||
<!-- Ionicons -->
|
||||
<link href="//cdn.staticfile.org/ionicons/4.5.6/css/ionicons.min.css" rel="stylesheet">
|
||||
|
||||
<link href="//cdn.staticfile.org/codemirror/5.48.4/codemirror.min.css" rel="stylesheet">
|
||||
<link href="//cdn.staticfile.org/codemirror/5.58.3/codemirror.min.css" rel="stylesheet">
|
||||
|
||||
<link href="//cdn.bootcss.com/jquery-toast-plugin/1.3.2/jquery.toast.min.css" rel="stylesheet">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<script src="//cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<script>var base_url = '${request.contextPath}';</script>
|
||||
<script>const base_url = '${request.contextPath}';</script>
|
||||
|
||||
</#macro>
|
||||
|
||||
@@ -33,16 +33,14 @@
|
||||
<!-- jQuery -->
|
||||
<script src="//cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
|
||||
<!-- Bootstrap -->
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/4.5.3/js/bootstrap.min.js"></script>
|
||||
<script src="//cdn.bootcss.com/jquery-toast-plugin/1.3.2/jquery.toast.min.js"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="//cdn.staticfile.org/fastclick/1.0.6/fastclick.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/jQuery-slimScroll/1.3.8/jquery.slimscroll.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.48.4/codemirror.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.48.4/addon/display/placeholder.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.48.4/mode/clike/clike.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.48.4/mode/sql/sql.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.48.4/mode/xml/xml.min.js"></script>
|
||||
<!-- codemirror -->
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/codemirror.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/addon/display/placeholder.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/mode/clike/clike.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/mode/sql/sql.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/mode/xml/xml.min.js"></script>
|
||||
</#macro>
|
||||
|
||||
|
||||
@@ -0,0 +1,451 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="utf-8">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>SQL转Java JPA、MYBATIS实现类代码生成平台</title>
|
||||
<meta name="keywords" content="sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现">
|
||||
|
||||
<#import "common/common-import.ftl" as netCommon>
|
||||
<@netCommon.commonStyle />
|
||||
<@netCommon.commonScript />
|
||||
|
||||
<script>
|
||||
|
||||
<@netCommon.viewerCounter />
|
||||
|
||||
$(function () {
|
||||
/**
|
||||
* 初始化SQL AREA
|
||||
*/
|
||||
const ddlSqlArea = CodeMirror.fromTextArea(document.getElementById("ddlSqlArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-sql",
|
||||
lineWrapping: false,
|
||||
readOnly: false,
|
||||
foldGutter: true,
|
||||
//keyMap:"sublime",
|
||||
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
ddlSqlArea.setSize('auto','auto');
|
||||
/**
|
||||
* 初始化CODE AREA
|
||||
*/
|
||||
const genCodeArea = CodeMirror.fromTextArea(document.getElementById("genCodeArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping: true,
|
||||
readOnly: false,
|
||||
foldGutter: true,
|
||||
//keyMap:"sublime",
|
||||
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
genCodeArea.setSize('auto','auto');
|
||||
|
||||
let codeData;
|
||||
// 使用:var jsonObj = $("#formId").serializeObject();
|
||||
$.fn.serializeObject = function()
|
||||
{
|
||||
const o = {};
|
||||
const a = this.serializeArray();
|
||||
$.each(a, function() {
|
||||
if (o[this.name]) {
|
||||
if (!o[this.name].push) {
|
||||
o[this.name] = [o[this.name]];
|
||||
}
|
||||
o[this.name].push(this.value || '');
|
||||
} else {
|
||||
o[this.name] = this.value || '';
|
||||
}
|
||||
});
|
||||
return o;
|
||||
};
|
||||
let historyCount = 0;
|
||||
//初始化清除session
|
||||
if (window.sessionStorage){
|
||||
//修复当F5刷新的时候,session没有清空各个值,但是页面的button没了。
|
||||
sessionStorage.clear();
|
||||
}
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
$('#btnGenCode').click(function () {
|
||||
const jsonData = {
|
||||
"tableSql": ddlSqlArea.getValue(),
|
||||
"packageName": $("#packageName").val(),
|
||||
"returnUtil": $("#returnUtil").val(),
|
||||
"authorName": $("#authorName").val(),
|
||||
"dataType": $("#dataType").val(),
|
||||
"tinyintTransType": $("#tinyintTransType").val(),
|
||||
"nameCaseType": $("#nameCaseType").val(),
|
||||
"swagger": $("#isSwagger").val(),
|
||||
"timeTransType": $("#timeTransType").val(),
|
||||
"packageType": $("#packageType").val()
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + "/genCode",
|
||||
data:(JSON.stringify(jsonData)),
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
codeData = data.data;
|
||||
genCodeArea.setValue(codeData.beetlentity);
|
||||
genCodeArea.setSize('auto', 'auto');
|
||||
$.toast("√ 代码生成成功");
|
||||
//添加历史记录
|
||||
addHistory(codeData);
|
||||
} else {
|
||||
$.toast("× 代码生成失败 :"+data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
/**
|
||||
* 切换历史记录
|
||||
*/
|
||||
function getHistory(tableName){
|
||||
if (window.sessionStorage){
|
||||
const valueSession = sessionStorage.getItem(tableName);
|
||||
codeData = JSON.parse(valueSession);
|
||||
$.toast("$ 切换历史记录成功:"+tableName);
|
||||
genCodeArea.setValue(codeData.entity);
|
||||
}else{
|
||||
console.log("浏览器不支持sessionStorage");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 添加历史记录
|
||||
*/
|
||||
function addHistory(data){
|
||||
if (window.sessionStorage){
|
||||
//console.log(historyCount);
|
||||
if(historyCount>=9){
|
||||
$("#history").find(".btn:last").remove();
|
||||
historyCount--;
|
||||
}
|
||||
const tableName = data.tableName;
|
||||
const valueSession = sessionStorage.getItem(tableName);
|
||||
if(valueSession!==undefined && valueSession!=null){
|
||||
sessionStorage.removeItem(tableName);
|
||||
}else{
|
||||
$("#history").prepend('<button id="his-'+tableName+'" type="button" class="btn">'+tableName+'</button>');
|
||||
//$("#history").prepend('<button id="his-'+tableName+'" onclick="getHistory(\''+tableName+'\');" type="button" class="btn">'+tableName+'</button>');
|
||||
$("#his-"+tableName).bind('click', function () {getHistory(tableName)});
|
||||
}
|
||||
sessionStorage.setItem(tableName,JSON.stringify(data));
|
||||
historyCount++;
|
||||
}else{
|
||||
console.log("浏览器不支持sessionStorage");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钮事件组
|
||||
*/
|
||||
$('.generator').bind('click', function () {
|
||||
if (!$.isEmptyObject(codeData)) {
|
||||
const id = this.id;
|
||||
genCodeArea.setValue(codeData[id]);
|
||||
genCodeArea.setSize('auto', 'auto');
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 捐赠
|
||||
*/
|
||||
function donate(){
|
||||
if($("#donate").attr("show")=="no"){
|
||||
$("#donate").html('<img src="https://raw.githubusercontent.com/moshowgame/SpringBootCodeGenerator/master/donate.png"></img>');
|
||||
$("#donate").attr("show","yes");
|
||||
}else{
|
||||
$("#donate").html('<p>谢谢赞赏!</p>');
|
||||
$("#donate").attr("show","no");
|
||||
}
|
||||
}
|
||||
$('#donate1').on('click', function(){
|
||||
donate();
|
||||
});
|
||||
$('#donate2').on('click', function(){
|
||||
donate();
|
||||
});
|
||||
$('#btnCopy').on('click', function(){
|
||||
if(!$.isEmptyObject(genCodeArea.getValue())&&!$.isEmptyObject(navigator)&&!$.isEmptyObject(navigator.clipboard)){
|
||||
navigator.clipboard.writeText(genCodeArea.getValue());
|
||||
$.toast("√ 复制成功");
|
||||
}
|
||||
});
|
||||
|
||||
function getVersion(){
|
||||
let gitVersion;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "https://raw.githubusercontent.com/moshowgame/SpringBootCodeGenerator/master/generator-web/src/main/resources/static/version.json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
gitVersion = data.version;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: base_url + "/static/version.json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$.toast("#当前版本:"+data.version+" | github:"+gitVersion);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#version').on('click', function(){
|
||||
getVersion();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: #e9ecef">
|
||||
<#--<div class="container">
|
||||
<nav class="navbar navbar-dark bg-primary btn-lg">
|
||||
<a class="navbar-brand" href="http://www.bejson.com">BeJSON在线工具站</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="http://zhengkai.blog.csdn.net">zhengkai.blog.csdn.net</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>-->
|
||||
<#--布局修改为4-8分-->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<#--选择区域-->
|
||||
<div class="col-sm-4">
|
||||
<!-- Example row of columns -->
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">通用实体</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="model">entity(set/get)</button>
|
||||
<button type="button" class="btn btn-default generator" id="beetlentity">entity(lombok)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">常用Util</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="beanutil">BeanUtil</button>
|
||||
<button type="button" class="btn btn-default generator" id="sql">SQL(CRUD)</button>
|
||||
<button type="button" class="btn btn-default generator" id="json">JSON</button>
|
||||
<button type="button" class="btn btn-default generator" id="xml">XML</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Example row of columns -->
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">MybatisPlus</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="plusentity">entity</button>
|
||||
<button type="button" class="btn btn-default generator" id="plusmapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="pluscontroller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">UI</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="swagger-ui">swagger-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="element-ui">element-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="bootstrap-ui">bootstrap-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="layui-edit">layui-edit</button>
|
||||
<button type="button" class="btn btn-default generator" id="layui-list">layui-list</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">BeetlSQL</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="beetlmd">beetlmd</button>
|
||||
<button type="button" class="btn btn-default generator" id="beetlcontroller">beetlcontroller</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">JPA</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="entity">jpa-entity</button>
|
||||
<button type="button" class="btn btn-default generator" id="repository">repository</button>
|
||||
<button type="button" class="btn btn-default generator" id="jpacontroller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">JdbcTemplate</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="jtdaoimpl">daoimpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="jtdao">dao</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">Mybatis</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="mybatis">ibatisXml</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper2">mapper2</button>
|
||||
<button type="button" class="btn btn-default generator" id="service">service</button>
|
||||
<button type="button" class="btn btn-default generator" id="service_impl">serviceImpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="controller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<#--核心工作区-->
|
||||
<div class="col-sm-8">
|
||||
<!-- Main jumbotron for a primary marketing message or call to action -->
|
||||
<div class="jumbotron jumbotron-fluid">
|
||||
<div class="container">
|
||||
<h1 class="display-4">Spring Boot Code Generator!</h1>
|
||||
<p class="lead">
|
||||
√基于SpringBoot2+Freemarker的<a class="lead" href="https://github.com/moshowgame/SpringBootCodeGenerator">代码生成器</a><br>
|
||||
√以解放双手为目的,减少大量重复的CRUD工作<br>
|
||||
√支持mysql/oracle/pgsql三大数据库<br>
|
||||
√用DDL-SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL相关代码。<br>
|
||||
如果发现有SQL语句不能识别,请<a href="https://github.com/moshowgame/SpringBootCodeGenerator/issues">留言</a>,同时欢迎大家提<a href="https://github.com/moshowgame/SpringBootCodeGenerator/pulls">PR</a>和<a href="#" id="donate1">赞赏</a>,谢谢!<a id="version" href="#">查看版本</a>
|
||||
</p>
|
||||
<div id="donate" class="container" show="no"></div>
|
||||
<hr>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">数据类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="dataType"
|
||||
name="dataType">
|
||||
<option value="sql">ddl-sql</option>
|
||||
<option value="json">json</option>
|
||||
<option value="insert-sql">insert-sql</option>
|
||||
<#--<option value="sql-regex">sql-regex</option>-->
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">作者</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="authorName" name="authorName" value="zhengkai.blog.csdn.net">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">返回</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="returnUtil" name="returnUtil" value="ReturnT">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">包名</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="packageName" name="packageName" value="com.softdev.system">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">tinyint转换</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="tinyintTransType"
|
||||
name="tinyintTransType">
|
||||
<option value="boolean">boolean</option>
|
||||
<option value="Boolean">Boolean</option>
|
||||
<option value="Integer">Integer</option>
|
||||
<option value="int">int</option>
|
||||
<option value="String">String</option>
|
||||
<option value="Short">Short</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">时间类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="timeTransType"
|
||||
name="timeTransType">
|
||||
<option value="Date">Date</option>
|
||||
<option value="DateTime">DateTime</option>
|
||||
<option value="Time">Time</option>
|
||||
<option value="Timestamp">Timestamp</option>
|
||||
<option value="Calendar">Calendar</option>
|
||||
<option value="LocalDate">LocalDate</option>
|
||||
<option value="LocalDateTime">LocalDateTime</option>
|
||||
<option value="LocalTime">LocalTime</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">命名规则</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="nameCaseType"
|
||||
name="nameCaseType">
|
||||
<option value="CamelCase">驼峰</option>
|
||||
<option value="UnderScoreCase">下划线</option>
|
||||
<#--<option value="UpperUnderScoreCase">大写下划线</option>-->
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">包装类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="packageType"
|
||||
name="packageType">
|
||||
<option value="true">启用</option>
|
||||
<option value="false">关闭</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">swagger-ui</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="isSwagger"
|
||||
name="isSwagger">
|
||||
<option value="false">关闭</option>
|
||||
<option value="true">启用</option>
|
||||
</select>
|
||||
</div>
|
||||
<textarea id="ddlSqlArea" placeholder="请输入表结构信息..." class="form-control btn-lg" style="height: 250px;">
|
||||
CREATE TABLE 'userinfo' (
|
||||
'user_id' int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
'user_name' varchar(255) NOT NULL COMMENT '用户名',
|
||||
'addtime' datetime NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY ('user_id')
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户信息'
|
||||
</textarea><br>
|
||||
<p><button class="btn btn-primary btn-lg disabled" id="btnGenCode" role="button" data-toggle="popover" data-content="">开始生成 »</button> <button class="btn alert-secondary" id="btnCopy">一键复制</button></p>
|
||||
<div id="history" class="btn-group" role="group" aria-label="Basic example"></div>
|
||||
<hr>
|
||||
|
||||
<hr>
|
||||
<textarea id="genCodeArea" class="form-control btn-lg" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<#--<@netCommon.commonFooter />-->
|
||||
</body>
|
||||
</html>
|
||||
442
generator-web/src/main/resources/templates/20210109bak/index.ftl
Normal file
442
generator-web/src/main/resources/templates/20210109bak/index.ftl
Normal file
@@ -0,0 +1,442 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="utf-8">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>SQL转Java JPA、MYBATIS实现类代码生成平台</title>
|
||||
<meta name="keywords" content="sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现">
|
||||
|
||||
<#import "common/common-import.ftl" as netCommon>
|
||||
<@netCommon.commonStyle />
|
||||
<@netCommon.commonScript />
|
||||
|
||||
<script>
|
||||
|
||||
<@netCommon.viewerCounter />
|
||||
|
||||
$(function () {
|
||||
/**
|
||||
* 初始化SQL AREA
|
||||
*/
|
||||
const ddlSqlArea = CodeMirror.fromTextArea(document.getElementById("ddlSqlArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-sql",
|
||||
lineWrapping: false,
|
||||
readOnly: false,
|
||||
foldGutter: true,
|
||||
//keyMap:"sublime",
|
||||
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
ddlSqlArea.setSize('auto','auto');
|
||||
/**
|
||||
* 初始化CODE AREA
|
||||
*/
|
||||
const genCodeArea = CodeMirror.fromTextArea(document.getElementById("genCodeArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping: true,
|
||||
readOnly: false,
|
||||
foldGutter: true,
|
||||
//keyMap:"sublime",
|
||||
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
genCodeArea.setSize('auto','auto');
|
||||
|
||||
let codeData;
|
||||
// 使用:var jsonObj = $("#formId").serializeObject();
|
||||
$.fn.serializeObject = function()
|
||||
{
|
||||
const o = {};
|
||||
const a = this.serializeArray();
|
||||
$.each(a, function() {
|
||||
if (o[this.name]) {
|
||||
if (!o[this.name].push) {
|
||||
o[this.name] = [o[this.name]];
|
||||
}
|
||||
o[this.name].push(this.value || '');
|
||||
} else {
|
||||
o[this.name] = this.value || '';
|
||||
}
|
||||
});
|
||||
return o;
|
||||
};
|
||||
let historyCount = 0;
|
||||
//初始化清除session
|
||||
if (window.sessionStorage){
|
||||
//修复当F5刷新的时候,session没有清空各个值,但是页面的button没了。
|
||||
sessionStorage.clear();
|
||||
}
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
$('#btnGenCode').click(function () {
|
||||
const jsonData = {
|
||||
"tableSql": ddlSqlArea.getValue(),
|
||||
"packageName": $("#packageName").val(),
|
||||
"returnUtil": $("#returnUtil").val(),
|
||||
"authorName": $("#authorName").val(),
|
||||
"dataType": $("#dataType").val(),
|
||||
"tinyintTransType": $("#tinyintTransType").val(),
|
||||
"nameCaseType": $("#nameCaseType").val(),
|
||||
"swagger": $("#isSwagger").val(),
|
||||
"timeTransType": $("#timeTransType").val(),
|
||||
"packageType": $("#packageType").val()
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + "/genCode",
|
||||
data:(JSON.stringify(jsonData)),
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
codeData = data.data;
|
||||
genCodeArea.setValue(codeData.beetlentity);
|
||||
genCodeArea.setSize('auto', 'auto');
|
||||
$.toast("√ 代码生成成功");
|
||||
//添加历史记录
|
||||
addHistory(codeData);
|
||||
} else {
|
||||
$.toast("× 代码生成失败 :"+data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
/**
|
||||
* 切换历史记录
|
||||
*/
|
||||
function getHistory(tableName){
|
||||
if (window.sessionStorage){
|
||||
const valueSession = sessionStorage.getItem(tableName);
|
||||
codeData = JSON.parse(valueSession);
|
||||
$.toast("$ 切换历史记录成功:"+tableName);
|
||||
genCodeArea.setValue(codeData.entity);
|
||||
}else{
|
||||
console.log("浏览器不支持sessionStorage");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 添加历史记录
|
||||
*/
|
||||
function addHistory(data){
|
||||
if (window.sessionStorage){
|
||||
//console.log(historyCount);
|
||||
if(historyCount>=9){
|
||||
$("#history").find(".btn:last").remove();
|
||||
historyCount--;
|
||||
}
|
||||
const tableName = data.tableName;
|
||||
const valueSession = sessionStorage.getItem(tableName);
|
||||
if(valueSession!==undefined && valueSession!=null){
|
||||
sessionStorage.removeItem(tableName);
|
||||
}else{
|
||||
$("#history").prepend('<button id="his-'+tableName+'" type="button" class="btn">'+tableName+'</button>');
|
||||
//$("#history").prepend('<button id="his-'+tableName+'" onclick="getHistory(\''+tableName+'\');" type="button" class="btn">'+tableName+'</button>');
|
||||
$("#his-"+tableName).bind('click', function () {getHistory(tableName)});
|
||||
}
|
||||
sessionStorage.setItem(tableName,JSON.stringify(data));
|
||||
historyCount++;
|
||||
}else{
|
||||
console.log("浏览器不支持sessionStorage");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钮事件组
|
||||
*/
|
||||
$('.generator').bind('click', function () {
|
||||
if (!$.isEmptyObject(codeData)) {
|
||||
const id = this.id;
|
||||
genCodeArea.setValue(codeData[id]);
|
||||
genCodeArea.setSize('auto', 'auto');
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 捐赠
|
||||
*/
|
||||
function donate(){
|
||||
if($("#donate").attr("show")=="no"){
|
||||
$("#donate").html('<img src="https://raw.githubusercontent.com/moshowgame/SpringBootCodeGenerator/master/donate.png"></img>');
|
||||
$("#donate").attr("show","yes");
|
||||
}else{
|
||||
$("#donate").html('<p>谢谢赞赏!</p>');
|
||||
$("#donate").attr("show","no");
|
||||
}
|
||||
}
|
||||
$('#donate1').on('click', function(){
|
||||
donate();
|
||||
});
|
||||
$('#donate2').on('click', function(){
|
||||
donate();
|
||||
});
|
||||
$('#btnCopy').on('click', function(){
|
||||
if(!$.isEmptyObject(genCodeArea.getValue())&&!$.isEmptyObject(navigator)&&!$.isEmptyObject(navigator.clipboard)){
|
||||
navigator.clipboard.writeText(genCodeArea.getValue());
|
||||
$.toast("√ 复制成功");
|
||||
}
|
||||
});
|
||||
|
||||
function getVersion(){
|
||||
let gitVersion;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "https://raw.githubusercontent.com/moshowgame/SpringBootCodeGenerator/master/generator-web/src/main/resources/static/version.json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
gitVersion = data.version;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: base_url + "/static/version.json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$.toast("#当前版本:"+data.version+" | github:"+gitVersion);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#version').on('click', function(){
|
||||
getVersion();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: #e9ecef">
|
||||
<#--布局修改为4-8分-->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<#--选择区域-->
|
||||
<div class="col-sm-4">
|
||||
<!-- Example row of columns -->
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">通用实体</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="model">entity(set/get)</button>
|
||||
<button type="button" class="btn btn-default generator" id="beetlentity">entity(lombok)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">常用Util</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="beanutil">BeanUtil</button>
|
||||
<button type="button" class="btn btn-default generator" id="sql">SQL(CRUD)</button>
|
||||
<button type="button" class="btn btn-default generator" id="json">JSON</button>
|
||||
<button type="button" class="btn btn-default generator" id="xml">XML</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Example row of columns -->
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">MybatisPlus</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="plusentity">entity</button>
|
||||
<button type="button" class="btn btn-default generator" id="plusmapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="pluscontroller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">UI</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="swagger-ui">swagger-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="element-ui">element-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="bootstrap-ui">bootstrap-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="layui-edit">layui-edit</button>
|
||||
<button type="button" class="btn btn-default generator" id="layui-list">layui-list</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">BeetlSQL</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="beetlmd">beetlmd</button>
|
||||
<button type="button" class="btn btn-default generator" id="beetlcontroller">beetlcontroller</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">JPA</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="entity">jpa-entity</button>
|
||||
<button type="button" class="btn btn-default generator" id="repository">repository</button>
|
||||
<button type="button" class="btn btn-default generator" id="jpacontroller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">JdbcTemplate</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="jtdaoimpl">daoimpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="jtdao">dao</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">Mybatis</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="mybatis">ibatisXml</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper2">mapper2</button>
|
||||
<button type="button" class="btn btn-default generator" id="service">service</button>
|
||||
<button type="button" class="btn btn-default generator" id="service_impl">serviceImpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="controller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<#--核心工作区-->
|
||||
|
||||
<div class="col-sm-8">
|
||||
<!-- Main jumbotron for a primary marketing message or call to action -->
|
||||
<div class="jumbotron jumbotron-fluid">
|
||||
<div class="container">
|
||||
<h1 class="display-4">Spring Boot Code Generator!</h1>
|
||||
<p class="lead">
|
||||
√基于SpringBoot2+Freemarker的<a class="lead" href="https://github.com/moshowgame/SpringBootCodeGenerator">代码生成器</a><br>
|
||||
√以解放双手为目的,减少大量重复的CRUD工作<br>
|
||||
√支持mysql/oracle/pgsql三大数据库<br>
|
||||
√用DDL-SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL相关代码。<br>
|
||||
如果发现有SQL语句不能识别,请<a href="https://github.com/moshowgame/SpringBootCodeGenerator/issues">留言</a>,同时欢迎大家提<a href="https://github.com/moshowgame/SpringBootCodeGenerator/pulls">PR</a>和<a href="#" id="donate1">赞赏</a>,谢谢!<a id="version" href="#">查看版本</a>
|
||||
</p>
|
||||
<div id="donate" class="container" show="no"></div>
|
||||
<hr>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">数据类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="dataType"
|
||||
name="dataType">
|
||||
<option value="sql">ddl-sql</option>
|
||||
<option value="json">json</option>
|
||||
<option value="insert-sql">insert-sql</option>
|
||||
<#--<option value="sql-regex">sql-regex</option>-->
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">作者</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="authorName" name="authorName" value="zhengkai.blog.csdn.net">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">返回</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="returnUtil" name="returnUtil" value="ReturnT">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">包名</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="packageName" name="packageName" value="com.softdev.system">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">tinyint转换</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="tinyintTransType"
|
||||
name="tinyintTransType">
|
||||
<option value="boolean">boolean</option>
|
||||
<option value="Boolean">Boolean</option>
|
||||
<option value="Integer">Integer</option>
|
||||
<option value="int">int</option>
|
||||
<option value="String">String</option>
|
||||
<option value="Short">Short</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">时间类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="timeTransType"
|
||||
name="timeTransType">
|
||||
<option value="Date">Date</option>
|
||||
<option value="DateTime">DateTime</option>
|
||||
<option value="Time">Time</option>
|
||||
<option value="Timestamp">Timestamp</option>
|
||||
<option value="Calendar">Calendar</option>
|
||||
<option value="LocalDate">LocalDate</option>
|
||||
<option value="LocalDateTime">LocalDateTime</option>
|
||||
<option value="LocalTime">LocalTime</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">命名规则</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="nameCaseType"
|
||||
name="nameCaseType">
|
||||
<option value="CamelCase">驼峰</option>
|
||||
<option value="UnderScoreCase">下划线</option>
|
||||
<#--<option value="UpperUnderScoreCase">大写下划线</option>-->
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">包装类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="packageType"
|
||||
name="packageType">
|
||||
<option value="true">启用</option>
|
||||
<option value="false">关闭</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">swagger-ui</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="isSwagger"
|
||||
name="isSwagger">
|
||||
<option value="false">关闭</option>
|
||||
<option value="true">启用</option>
|
||||
</select>
|
||||
</div>
|
||||
<textarea id="ddlSqlArea" placeholder="请输入表结构信息..." class="form-control btn-lg" style="height: 250px;">
|
||||
CREATE TABLE 'userinfo' (
|
||||
'user_id' int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
'user_name' varchar(255) NOT NULL COMMENT '用户名',
|
||||
'addtime' datetime NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY ('user_id')
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户信息'
|
||||
</textarea><br>
|
||||
<p><button class="btn btn-primary btn-lg disabled" id="btnGenCode" role="button" data-toggle="popover" data-content="">开始生成 »</button> <button class="btn alert-secondary" id="btnCopy">一键复制</button></p>
|
||||
<div id="history" class="btn-group" role="group" aria-label="Basic example"></div>
|
||||
<hr>
|
||||
|
||||
<hr>
|
||||
<textarea id="genCodeArea" class="form-control btn-lg" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<#--<@netCommon.commonFooter />-->
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>代码生成器</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<!-- import CSS -->
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/element-ui/2.14.1/theme-chalk/index.min.css">
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/codemirror/5.58.3/codemirror.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<el-container>
|
||||
<el-header> <span>SQL转JAVA代码生成器<el-tag>{{date|formatDate(this)}}</el-tag></span></el-header>
|
||||
<el-container>
|
||||
<el-aside width="200px">
|
||||
<el-tree
|
||||
:data="data"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
:default-expanded-keys="[2, 3]"
|
||||
:default-checked-keys="[5]"
|
||||
:props="defaultProps">
|
||||
</el-tree>
|
||||
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<textarea id="sqlArea" ></textarea>
|
||||
<textarea id="codeArea" ></textarea>
|
||||
</el-main>
|
||||
<el-footer>Footer</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<!-- import Vue before Element -->
|
||||
<script src="//cdn.staticfile.org/vue/2.6.11/vue.min.js"></script>
|
||||
<!-- import JavaScript -->
|
||||
<script src="//cdn.staticfile.org/element-ui/2.14.1/index.js"></script>
|
||||
<script src="//cdn.staticfile.org/element-ui/2.14.1/locale/zh-CN.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/codemirror.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/addon/display/placeholder.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/mode/clike/clike.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/mode/sql/sql.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.58.3/mode/xml/xml.min.js"></script>
|
||||
<script>
|
||||
/**
|
||||
* 初始化sqlArea
|
||||
*/
|
||||
const sqlArea = CodeMirror.fromTextArea(document.getElementById("sqlArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-sql",
|
||||
lineWrapping: false,
|
||||
readOnly: false,
|
||||
foldGutter: true
|
||||
});
|
||||
//sqlArea.setSize('auto','auto');
|
||||
/**
|
||||
* 初始化codeArea
|
||||
*/
|
||||
const codeArea = CodeMirror.fromTextArea(document.getElementById("codeArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping:true,
|
||||
readOnly:false,
|
||||
});
|
||||
//codeArea.setSize('auto','auto');
|
||||
|
||||
let vue = new Vue({
|
||||
el: '#app',
|
||||
data: function() {
|
||||
return {
|
||||
date: new Date(),
|
||||
data: [{
|
||||
id: 1,
|
||||
label: '一级 1',
|
||||
children: [{
|
||||
id: 4,
|
||||
label: '二级 1-1',
|
||||
children: [{
|
||||
id: 9,
|
||||
label: '三级 1-1-1'
|
||||
}, {
|
||||
id: 10,
|
||||
label: '三级 1-1-2'
|
||||
}]
|
||||
}]
|
||||
}, {
|
||||
id: 2,
|
||||
label: '一级 2',
|
||||
children: [{
|
||||
id: 5,
|
||||
label: '二级 2-1'
|
||||
}, {
|
||||
id: 6,
|
||||
label: '二级 2-2'
|
||||
}]
|
||||
}, {
|
||||
id: 3,
|
||||
label: '一级 3',
|
||||
children: [{
|
||||
id: 7,
|
||||
label: '二级 3-1'
|
||||
}, {
|
||||
id: 8,
|
||||
label: '二级 3-2'
|
||||
}]
|
||||
}],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
setZero(a) {//设置小于10的数字在加0
|
||||
return a < 10 ? "0" + a : a;
|
||||
},
|
||||
},
|
||||
filters:{
|
||||
formatDate(date,vm) { //当前时间格式化处理
|
||||
let str = "";
|
||||
let weekDay = [
|
||||
"星期天",
|
||||
"星期一",
|
||||
"星期二",
|
||||
"星期三",
|
||||
"星期四",
|
||||
"星期五",
|
||||
"星期六"
|
||||
];
|
||||
str += vm.setZero(date.getFullYear()) + "年"; //获取年份
|
||||
str += vm.setZero(date.getMonth() + 1) + "月"; //获取月份
|
||||
str += vm.setZero(date.getDate()) + "日"; //获取日
|
||||
str += " " + weekDay[date.getDay()]; //获取星期
|
||||
return str;
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
11
generator-web/src/main/resources/templates/404.html
Normal file
11
generator-web/src/main/resources/templates/404.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>404</title>
|
||||
</head>
|
||||
<body>
|
||||
404
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +1,4 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -5,7 +6,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Data<#if swagger?exists && swagger==true>
|
||||
@Data<#if isSwagger?exists && isSwagger==true>
|
||||
@ApiModel("${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
@@ -16,9 +17,9 @@ public class ${classInfo.className} implements Serializable {
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
/**
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/<#if swagger?exists && swagger==true>
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.util.List;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ${packageName}.entity;
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
import lombok.Data;
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
@@ -11,15 +12,15 @@ import javax.persistence.Table;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="${classInfo.tableName}")<#if swagger?exists && swagger==true>
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if>
|
||||
<#if isComment?exists && isComment==true>@Table(name="${classInfo.tableName}")</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@ApiModel("${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
@@ -29,11 +30,11 @@ public class ${classInfo.className} implements Serializable {
|
||||
@GeneratedValue
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
/**
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/<#if swagger?exists && swagger==true>
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
|
||||
@Column(name="${fieldItem.columnName}")
|
||||
<#if isComment?exists && isComment==true>@Column(name="${fieldItem.columnName}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
@@ -41,4 +42,13 @@ public class ${classInfo.className} implements Serializable {
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package ${packageName}.controller;
|
||||
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import ${packageName}.repository.${classInfo.className}Repository;
|
||||
import org.springframework.data.domain.Example;
|
||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package ${packageName}.mapper;
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>import ${packageName}.entity.${classInfo.className};
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package ${packageName}.controller;
|
||||
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.controller;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import ${packageName}.mapper.${classInfo.className}Mapper;
|
||||
@@ -16,7 +16,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
@@ -120,13 +120,13 @@ public class ${classInfo.className}Controller {
|
||||
}
|
||||
@GetMapping("/list")
|
||||
public ModelAndView listPage(){
|
||||
return new ModelAndView("cms/${classInfo.className?uncap_first}-list");
|
||||
return new ModelAndView("${classInfo.className?uncap_first}-list");
|
||||
}
|
||||
|
||||
@GetMapping("/edit")
|
||||
public ModelAndView editPage(int id){
|
||||
${classInfo.className} ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.selectOne(new QueryWrapper<${classInfo.className}>().eq("${classInfo.className?uncap_first}_id",id));
|
||||
return new ModelAndView("cms/${classInfo.className?uncap_first}-edit","${classInfo.className?uncap_first}",${classInfo.className?uncap_first});
|
||||
return new ModelAndView("${classInfo.className?uncap_first}-edit","${classInfo.className?uncap_first}",${classInfo.className?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,6 +147,14 @@ public class ${classInfo.className}Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行(如不需要请屏蔽)
|
||||
*/
|
||||
@PostMapping("/execute")
|
||||
public Object execute(){
|
||||
return ReturnT.SUCCESS();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package ${packageName}.entity;
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.entity;</#if>
|
||||
|
||||
import lombok.Data;
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
<#if isLombok?exists && isLombok==true>import lombok.Data;</#if>
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
* @date ${.now?string('yyyy-MM-dd')}
|
||||
*/
|
||||
@Data<#if swagger?exists && swagger==true>
|
||||
<#if isLombok?exists && isLombok==true>@Data</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@ApiModel("${classInfo.classComment}")</#if>
|
||||
public class ${classInfo.className} implements Serializable {
|
||||
|
||||
@@ -21,15 +22,22 @@ public class ${classInfo.className} implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
/**
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/<#if swagger?exists && swagger==true>
|
||||
*/</#if><#if isSwagger?exists && isSwagger==true>
|
||||
@ApiModelProperty("${fieldItem.fieldComment}")</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
public ${classInfo.className}() {
|
||||
<#if isLombok?exists && isLombok==false>
|
||||
public ${fieldItem.fieldClass} get${fieldItem.fieldName?cap_first}() {
|
||||
return ${fieldItem.fieldName};
|
||||
}
|
||||
|
||||
public void set${fieldItem.fieldName?cap_first}(${fieldItem.fieldClass} ${fieldItem.fieldName}) {
|
||||
this.${fieldItem.fieldName} = ${fieldItem.fieldName};
|
||||
}
|
||||
</#if>
|
||||
|
||||
</#list>
|
||||
</#if>
|
||||
public ${classInfo.className}() {}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package ${packageName}.mapper;
|
||||
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import ${packageName}.entity.${classInfo.className};
|
||||
import java.util.List;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -7,6 +8,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package ${packageName}.mapper;
|
||||
|
||||
<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.mapper;</#if>
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}Mapper
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
@@ -13,9 +14,9 @@ public class ${classInfo.className} implements Serializable {
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
/**
|
||||
<#if isComment?exists && isComment==true>/**
|
||||
* ${fieldItem.fieldComment}
|
||||
*/
|
||||
*/</#if>
|
||||
private ${fieldItem.fieldClass} ${fieldItem.fieldName};
|
||||
|
||||
</#list>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import java.util.Map;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<#if isAutoImport?exists && isAutoImport==true>
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
</#if>
|
||||
/**
|
||||
* @description ${classInfo.classComment}
|
||||
* @author ${authorName}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<el-form :inline="true" :model="submitData" class="demo-form-inline" :rules="rules" ref="ruleForm">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="header clearfix">
|
||||
@@ -10,7 +8,7 @@
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<el-form-item label="${fieldItem.fieldComment}" prop="${fieldItem.fieldName}">
|
||||
<el-input placeholder="${fieldItem.fieldComment}" v-model="submitData.${fieldItem.fieldName}"></el-input>
|
||||
<el-input placeholder="请输入${fieldItem.fieldComment}" v-model="formData.${fieldItem.fieldName}"></el-input>
|
||||
</el-form-item>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>layuimini</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link rel="stylesheet" href="¥{request.contextPath}/static/lib/layui-v2.5.5/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="¥{request.contextPath}/static/css/public.css" media="all">
|
||||
<style>
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-form layuimini-form">
|
||||
<input type="hidden" name="${classInfo.className?uncap_first}Id" value="" class="layui-input">
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>layuimini</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link rel="stylesheet" href="¥{request.contextPath}/static/lib/layui-v2.5.5/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="¥{request.contextPath}/static/css/public.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
@@ -21,7 +21,7 @@ ${classInfo.className?uncap_first}.set${fieldItem.fieldName?cap_first}(${classIn
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.fieldName?cap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
map.put("${fieldItem.fieldName?uncap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
@@ -35,7 +35,7 @@ map.put("${fieldItem.fieldComment}",${classInfo.className?uncap_first}.get${fiel
|
||||
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
// ${fieldItem.fieldComment}
|
||||
map.put("${fieldItem.fieldName?cap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
map.put("${fieldItem.fieldName?uncap_first}",${classInfo.className?uncap_first}.get${fieldItem.fieldName?cap_first}());
|
||||
</#list>
|
||||
|
||||
</#if>
|
||||
|
||||
@@ -4,4 +4,10 @@
|
||||
"${fieldItem.fieldName}":"${fieldItem.fieldComment}"<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
}
|
||||
|
||||
{
|
||||
<#list classInfo.fieldList as fieldItem>
|
||||
"${fieldItem.fieldName}":""<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
}
|
||||
</#if>
|
||||
|
||||
@@ -1,39 +1,47 @@
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
SELECT
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName}<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
FROM
|
||||
${classInfo.tableName}
|
||||
WHERE
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
<#if fieldItem_index != 0>AND </#if>${fieldItem.columnName} = ''
|
||||
</#list>;
|
||||
#SQL横向select
|
||||
SELECT <#list classInfo.fieldList as fieldItem >t.${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list>
|
||||
FROM ${classInfo.tableName} t;
|
||||
|
||||
#CSV横向字段名
|
||||
<#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list>
|
||||
</#if>
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#LEFT JOIN
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
${classInfo.tableName} t1
|
||||
LEFT JOIN xxx t2
|
||||
ON t1.${classInfo.tableName}_id=t2.${classInfo.tableName}_id
|
||||
${classInfo.tableName} a
|
||||
LEFT JOIN ${classInfo.tableName} b
|
||||
ON a.${classInfo.tableName}_id=b.${classInfo.tableName}_id
|
||||
WHERE 1=1;
|
||||
</#if>
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#INSERT INTO
|
||||
INSERT INTO ${classInfo.tableName} ( <#list classInfo.fieldList as fieldItem >${fieldItem.columnName}<#if fieldItem_has_next>,</#if></#list> )
|
||||
VALUES
|
||||
(
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
''<#if fieldItem_has_next>,</#if>
|
||||
</#list>
|
||||
<#list classInfo.fieldList as fieldItem >''<#if fieldItem_has_next>,</#if></#list>
|
||||
);
|
||||
</#if>
|
||||
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#关联更新
|
||||
UPDATE ${classInfo.tableName} a
|
||||
JOIN ${classInfo.tableName}_join b ON a.${classInfo.tableName}_id = b.${classInfo.tableName}_id
|
||||
SET <#list classInfo.fieldList as fieldItem > a.${fieldItem.columnName} = b.${fieldItem.columnName}<#if fieldItem_has_next>,</#if> </#list>
|
||||
WHERE
|
||||
b.${classInfo.tableName}_id IS NOT NULL;
|
||||
|
||||
UPDATE ${classInfo.tableName} a,${classInfo.tableName}_join b
|
||||
SET <#list classInfo.fieldList as fieldItem > a.${fieldItem.columnName} = b.${fieldItem.columnName}<#if fieldItem_has_next>,</#if> </#list>
|
||||
WHERE a.${classInfo.tableName}_id = b.${classInfo.tableName}_id;
|
||||
|
||||
#普通update
|
||||
UPDATE ${classInfo.tableName}
|
||||
SET
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
@@ -48,6 +56,11 @@
|
||||
|
||||
|
||||
<#if classInfo.fieldList?exists && classInfo.fieldList?size gt 0>
|
||||
#关联删除
|
||||
delete a from ${classInfo.tableName}_del as a inner join ${classInfo.tableName} as b
|
||||
where a.${classInfo.tableName}_id=b.${classInfo.tableName}_id;
|
||||
|
||||
#普通删除
|
||||
DELETE
|
||||
FROM
|
||||
${classInfo.tableName}
|
||||
@@ -55,4 +68,7 @@
|
||||
<#list classInfo.fieldList as fieldItem >
|
||||
${fieldItem.columnName} = ''<#if fieldItem_has_next>,</#if>
|
||||
</#list>;
|
||||
|
||||
</#if>
|
||||
|
||||
|
||||
|
||||
40
generator-web/src/main/resources/templates/header.html
Normal file
40
generator-web/src/main/resources/templates/header.html
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>SQL转Java JPA、MYBATIS实现类代码生成平台</title>
|
||||
<meta name="keywords" content="sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现">
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<link rel="stylesheet" href="${request.contextPath}/statics/css/AdminLTE.min.css">
|
||||
<!-- AdminLTE Skins. Choose a skin from the css/skins
|
||||
folder instead of downloading all of them to reduce the load. -->
|
||||
<link rel="stylesheet" href="${request.contextPath}/statics/css/all-skins.min.css">
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="${request.contextPath}/statics/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="${request.contextPath}/statics/css/main.css">
|
||||
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
|
||||
<script src="${request.contextPath}/statics/plugins/layer/layer.js"></script>
|
||||
<script src="${request.contextPath}/statics/libs/bootstrap.min.js"></script>
|
||||
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
|
||||
<script src="${request.contextPath}/statics/js/common.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script src="${request.contextPath}/statics/plugins/element-ui/index.min.js"></script>
|
||||
<link rel="stylesheet" href="${request.contextPath}/statics/plugins/element-ui/theme-chalk/index.min.css">
|
||||
|
||||
<!--<script src="${request.contextPath}/statics/plugins/codemirror/codemirror.min.js"></script>-->
|
||||
<script src="//cdn.staticfile.org/codemirror/5.59.1/codemirror.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.59.1/mode/sql/sql.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.59.1/mode/xml/xml.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.59.1/mode/clike/clike.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.59.1/mode/html/html.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/codemirror/5.59.1/mode/javascript/javascript.min.js"></script>
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/codemirror/5.59.1/codemirror.css">
|
||||
|
||||
<!-- import axios -->
|
||||
<script src="https://cdn.staticfile.org/axios/0.1.0/axios.min.js"></script>
|
||||
@@ -1,436 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>SQL转Java JPA、MYBATIS实现类代码生成平台</title>
|
||||
<meta name="keywords" content="sql转实体类,sql转DAO,SQL转service,SQL转JPA实现,SQL转MYBATIS实现">
|
||||
|
||||
<#import "common/common-import.ftl" as netCommon>
|
||||
<@netCommon.commonStyle />
|
||||
<@netCommon.commonScript />
|
||||
|
||||
<script>
|
||||
|
||||
<@netCommon.viewerCounter />
|
||||
|
||||
$(function () {
|
||||
/**
|
||||
* 初始化 table sql 3
|
||||
*/
|
||||
var ddlSqlArea = CodeMirror.fromTextArea(document.getElementById("ddlSqlArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-sql",
|
||||
lineWrapping:false,
|
||||
readOnly:false,
|
||||
foldGutter: true,
|
||||
//keyMap:"sublime",
|
||||
gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
ddlSqlArea.setSize('auto','auto');
|
||||
// controller_ide
|
||||
var genCodeArea = CodeMirror.fromTextArea(document.getElementById("genCodeArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-java",
|
||||
lineWrapping:true,
|
||||
readOnly:false,
|
||||
foldGutter: true,
|
||||
//keyMap:"sublime",
|
||||
gutters:["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
||||
});
|
||||
genCodeArea.setSize('auto','auto');
|
||||
|
||||
var codeData;
|
||||
// 使用:var jsonObj = $("#formId").serializeObject();
|
||||
$.fn.serializeObject = function()
|
||||
{
|
||||
var o = {};
|
||||
var a = this.serializeArray();
|
||||
$.each(a, function() {
|
||||
if (o[this.name]) {
|
||||
if (!o[this.name].push) {
|
||||
o[this.name] = [o[this.name]];
|
||||
}
|
||||
o[this.name].push(this.value || '');
|
||||
} else {
|
||||
o[this.name] = this.value || '';
|
||||
}
|
||||
});
|
||||
return o;
|
||||
};
|
||||
var historyCount=0;
|
||||
//初始化清除session
|
||||
if (window.sessionStorage){
|
||||
//修复当F5刷新的时候,session没有清空各个值,但是页面的button没了。
|
||||
sessionStorage.clear();
|
||||
}
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
$('#btnGenCode').click(function () {
|
||||
var jsonData = {
|
||||
"tableSql": ddlSqlArea.getValue(),
|
||||
"packageName":$("#packageName").val(),
|
||||
"returnUtil":$("#returnUtil").val(),
|
||||
"authorName":$("#authorName").val(),
|
||||
"dataType":$("#dataType").val(),
|
||||
"tinyintTransType":$("#tinyintTransType").val(),
|
||||
"nameCaseType":$("#nameCaseType").val(),
|
||||
"swagger":$("#isSwagger").val(),
|
||||
"timeTransType":$("#timeTransType").val(),
|
||||
"packageType":$("#packageType").val()
|
||||
};
|
||||
console.log($("#timeTransType").val());
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + "/genCode",
|
||||
data:(JSON.stringify(jsonData)),
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (data.code === 200) {
|
||||
codeData = data.data;
|
||||
genCodeArea.setValue(codeData.beetlentity);
|
||||
genCodeArea.setSize('auto', 'auto');
|
||||
$.toast("√ 代码生成成功");
|
||||
//添加历史记录
|
||||
addHistory(codeData);
|
||||
} else {
|
||||
$.toast("× 代码生成失败 :"+data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
/**
|
||||
* 切换历史记录
|
||||
*/
|
||||
function getHistory(tableName){
|
||||
if (window.sessionStorage){
|
||||
var valueSession = sessionStorage.getItem(tableName);
|
||||
codeData = JSON.parse(valueSession);
|
||||
$.toast("$ 切换历史记录成功:"+tableName);
|
||||
genCodeArea.setValue(codeData.entity);
|
||||
}else{
|
||||
console.log("浏览器不支持sessionStorage");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 添加历史记录
|
||||
*/
|
||||
function addHistory(data){
|
||||
if (window.sessionStorage){
|
||||
//console.log(historyCount);
|
||||
if(historyCount>=9){
|
||||
$("#history").find(".btn:last").remove();
|
||||
historyCount--;
|
||||
}
|
||||
var tableName=data.tableName;
|
||||
var valueSession = sessionStorage.getItem(tableName);
|
||||
if(valueSession!==undefined && valueSession!=null){
|
||||
sessionStorage.removeItem(tableName);
|
||||
}else{
|
||||
$("#history").prepend('<button id="his-'+tableName+'" type="button" class="btn">'+tableName+'</button>');
|
||||
//$("#history").prepend('<button id="his-'+tableName+'" onclick="getHistory(\''+tableName+'\');" type="button" class="btn">'+tableName+'</button>');
|
||||
$("#his-"+tableName).bind('click', function () {getHistory(tableName)});
|
||||
}
|
||||
sessionStorage.setItem(tableName,JSON.stringify(data));
|
||||
historyCount++;
|
||||
}else{
|
||||
console.log("浏览器不支持sessionStorage");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钮事件组
|
||||
*/
|
||||
$('.generator').bind('click', function () {
|
||||
if (!$.isEmptyObject(codeData)) {
|
||||
var id = this.id;
|
||||
genCodeArea.setValue(codeData[id]);
|
||||
genCodeArea.setSize('auto', 'auto');
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 捐赠
|
||||
*/
|
||||
function donate(){
|
||||
if($("#donate").attr("show")=="no"){
|
||||
$("#donate").html('<img src="https://raw.githubusercontent.com/moshowgame/SpringBootCodeGenerator/master/donate.png"></img>');
|
||||
$("#donate").attr("show","yes");
|
||||
}else{
|
||||
$("#donate").html('<p>谢谢赞赏!</p>');
|
||||
$("#donate").attr("show","no");
|
||||
}
|
||||
}
|
||||
$('#donate1').on('click', function(){
|
||||
donate();
|
||||
});
|
||||
$('#donate2').on('click', function(){
|
||||
donate();
|
||||
});
|
||||
$('#btnCopy').on('click', function(){
|
||||
if(!$.isEmptyObject(genCodeArea.getValue())&&!$.isEmptyObject(navigator)&&!$.isEmptyObject(navigator.clipboard)){
|
||||
navigator.clipboard.writeText(genCodeArea.getValue());
|
||||
$.toast("√ 复制成功");
|
||||
}
|
||||
});
|
||||
|
||||
function getVersion(){
|
||||
var gitVersion ;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "https://raw.githubusercontent.com/moshowgame/SpringBootCodeGenerator/master/generator-web/src/main/resources/static/version.json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
gitVersion = data.version;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: base_url + "/static/version.json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$.toast("#当前版本:"+data.version+" | github:"+gitVersion);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#version').on('click', function(){
|
||||
getVersion();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: #e9ecef">
|
||||
|
||||
<div class="container">
|
||||
<nav class="navbar navbar-dark bg-primary btn-lg">
|
||||
<a class="navbar-brand" href="http://www.bejson.com">BeJSON在线工具站</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="http://zhengkai.blog.csdn.net">zhengkai.blog.csdn.net</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Main jumbotron for a primary marketing message or call to action -->
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h2>Spring Boot Code Generator!</h2>
|
||||
<p class="lead">
|
||||
√基于SpringBoot2+Freemarker的<a class="lead" href="https://github.com/moshowgame/SpringBootCodeGenerator">代码生成器</a><br>
|
||||
√以解放双手为目的,减少大量重复的CRUD工作<br>
|
||||
√支持mysql/oracle/pgsql三大数据库<br>
|
||||
√用DDL-SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL相关代码。<br>
|
||||
如果发现有SQL语句不能识别,请<a href="https://github.com/moshowgame/SpringBootCodeGenerator/issues">留言</a>,同时欢迎大家提<a href="https://github.com/moshowgame/SpringBootCodeGenerator/pulls">PR</a>和<a href="#" id="donate1">赞赏</a>,谢谢!<a id="version" href="#">查看版本</a>
|
||||
</p>
|
||||
<div id="donate" class="container" show="no"></div>
|
||||
<hr>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">数据类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="dataType"
|
||||
name="dataType">
|
||||
<option value="sql">ddl-sql</option>
|
||||
<option value="json">json</option>
|
||||
<option value="insert-sql">insert-sql</option>
|
||||
<#--<option value="sql-regex">sql-regex</option>-->
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">作者</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="authorName" name="authorName" value="zhengkai.blog.csdn.net">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">返回</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="returnUtil" name="returnUtil" value="ReturnT">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">包名</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="packageName" name="packageName" value="com.softdev.system">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">tinyint转换</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="tinyintTransType"
|
||||
name="tinyintTransType">
|
||||
<option value="boolean">boolean</option>
|
||||
<option value="Boolean">Boolean</option>
|
||||
<option value="Integer">Integer</option>
|
||||
<option value="int">int</option>
|
||||
<option value="String">String</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">时间类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="timeTransType"
|
||||
name="timeTransType">
|
||||
<option value="Date">Date</option>
|
||||
<option value="DateTime">DateTime</option>
|
||||
<option value="Time">Time</option>
|
||||
<option value="Timestamp">Timestamp</option>
|
||||
<option value="Calendar">Calendar</option>
|
||||
<option value="LocalDate">LocalDate</option>
|
||||
<option value="LocalDateTime">LocalDateTime</option>
|
||||
<option value="LocalTime">LocalTime</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">命名规则</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="nameCaseType"
|
||||
name="nameCaseType">
|
||||
<option value="CamelCase">驼峰</option>
|
||||
<option value="UnderScoreCase">下划线</option>
|
||||
<#--<option value="UpperUnderScoreCase">大写下划线</option>-->
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">包装类型</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="packageType"
|
||||
name="packageType">
|
||||
<option value="true">启用</option>
|
||||
<option value="false">关闭</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">swagger-ui</span>
|
||||
</div>
|
||||
<select type="text" class="form-control" id="isSwagger"
|
||||
name="isSwagger">
|
||||
<option value="false">关闭</option>
|
||||
<option value="true">启用</option>
|
||||
</select>
|
||||
</div>
|
||||
<textarea id="ddlSqlArea" placeholder="请输入表结构信息..." class="form-control btn-lg" style="height: 250px;">
|
||||
CREATE TABLE 'userinfo' (
|
||||
'user_id' int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
'user_name' varchar(255) NOT NULL COMMENT '用户名',
|
||||
'addtime' datetime NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY ('user_id')
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户信息'
|
||||
</textarea><br>
|
||||
<p><button class="btn btn-primary btn-lg disabled" id="btnGenCode" role="button" data-toggle="popover" data-content="">开始生成 »</button> <button class="btn alert-secondary" id="btnCopy">一键复制</button></p>
|
||||
<div id="history" class="btn-group" role="group" aria-label="Basic example"></div>
|
||||
<hr>
|
||||
<!-- Example row of columns -->
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">通用实体</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="model">entity(set/get)</button>
|
||||
<button type="button" class="btn btn-default generator" id="beetlentity">entity(lombok)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">常用Util</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="beanutil">BeanUtil</button>
|
||||
<button type="button" class="btn btn-default generator" id="sql">SQL(CRUD)</button>
|
||||
<button type="button" class="btn btn-default generator" id="json">JSON</button>
|
||||
<button type="button" class="btn btn-default generator" id="xml">XML</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Example row of columns -->
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">MybatisPlus</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="plusentity">entity</button>
|
||||
<button type="button" class="btn btn-default generator" id="plusmapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="pluscontroller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">UI</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="swagger-ui">swagger-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="element-ui">element-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="bootstrap-ui">bootstrap-ui</button>
|
||||
<button type="button" class="btn btn-default generator" id="layui-edit">layui-edit</button>
|
||||
<button type="button" class="btn btn-default generator" id="layui-list">layui-list</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">BeetlSQL</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="beetlmd">beetlmd</button>
|
||||
<button type="button" class="btn btn-default generator" id="beetlcontroller">beetlcontroller</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">JPA</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="entity">jpa-entity</button>
|
||||
<button type="button" class="btn btn-default generator" id="repository">repository</button>
|
||||
<button type="button" class="btn btn-default generator" id="jpacontroller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="btn-toolbar col-md-5" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">JdbcTemplate</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="jtdaoimpl">daoimpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="jtdao">dao</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar col-md-7" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="btn btn-secondary disabled setWidth" id="btnGroupAddon">Mybatis</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group" role="group" aria-label="First group">
|
||||
<button type="button" class="btn btn-default generator" id="mybatis">ibatisXml</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper">mapper</button>
|
||||
<button type="button" class="btn btn-default generator" id="mapper2">mapper2</button>
|
||||
<button type="button" class="btn btn-default generator" id="service">service</button>
|
||||
<button type="button" class="btn btn-default generator" id="service_impl">serviceImpl</button>
|
||||
<button type="button" class="btn btn-default generator" id="controller">controller</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<textarea id="genCodeArea" class="form-control btn-lg" ></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<@netCommon.commonFooter />
|
||||
</body>
|
||||
</html>
|
||||
70
generator-web/src/main/resources/templates/index.html
Normal file
70
generator-web/src/main/resources/templates/index.html
Normal file
@@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<#include "/header.html">
|
||||
<style>
|
||||
.content-wrapper, .right-side, .main-footer{
|
||||
margin-left: 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<!-- ADD THE CLASS layout-boxed TO GET A BOXED LAYOUT -->
|
||||
<body class="hold-transition skin-blue sidebar-mini">
|
||||
<!-- Site wrapper -->
|
||||
<div class="wrapper" id="rrapp" v-cloak>
|
||||
<header class="main-header">
|
||||
<a href="javascript:void(0);" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini"><b>大狼狗</b></span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg"><b>JAVA代码生成平台</b></span>
|
||||
</a>
|
||||
<!-- Header Navbar: style can be found in header.less -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<!--<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>-->
|
||||
<div style="float:left;color:#fff;padding:15px 10px;">For reducing the repetitive CRUD work</div>
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a target="_blank" href="https://github.com/moshowgame/SpringBootCodeGenerator/blob/master/README.md"><i class="el-icon-share"></i> 说明手册</a></li>
|
||||
<li><a target="_blank" href="https://github.com/moshowgame/SpringBootCodeGenerator"><i class="el-icon-star-on"></i> github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!--<section class="content-header">
|
||||
|
||||
</section>-->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content" style="background:#fff;">
|
||||
<iframe scrolling="yes" frameborder="0" style="width:100%;height:100%;overflow:visible;background:#fff;" :src="main"></iframe>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs">
|
||||
Version 2021.1
|
||||
</div>
|
||||
Powered by Moshow郑锴/大狼狗 <a href="https://zhengkai.blog.csdn.net" target="_blank">zhengkai.blog.csdn.net</a> <el-button icon="el-icon-search" @click="donate()" circle>打赏</el-button>
|
||||
</footer>
|
||||
|
||||
<!-- Add the sidebar's background. This div must be placed
|
||||
immediately after the control sidebar -->
|
||||
<div class="control-sidebar-bg"></div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
<script src="${request.contextPath}/statics/js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
126
generator-web/src/main/resources/templates/main.html
Normal file
126
generator-web/src/main/resources/templates/main.html
Normal file
@@ -0,0 +1,126 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<#include "/header.html">
|
||||
<style>
|
||||
.el-form-item__content{
|
||||
line-height : 10px;
|
||||
}
|
||||
/*.el-form-item--mini .el-form-item__content, .el-form-item--mini .el-form-item__label{
|
||||
line-height : 10px;
|
||||
}*/
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="panel panel-default" id="rrapp" v-cloak>
|
||||
<div class="panel-heading">SpringBootCodeGenerator JAVA代码生成平台,又名`JAVA在线代码生成平台`、`JPA在线生成平台`、`sql转java`、`大狼狗代码生成器`、`mybatis在线生成器`、`SQL转Java JPA、MYBATIS实现类代码生成平台`</div>
|
||||
<div style="padding: 10px 0 20px 10px;">
|
||||
<el-form ref="form" :inline="true" :model="formData" label-width="100px" size="mini">
|
||||
<!-- input area-->
|
||||
<el-form-item label="输入区域">
|
||||
<textarea id="inputArea" placeholder="请输入表结构信息..." style="height: 250px;line-height : 10px;" v-model="formData.tableSql"></textarea>
|
||||
</el-form-item>
|
||||
<hr>
|
||||
<!-- setting area-->
|
||||
<el-form-item label="作者">
|
||||
<el-input v-model="formData.options.authorName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="包名">
|
||||
<el-input v-model="formData.options.packageName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="返回(成功)">
|
||||
<el-input v-model="formData.options.returnUtilSuccess"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="返回(失败)">
|
||||
<el-input v-model="formData.options.returnUtilFailure"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="忽略前缀">
|
||||
<el-input v-model="formData.options.ignorePrefix"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入类型">
|
||||
<el-select v-model="formData.options.dataType" >
|
||||
<el-option label="DDL SQL" value="sql"></el-option>
|
||||
<el-option label="JSON" value="json"></el-option>
|
||||
<el-option label="INSERT SQL" value="insert-sql">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="TinyInt转换">
|
||||
<el-select v-model="formData.options.tinyintTransType">
|
||||
<el-option value="boolean" label="boolean"></el-option>
|
||||
<el-option value="Boolean" label="Boolean"></el-option>
|
||||
<el-option value="Integer" label="Integer"></el-option>
|
||||
<el-option value="int" label="int"></el-option>
|
||||
<el-option value="String" label="String"></el-option>
|
||||
<el-option value="Short" label="Short"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间类型">
|
||||
<el-select v-model="formData.options.timeTransType">
|
||||
<el-option value="Date" label="Date"></el-option>
|
||||
<el-option value="DateTime" label="DateTime"></el-option>
|
||||
<el-option value="Time" label="Time"></el-option>
|
||||
<el-option value="Timestamp" label="Timestamp"></el-option>
|
||||
<el-option value="Calendar" label="Calendar"></el-option>
|
||||
<el-option value="LocalDate" label="LocalDate"></el-option>
|
||||
<el-option value="LocalDateTime" label="LocalDateTime"></el-option>
|
||||
<el-option value="LocalTime" label="LocalTime"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="命名类型">
|
||||
<el-select v-model="formData.options.nameCaseType">
|
||||
<el-option label="驼峰" value="CamelCase"></el-option>
|
||||
<el-option label="下划线" value="UnderScoreCase"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="包装类型">
|
||||
<el-switch v-model="formData.options.isPackageType"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="swaggerUI">
|
||||
<el-switch v-model="formData.options.isSwagger"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="字段注释">
|
||||
<el-switch v-model="formData.options.isComment"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="自动引包">
|
||||
<el-switch v-model="formData.options.isAutoImport"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="带包路径">
|
||||
<el-switch v-model="formData.options.isWithPackage"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="Lombok">
|
||||
<el-switch v-model="formData.options.isLombok"></el-switch>
|
||||
</el-form-item>
|
||||
<hr>
|
||||
<!--generate button-->
|
||||
<el-button type="primary" icon="el-icon-caret-right" @click="generate">生成</el-button>
|
||||
<el-button type="primary" icon="el-icon-document-copy" @click="copy" plain>复制</el-button>
|
||||
<hr>
|
||||
<!--templates area-->
|
||||
<el-form ref="form" :inline="true" :model="formData" label-width="100px" size="mini">
|
||||
<div v-for="(item, index) in templates" :key="index">
|
||||
<el-button-group >
|
||||
<el-button type="primary" plain disabled>{{item.group}}</el-button>
|
||||
<span v-for="(childItem, index) in item.templates" :key="index">
|
||||
<el-button @click="setOutputModel">{{childItem.name}}</el-button>
|
||||
</span>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<!-- <el-button-group>
|
||||
<el-button type="primary" plain disabled>MybatisPlus</el-button>
|
||||
<el-button @click="setOutputModel">Controller</el-button>
|
||||
<el-button @click="setOutputModel">Mapper</el-button>
|
||||
</el-button-group>-->
|
||||
</el-form>
|
||||
<hr>
|
||||
<!-- output area-->
|
||||
<el-form-item label="输出区域">
|
||||
<textarea id="outputArea" placeholder="请输入表结构信息..." style="height: 250px;" v-model="outputStr"></textarea>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="${request.contextPath}/statics/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user