代码生成 web界面

This commit is contained in:
stivepeim
2022-09-08 15:39:41 +08:00
parent 800b1b54a8
commit d3b93d20fd
10 changed files with 152 additions and 47 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
app/unpackage
Crmeb-2022-01-04.log
crmeb_front_log
crmeb/LOG_HOME_IS_UNDEFINED

View File

@@ -5,7 +5,7 @@
"author": "CRMEB",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"dev": "vue-cli-service serve --open",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",

View File

@@ -0,0 +1,29 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from '@/utils/request'
/**
* 查询待生成代码列表
* @param pram
*/
export function getCodegenList(pram) {
const data = {
page: pram.page,
limit: pram.limit,
tableName: pram.tableName
}
return request({
url: '/codegen/list',
method: 'GET',
params: data
})
}

View File

@@ -29,6 +29,7 @@ import operationRouter from './modules/operation'
import appSettingRouter from './modules/appSetting'
import maintainRouter from './modules/maintain'
import mobileRouter from './modules/mobile'
import codegen from './modules/codegen'
/**
@@ -82,6 +83,8 @@ export const constantRoutes = [
maintainRouter,
//移动端管理
mobileRouter,
// 代码生成
codegen,
{
path: '/404',

View File

@@ -11,45 +11,20 @@
import Layout from '@/layout'
const storeRouter = {
path: '/store',
path: '/codegen',
component: Layout,
redirect: '/store/index',
redirect: '/codegen/codegenList',
name: 'Store',
meta: {
title: '商品',
title: '代码生成',
icon: 'clipboard'
},
children: [
{
path: 'index',
component: () => import('@/views/store/index'),
path: 'codegenList',
component: () => import('@/views/codegen/codegenList'),
name: 'StoreIndex',
meta: { title: '商品管理', icon: '' }
},
{
path: 'sort',
component: () => import('@/views/store/sort/index'),
name: 'Sort',
meta: { title: '商品分类', icon: '' }
},
{
path: 'attr',
component: () => import('@/views/store/storeAttr/index'),
name: 'SortAttr',
meta: { title: '商品规格', icon: '' }
},
{
path: 'comment',
component: () => import('@/views/store/storeComment/index'),
name: 'StoreComment',
meta: { title: '商品评论', icon: '' }
},
{
path: 'list/creatProduct/:id?/:isDisabled?',
component: () => import('@/views/store/creatStore/index'),
name: 'SortCreat',
meta: { title: '商品添加', noCache: true, activeMenu: `/store/index` },
hidden: true
meta: { title: '待生成列表', icon: '' }
}
]
}

View File

@@ -1,10 +1,107 @@
<template>
$END$
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="container">
<el-form inline size="small" @submit.native.prevent>
<el-form-item label="关键字">
<el-input v-model="codeListData.pram.tableName" placeholder="表名称" clearable size="small">
<el-button slot="append" icon="el-icon-search" size="small" @click="handlerSearch" />
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click.native="handleGenCode" :disabled="codeListData.selectedTables.length === 0">生成代码</el-button>
</el-form-item>
</el-form>
</div>
</div>
<el-table
ref="codeList"
:data="codeListData.data.list"
:highlight-current-row="true"
size="mini"
class="table"
@selection-change="handleSelectionChange"
:header-cell-style=" {fontWeight:'bold'}">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="表名称" prop="tableName" min-width="180"/>
<el-table-column label="表描述" prop="tableComment" min-width="180"/>
<el-table-column label="创建时间" prop="createTime" min-width="200" />
</el-table>
<el-pagination
:current-page="codeListData.pram.page"
:page-sizes="constants.page.limit"
:layout="constants.page.layout"
:total="codeListData.data.totalCount"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</div>
</template>
<script>
import { getCodegenList } from '@/api/codegen'
import SettingMer from "@/utils/settingMer";
export default {
name: "codegenList"
name: "codegenList",
data(){
return{
constants: this.$constants,
codeListData:{
pram:{
page: 1,
limit: 10,
tableName: ''
},
data:{
list:[],
totalCount:0
},
selectedTables:[]
}
}
},
created(){
},
mounted(){
},
methods: {
handlerSearch(){
this.codeListData.pram.limit = 10;
this.codeListData.pram.page = 1;
this.getList(this.codeListData.pram);
},
getList(pram){
getCodegenList(pram).then(res => {
this.codeListData.data = res;
})
},
handleSizeChange(val) {
this.codeListData.pram.limit = val
this.getList(this.codeListData.pram)
},
handleCurrentChange(val) {
this.codeListData.pram.page = val
this.getList(this.codeListData.pram)
},
handleSelectionChange(selectedRows){
this.codeListData.selectedTables = [];
selectedRows.forEach(row => {
this.codeListData.selectedTables.push(row.tableName);
});
},
handleGenCode(){
window.open(`${SettingMer.apiBaseURL}codegen/code?tables=${this.codeListData.selectedTables.join(",")}`);
}
}
}
</script>

View File

@@ -32,7 +32,7 @@ module.exports = {
productionSourceMap: false,
devServer: {
port: port,
open: true,
open: false,
overlay: {
warnings: false,
errors: true

View File

@@ -7,7 +7,7 @@ crmeb:
wechat-js-api-beta: true #微信js api是否是beta版本
asyncConfig: false #是否同步config表数据到redis
asyncWeChatProgramTempList: false #是否同步小程序公共模板库
imagePath: /你的项目绝对路径/crmebimage/ # 服务器图片路径配置 斜杠结尾
imagePath: /Users/stivepeim/Documents/ZBKJ/OpenSource/CRMEBJava/crmeb/crmebimage/ # 服务器图片路径配置 斜杠结尾
database: mysql
# 配置端口
@@ -39,16 +39,16 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/crmeb_java_os?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
username: crmeb_java_os
password: 111111
url: jdbc:mysql://118.178.234.105:3306/crmeb_os?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
username: crmeb_os
password: cGEfaaRDbwd6cc2k
redis:
host: 127.0.0.1 #地址
host: 118.178.234.105 #地址
port: 6379 #端口
password: 111111
password: 1qazxsw2
timeout: 30000 # 连接超时时间(毫秒)
database: 14 #默认数据库
database: 15 #默认数据库
jedis:
pool:
max-active: 200 # 连接池最大连接数(使用负值表示没有限制)

View File

@@ -142,6 +142,7 @@ public class GenCodeUtils {
Template tpl = Velocity.getTemplate(template, "UTF-8");
tpl.merge(context, sw);
try {
zip.finish();
zip.putNextEntry(new ZipEntry(getFileName(template, tableEntity.getClassName(), config.getString("package"), config.getString("moduleName"))));
IOUtils.write(sw.toString(), zip, "UTF-8");
IOUtils.closeQuietly(sw);

View File

@@ -7221,12 +7221,12 @@ INSERT INTO `eb_system_config` VALUES (7783, 'wechat_qrcode', 'wechat_qrcode', 6
INSERT INTO `eb_system_config` VALUES (7784, 'wechat_share_title', 'wechat_share_title', 65, '一码秦川', 0, '2021-12-25 12:26:14', '2021-12-25 12:26:14');
INSERT INTO `eb_system_config` VALUES (7785, 'wechat_share_synopsis', 'wechat_share_synopsis', 65, '一码秦川', 0, '2021-12-25 12:26:14', '2021-12-25 12:26:14');
INSERT INTO `eb_system_config` VALUES (7786, 'h5_avatar', 'h5_avatar', 65, 'crmebimage/public/operation/2021/12/25/0427b90c74b64a03ae3e7e5c628ef7d69038aimgou.jpg', 0, '2021-12-25 12:26:14', '2021-12-25 12:26:14');
INSERT INTO `eb_system_config` VALUES (7802, 'api_url', 'api_url', 64, 'https://127.0.0.1:8080', 0, '2021-12-25 16:53:20', '2021-12-25 16:53:20');
INSERT INTO `eb_system_config` VALUES (7802, 'api_url', 'api_url', 64, 'http://127.0.0.1:8080', 0, '2021-12-25 16:53:20', '2021-12-25 16:53:20');
INSERT INTO `eb_system_config` VALUES (7803, 'site_logo_lefttop', 'site_logo_lefttop', 64, 'crmebimage/public/operation/2021/12/25/6d292f4a663a453e8bcc9410eda89db55z1vksp7fx.png', 0, '2021-12-25 16:53:20', '2021-12-25 16:53:20');
INSERT INTO `eb_system_config` VALUES (7804, 'site_logo_square', 'site_logo_square', 64, 'crmebimage/public/maintain/2021/12/25/8cf6cd4fd29c4a59a094ba028c8f3f4czyd21fctzc.png', 0, '2021-12-25 16:53:20', '2021-12-25 16:53:20');
INSERT INTO `eb_system_config` VALUES (7805, 'site_logo_login', 'site_logo_login', 64, 'crmebimage/public/maintain/2021/12/25/8cf6cd4fd29c4a59a094ba028c8f3f4czyd21fctzc.png', 0, '2021-12-25 16:53:20', '2021-12-25 16:53:20');
INSERT INTO `eb_system_config` VALUES (7806, 'admin_login_bg_pic', 'admin_login_bg_pic', 64, 'crmebimage/public/maintain/2021/12/25/0016d1efa86d41e38e76801a7cd743c6wcupy21hvb.jpg', 0, '2021-12-25 16:53:20', '2021-12-25 16:53:20');
INSERT INTO `eb_system_config` VALUES (7807, 'localUploadUrl', 'localUploadUrl', 108, 'https://127.0.0.1:8080', 0, '2021-12-30 15:17:28', '2021-12-30 15:17:28');
INSERT INTO `eb_system_config` VALUES (7807, 'localUploadUrl', 'localUploadUrl', 108, 'http://127.0.0.1:8080', 0, '2021-12-30 15:17:28', '2021-12-30 15:17:28');
INSERT INTO `eb_system_config` VALUES (7808, 'image_ext_str', 'image_ext_str', 108, 'jpg,jpeg,gif,png,bmp,PNG,JPG,mp4', 0, '2021-12-30 15:17:28', '2021-12-30 15:17:28');
INSERT INTO `eb_system_config` VALUES (7809, 'image_max_size', 'image_max_size', 108, '10', 0, '2021-12-30 15:17:28', '2021-12-30 15:17:28');
INSERT INTO `eb_system_config` VALUES (7810, 'file_ext_str', 'file_ext_str', 108, 'zip,doc,docx,xls,xlsx,pdf,mp3,wma,wav,amr,mp4', 0, '2021-12-30 15:17:28', '2021-12-30 15:17:28');
@@ -7815,8 +7815,7 @@ INSERT INTO `eb_system_menu` VALUES (400, 39, '会员等级列表', '', 'admin:u
INSERT INTO `eb_system_menu` VALUES (401, 40, '会员标签详情', '', 'admin:user:tag:info', '', 'A', 0, 1, 0, '2021-12-13 10:37:04', '2021-12-13 10:37:04');
INSERT INTO `eb_system_menu` VALUES (402, 344, '获取微信公众号js配置', '', 'admin:wechat:config', '', 'A', 0, 1, 0, '2021-12-13 10:38:24', '2021-12-13 10:38:24');
INSERT INTO `eb_system_menu` VALUES (403, 344, '微信素材上传', '', 'admin:wechat:media:upload', '', 'A', 0, 1, 0, '2021-12-13 10:38:50', '2021-12-13 10:38:50');
INSERT INTO `eb_system_menu` VALUES (404, 13, '敏感操作日志', '', 'admin:log:sensitive:list', '/maintain/sensitiveLog', 'C', 0, 1, 1, '2021-12-13 17:54:06', '2021-12-13 18:12:17');
INSERT INTO `eb_system_menu` VALUES (405, 13, '代码生成', '', '', '/codegen/codegenList', 'C', 0, 1, 1, '2022-08-23 18:07:37', '2022-08-23 18:07:37');
INSERT INTO `eb_system_menu` VALUES (404, 13, '代码生成', '', '', '/codegen/codegenList', 'C', 0, 1, 0, '2022-08-23 18:07:37', '2022-08-23 18:07:37');
-- ----------------------------
-- Table structure for eb_system_notification