├── .gitignore ├── Public ├── css │ ├── admin.css │ └── index.html ├── images │ ├── hypercoderani.gif │ └── index.html └── js │ └── index.html ├── README.md ├── bower.json ├── index.html ├── model ├── app.js ├── choice.js ├── connect.js ├── index.html ├── main.js └── table.js ├── package.json ├── template └── OneThink │ ├── Controller.php │ ├── add.html │ ├── edit.html │ ├── index.html │ └── thinkphp.js └── view ├── choice.html ├── connect.html ├── empty.html ├── main.html ├── table.html └── table2.html /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | node_modules 3 | bower_components 4 | build -------------------------------------------------------------------------------- /Public/css/admin.css: -------------------------------------------------------------------------------- 1 | /** 2 | * admin.css 3 | */ 4 | 5 | 6 | /* 7 | fixed-layout 固定头部和边栏布局 8 | */ 9 | 10 | html, 11 | body { 12 | height: 100%; 13 | overflow: hidden; 14 | } 15 | 16 | ul { 17 | margin-top: 0; 18 | } 19 | 20 | .admin-icon-yellow { 21 | color: #ffbe40; 22 | } 23 | 24 | .admin-header { 25 | position: fixed; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | z-index: 1500; 30 | font-size: 1.4rem; 31 | margin-bottom: 0; 32 | } 33 | 34 | .admin-header-list a:hover :after { 35 | content: none; 36 | } 37 | 38 | .admin-main { 39 | position: relative; 40 | height: 100%; 41 | padding-top: 51px; 42 | background: #f3f3f3; 43 | } 44 | 45 | .admin-menu { 46 | position: fixed; 47 | z-index: 10; 48 | bottom: 30px; 49 | right: 20px; 50 | } 51 | 52 | .admin-sidebar { 53 | width: 260px; 54 | min-height: 100%; 55 | float: left; 56 | border-right: 1px solid #cecece; 57 | } 58 | 59 | .admin-sidebar.am-active { 60 | z-index: 1600; 61 | } 62 | 63 | .admin-sidebar-list { 64 | margin-bottom: 0; 65 | } 66 | 67 | .admin-sidebar-list li a { 68 | color: #5c5c5c; 69 | padding-left: 24px; 70 | } 71 | 72 | .admin-sidebar-list li:first-child { 73 | border-top: none; 74 | } 75 | 76 | .admin-sidebar-sub { 77 | margin-top: 0; 78 | margin-bottom: 0; 79 | box-shadow: 0 16px 8px -15px #e2e2e2 inset; 80 | background: #ececec; 81 | padding-left: 24px; 82 | } 83 | 84 | .admin-sidebar-sub li:first-child { 85 | border-top: 1px solid #dedede; 86 | } 87 | 88 | .admin-sidebar-panel { 89 | margin: 10px; 90 | } 91 | 92 | .admin-content { 93 | display: -webkit-box; 94 | display: -webkit-flex; 95 | display: -ms-flexbox; 96 | display: flex; 97 | -webkit-box-orient: vertical; 98 | -webkit-box-direction: normal; 99 | -webkit-flex-direction: column; 100 | -ms-flex-direction: column; 101 | flex-direction: column; 102 | background: #fff; 103 | } 104 | 105 | .admin-content, 106 | .admin-sidebar { 107 | height: 100%; 108 | overflow-x: hidden; 109 | overflow-y: scroll; 110 | -webkit-overflow-scrolling: touch; 111 | } 112 | 113 | .admin-content-body { 114 | -webkit-box-flex: 1; 115 | -webkit-flex: 1 0 auto; 116 | -ms-flex: 1 0 auto; 117 | flex: 1 0 auto; 118 | } 119 | 120 | .admin-content-footer { 121 | font-size: 85%; 122 | color: #777; 123 | } 124 | 125 | .admin-content-list { 126 | border: 1px solid #e9ecf1; 127 | margin-top: 0; 128 | } 129 | 130 | .admin-content-list li { 131 | border: 1px solid #e9ecf1; 132 | 133 | border-width: 0 1px; 134 | padding: 20px; 135 | margin-left: -1px; 136 | font-weight: bold; 137 | } 138 | 139 | .admin-content-list li:first-child { 140 | /*border-left: none;*/ 141 | } 142 | 143 | .admin-content-list li:last-child { 144 | /*border-right: none;*/ 145 | } 146 | 147 | .admin-content-table a { 148 | color: #535353; 149 | } 150 | .admin-content-file { 151 | margin-bottom: 0; 152 | color: #666; 153 | } 154 | 155 | .admin-content-file p { 156 | margin: 0 0 5px 0; 157 | font-size: 1.4rem; 158 | } 159 | 160 | .admin-content-file li { 161 | padding: 10px 0; 162 | } 163 | 164 | .admin-content-file li:first-child { 165 | border-top: none; 166 | } 167 | 168 | .admin-content-file li:last-child { 169 | border-bottom: none; 170 | } 171 | 172 | .admin-content-file li .am-progress { 173 | margin-bottom: 4px; 174 | } 175 | 176 | .admin-content-file li .am-progress-bar { 177 | line-height: 14px; 178 | } 179 | 180 | .admin-content-task { 181 | margin-bottom: 0; 182 | } 183 | 184 | .admin-content-task li { 185 | padding: 5px 0; 186 | border-color: #eee; 187 | } 188 | 189 | .admin-content-task li:first-child { 190 | border-top: none; 191 | } 192 | 193 | .admin-content-task li:last-child { 194 | border-bottom: none; 195 | } 196 | 197 | .admin-task-meta { 198 | font-size: 1.2rem; 199 | color: #999; 200 | } 201 | 202 | .admin-task-bd { 203 | font-size: 1.4rem; 204 | margin-bottom: 5px; 205 | } 206 | 207 | .admin-content-comment { 208 | margin-bottom: 0; 209 | } 210 | 211 | .admin-content-comment .am-comment-bd { 212 | font-size: 1.4rem; 213 | } 214 | 215 | .admin-content-pagination { 216 | margin-bottom: 0; 217 | } 218 | .admin-content-pagination li a { 219 | padding: 4px 8px; 220 | } 221 | 222 | @media only screen and (min-width: 641px) { 223 | .admin-sidebar { 224 | display: block; 225 | position: static; 226 | background: none; 227 | } 228 | 229 | .admin-offcanvas-bar { 230 | position: static; 231 | width: auto; 232 | background: none; 233 | -webkit-transform: translate3d(0, 0, 0); 234 | -ms-transform: translate3d(0, 0, 0); 235 | transform: translate3d(0, 0, 0); 236 | } 237 | .admin-offcanvas-bar:after { 238 | content: none; 239 | } 240 | } 241 | 242 | @media only screen and (max-width: 640px) { 243 | .admin-sidebar { 244 | width: inherit; 245 | } 246 | 247 | .admin-offcanvas-bar { 248 | background: #f3f3f3; 249 | } 250 | 251 | .admin-offcanvas-bar:after { 252 | background: #BABABA; 253 | } 254 | 255 | .admin-sidebar-list a:hover, .admin-sidebar-list a:active{ 256 | -webkit-transition: background-color .3s ease; 257 | -moz-transition: background-color .3s ease; 258 | -ms-transition: background-color .3s ease; 259 | -o-transition: background-color .3s ease; 260 | transition: background-color .3s ease; 261 | background: #E4E4E4; 262 | } 263 | 264 | .admin-content-list li { 265 | padding: 10px; 266 | border-width: 1px 0; 267 | margin-top: -1px; 268 | } 269 | 270 | .admin-content-list li:first-child { 271 | border-top: none; 272 | } 273 | 274 | .admin-content-list li:last-child { 275 | border-bottom: none; 276 | } 277 | 278 | .admin-form-text { 279 | text-align: left !important; 280 | } 281 | 282 | } 283 | 284 | /* 285 | * user.html css 286 | */ 287 | .user-info { 288 | margin-bottom: 15px; 289 | } 290 | 291 | .user-info .am-progress { 292 | margin-bottom: 4px; 293 | } 294 | 295 | .user-info p { 296 | margin: 5px; 297 | } 298 | 299 | .user-info-order { 300 | font-size: 1.4rem; 301 | } 302 | 303 | /* 304 | * errorLog.html css 305 | */ 306 | 307 | .error-log .am-pre-scrollable { 308 | max-height: 40rem; 309 | } 310 | 311 | /* 312 | * table.html css 313 | */ 314 | 315 | .table-main { 316 | font-size: 1.4rem; 317 | padding: .5rem; 318 | } 319 | 320 | .table-main button { 321 | background: #fff; 322 | } 323 | 324 | .table-check { 325 | width: 30px; 326 | } 327 | 328 | .table-id { 329 | width: 50px; 330 | } 331 | 332 | @media only screen and (max-width: 640px) { 333 | .table-select { 334 | margin-top: 10px; 335 | margin-left: 5px; 336 | } 337 | } 338 | 339 | /* 340 | gallery.html css 341 | */ 342 | 343 | .gallery-list li { 344 | padding: 10px; 345 | } 346 | 347 | .gallery-list a { 348 | color: #666; 349 | } 350 | 351 | .gallery-list a:hover { 352 | color: #3bb4f2; 353 | } 354 | 355 | .gallery-title { 356 | margin-top: 6px; 357 | font-size: 1.4rem; 358 | } 359 | 360 | .gallery-desc { 361 | font-size: 1.2rem; 362 | margin-top: 4px; 363 | } 364 | 365 | /* 366 | 404.html css 367 | */ 368 | 369 | .page-404 { 370 | background: #fff; 371 | border: none; 372 | width: 200px; 373 | margin: 0 auto; 374 | } 375 | 376 | .tableName{ 377 | font-weight: bold; 378 | } 379 | .tableComment{ 380 | color: #5c5c5c; 381 | font-size: 10pt; 382 | } 383 | .ace_editor { height: 500px;} 384 | 385 | 386 | #fieldbox{ 387 | overflow:auto;overflow-x: hidden; 388 | max-height: 500px; 389 | } 390 | #fieldbox .box{ 391 | height: 50px; 392 | border-right: 1px solid rgb(204, 204, 204); 393 | } 394 | #fieldbox .box .fieldtip{ 395 | font-size: 5px; 396 | overflow: hidden; 397 | text-overflow: ellipsis; 398 | white-space: nowrap; 399 | color: #5c5c5c; 400 | } -------------------------------------------------------------------------------- /Public/css/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaoMengLong/HyperCoder/4b609c1424a82f02667cc4f034739f3a7eb78565/Public/css/index.html -------------------------------------------------------------------------------- /Public/images/hypercoderani.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaoMengLong/HyperCoder/4b609c1424a82f02667cc4f034739f3a7eb78565/Public/images/hypercoderani.gif -------------------------------------------------------------------------------- /Public/images/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaoMengLong/HyperCoder/4b609c1424a82f02667cc4f034739f3a7eb78565/Public/images/index.html -------------------------------------------------------------------------------- /Public/js/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CaoMengLong/HyperCoder/4b609c1424a82f02667cc4f034739f3a7eb78565/Public/js/index.html -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 欢迎使用HyperCoder 2 | 3 | @(HyperCoder)[代码使用|帮助|Markdown] 4 | 5 | **HyperCoder**是一款专为程序员(Programmer)打造的软件开发辅助工具,通过精心的设计与技术实现,全自动生成常用重复性代码,带来前所未有的开发体验。特点概述: 6 | 7 | - **数据库支持** :支持MYSQL数据库,自由选择任意表字段自动生成 CURD 代码; 8 | - **得心应手** :简洁高效的编辑器,灵活简易的操作,一键生成各种代码。跨平台支持可以在 Windows , MacOS , Linux 系统中运行; 9 | - **深度整合** :支持多种编程语言代码生成,拥有各种常用框架的代码自动生成功能。 10 | 11 | ![HyperCoder](https://github.com/CaoMengLong/HyperCoder/raw/master/Public/images/hypercoderani.gif) 12 | ------------------- 13 | 14 | 15 | 16 | ## HyperCoder简介 17 | 18 | > HyperCoder 是一款代码生成器,它允许人们使用它快速的生成各种编程代码。 19 | 20 | ### HyperCoder 二进制版本使用 21 | 目前HyperCoder 已经提供了编译后的二进制版本,可以直接下载解压后直接运行使用。 22 | 23 | #####Windows 版本下载地址: 24 | HyperCoder-v0.1.0-win-32bit [下载地址][1] 25 | HyperCoder-v0.1.0-win-64bit [下载地址][1] 26 | 27 | #####MacOS 版本下载地址: 28 | HyperCoder-v0.1.0-osx-32bit [下载地址][1] 29 | HyperCoder-v0.1.0-osx-64bit [下载地址][1] 30 | 31 | 32 | 33 | ### HyperCoder 源码使用 34 | 您也可以下载HyperCoder 源程序代码进行开发与调试,下面是源程序代码使用方法。HyperCoder 采用 Node.js + [NW.js][2] 开发. UI使用 [AmazeUI][3] 和 [AngularJS][4] ,代码编辑器使用 [Ace][5] 着色器框架。 35 | 36 | 代码下载前请确保您的计算机中已经安装一下版本的软件。 37 | Node.js > Version 4.0 38 | Bower > Last Version 39 | Nw.js > LastVersion 40 | 41 | #####安装NW.js 42 | ``` bash 43 | npm install nw -g 44 | ``` 45 | 46 | #####安装Bower 47 | ``` bash 48 | npm install bower -g 49 | ``` 50 | #####下载源码并初始化依赖模块 51 | ``` bash 52 | git clone https://github.com/CaoMengLong/HyperCoder.git 53 | cd HyperCoder 54 | bower install 55 | npm install 56 | ``` 57 | 58 | #####运行程序 59 | ``` bash 60 | cd HyperCoder 61 | nw . 62 | ``` 63 | 进入源码目录直接运行 nw 即可启动程序. 64 | 65 | ### HyperCoder 源码结构及说明 66 | 67 | TODO 68 | 69 | --------- 70 | 71 | 72 | 73 | 74 | ## 反馈与建议 75 | - 邮箱: 76 | 77 | --------- 78 | 感谢阅读这份帮助文档。非专业文档写手,难免有疏忽,尽请谅解。 79 | 80 | 81 | [1]: http://pan.baidu.com/s/1boJdL4V 82 | [2]: http://nwjs.io/ 83 | [3]: http://amazeui.org/ 84 | [4]: http://www.angularjs.org/ 85 | [5]: https://ace.c9.io/ 86 | 87 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HyperCoder", 3 | "homepage": "https://github.com/CaoMengLong/HyperCoder", 4 | "authors": [ 5 | "caogt <138888611@qq.com>" 6 | ], 7 | "description": "", 8 | "main": "", 9 | "moduleType": [], 10 | "license": "MIT", 11 | "ignore": [ 12 | "**/.*", 13 | "node_modules", 14 | "bower_components", 15 | "test", 16 | "tests" 17 | ], 18 | "dependencies": { 19 | "amazeui": "^2.7.2", 20 | "angular": "angularjs#1.5.8", 21 | "jquery": "2.2.0", 22 | "angular-route": "^1.5.8", 23 | "ace-builds": "^1.2.5", 24 | "angular-ui-ace": "^0.2.3" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | HyperCoder -------------------------------------------------------------------------------- /model/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Myron on 2016/9/21. 3 | */ 4 | var hcApp=angular.module('hc-app',['ngRoute','ui.ace']); 5 | var gui = require('nw.gui'); 6 | var win = gui.Window.get(); 7 | win.maximize(); 8 | var mysql = require('mysql'); //开始使用mysql 9 | 10 | 11 | var configuration = { 12 | appPartialPath: "/view/", 13 | appApiEntryPoint: "/api/" 14 | }; 15 | 16 | hcApp.config(['$routeProvider', function ($routeProvider) { 17 | $routeProvider 18 | .when('/choice', { 19 | templateUrl: configuration.appPartialPath + 'choice.html', 20 | controller: 'ChoiceCtrl' 21 | }) 22 | .when('/table/:name', { 23 | templateUrl: configuration.appPartialPath + 'table.html', 24 | controller: 'TableCtrl' 25 | }) 26 | .otherwise({ 27 | redirectTo: '/choice' 28 | }); 29 | }]); -------------------------------------------------------------------------------- /model/choice.js: -------------------------------------------------------------------------------- 1 | hcApp.controller('ChoiceCtrl', ['$scope', 2 | '$http','ChoiceFactory', 3 | function ($scope, $http,choiceFactory) { 4 | $scope.DataBaseList=new Array(); 5 | 6 | 7 | 8 | 9 | $scope.init=function(){ 10 | choiceFactory.getDataBaseName($scope.server,$scope.port,$scope.username,$scope.password).then(function(data){ 11 | $scope.DataBaseList=data; 12 | $scope.setDataBaseCount(data.length); 13 | }); 14 | } 15 | 16 | $scope.init(); 17 | 18 | 19 | $scope.selectDataBase=function(index){ 20 | $scope.getTablesByDataBaseName($scope.DataBaseList[index].name); 21 | } 22 | 23 | } 24 | 25 | ]); 26 | 27 | 28 | hcApp.factory('ChoiceFactory',['$http','$q',function($http,$q){ 29 | var service={}; 30 | service.getDataBaseName=function(server,port,username,password){ 31 | var deferred=$q.defer(); 32 | var connection = mysql.createConnection({ 33 | host : server, 34 | port : port, 35 | user : username, 36 | password : password 37 | }); 38 | var result= new Array(); 39 | connection.connect(); 40 | connection.query('SELECT `SCHEMA_NAME` FROM `information_schema`.`SCHEMATA`', function(err, rows) { 41 | 42 | //console.log(rows[0]); 43 | //console.log(rows.length); 44 | for (index in rows) 45 | { 46 | var name=rows[index].SCHEMA_NAME; 47 | result[index]={ 48 | name:name 49 | } 50 | } 51 | deferred.resolve(result); 52 | }); 53 | connection.end(); 54 | return deferred.promise; 55 | } 56 | //返回 57 | return service; 58 | }]) 59 | -------------------------------------------------------------------------------- /model/connect.js: -------------------------------------------------------------------------------- 1 | var hcApp=angular.module('hc-app',[]); 2 | var mysql = require('mysql'); //开始使用mysql 3 | 4 | hcApp.controller('ConnectCtrl', ['$scope', 5 | '$http', 6 | function ($scope, $http) { 7 | $scope.server=localStorage.server; 8 | $scope.port=localStorage.port; 9 | $scope.username=localStorage.username; 10 | $scope.password=localStorage.password; 11 | $scope.connectCheck=function(){ 12 | var $modal = $('#failed-alert'); 13 | var $modalLoading = $('#my-modal-loading'); 14 | $modalLoading.modal('open'); 15 | var connection = mysql.createConnection({ 16 | host : $scope.server, 17 | port : $scope.port, 18 | user : $scope.username, 19 | password : $scope.password 20 | }); 21 | connection.connect(function(err){ 22 | if(err){ 23 | console.log('[query] - :'+err); 24 | $modalLoading.modal('close'); 25 | $modal.modal('toggle'); 26 | return; 27 | } 28 | localStorage.server=$scope.server; 29 | localStorage.port=$scope.port; 30 | localStorage.username=$scope.username; 31 | localStorage.password=$scope.password; 32 | console.log('[connection connect] succeed!'); 33 | //$location.path("/main"); 34 | //$location.url(‘/test/1#?a=1#hash‘); 35 | window.location.href="/view/main.html"; 36 | }); 37 | connection.end(); 38 | } 39 | } 40 | 41 | ]); 42 | -------------------------------------------------------------------------------- /model/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /model/main.js: -------------------------------------------------------------------------------- 1 | hcApp.controller('MainCtrl', ['$scope', 2 | '$http','$location','MainFactory', 3 | function ($scope, $http,$location,mainFactory) { 4 | $scope.server=localStorage.server; 5 | $scope.port=localStorage.port; 6 | $scope.username=localStorage.username; 7 | $scope.password=localStorage.password; 8 | 9 | $scope.DataBaseCount=0; 10 | $scope.DataBase={ 11 | name:null, 12 | tableSize:0, 13 | tableList:new Array() 14 | } 15 | //获取数据库的总数量 16 | $scope.setDataBaseCount=function(number){ 17 | $scope.DataBaseCount=number; 18 | } 19 | 20 | //获取1个库的所有表 21 | $scope.getTablesByDataBaseName=function(dataBasename){ 22 | mainFactory.getTablesByDataBaseName(dataBasename).then(function(data){ 23 | $scope.DataBase.tableList=data; 24 | $scope.DataBase.name=dataBasename; 25 | localStorage.databasename=dataBasename; 26 | }); 27 | } 28 | 29 | //点击进入页面 30 | $scope.chickTableName=function(index){ 31 | $location.path("/table/"+$scope.DataBase.tableList[index].name); 32 | } 33 | 34 | } 35 | 36 | ]); 37 | 38 | hcApp.factory('MainFactory',['$http','$q',function($http,$q){ 39 | var service={}; 40 | service.getTablesByDataBaseName=function(dataBasename){ 41 | var deferred=$q.defer(); 42 | var connection = mysql.createConnection({ 43 | host : localStorage.server, 44 | port : localStorage.port, 45 | user : localStorage.username, 46 | password : localStorage.password 47 | }); 48 | var result= new Array(); 49 | connection.connect(); 50 | connection.query('SELECT TABLE_NAME,TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA ="'+dataBasename+'"', function(err, rows) { 51 | 52 | //console.log(rows[0]); 53 | // console.log(err); 54 | for (index in rows) 55 | { 56 | var name=rows[index].TABLE_NAME; 57 | var comment=rows[index].TABLE_COMMENT; 58 | result[index]={ 59 | name:name, 60 | comment:comment 61 | } 62 | } 63 | deferred.resolve(result); 64 | }); 65 | connection.end(); 66 | return deferred.promise; 67 | } 68 | //返回 69 | return service; 70 | }]); 71 | 72 | (function($) { 73 | 'use strict'; 74 | $(function() { 75 | var $fullText = $('.admin-fullText'); 76 | $('#admin-fullscreen').on('click', function() { 77 | $.AMUI.fullscreen.toggle(); 78 | }); 79 | $(document).on($.AMUI.fullscreen.raw.fullscreenchange, function() { 80 | $fullText.text($.AMUI.fullscreen.isFullscreen ? 'Exit FullScreen' : 'FullScreen'); 81 | }); 82 | }); 83 | })(jQuery); -------------------------------------------------------------------------------- /model/table.js: -------------------------------------------------------------------------------- 1 | var fs= require('fs'); 2 | 3 | hcApp.controller('TableCtrl', ['$scope', 4 | '$http','$route','$routeParams','TableFactory','ThinkPHPFactory', 5 | function ($scope, $http,$route,$routeParams,tableFactory,thinkPHPFactory) { 6 | var AceEditor=null; 7 | $scope.table={name:$route.current.params.name}; 8 | $scope.FieldList=new Array(); 9 | $scope.fieldNameArray=new Array(); 10 | $scope.fieldNameArrayStr=null; 11 | $scope.fieldNameParamsStr=null; 12 | $scope.checkeboxFlag=false; 13 | $scope.DB_PREFIX= $scope.table.name.split("_")[0]+"_"; 14 | tableFactory.getFieldList(localStorage.databasename,$scope.table.name).then(function(data){ 15 | $scope.FieldList=data; 16 | }) 17 | 18 | $scope.CheckedAll=function(){ 19 | 20 | for(var i=0;i<$scope.FieldList.length;i++){ 21 | $scope.FieldList[i]['checked']=$scope.checkeboxFlag; 22 | }; 23 | $scope.Checked(); 24 | }; 25 | 26 | $scope.Checked=function(){ 27 | $scope.afterCreat(); //进行先加工 组织待加工字段 28 | 29 | 30 | var fieldarray=new Array(); 31 | fieldarray=$scope.fieldNameArrayStr.split(","); 32 | 33 | var fieldarrayparams=""; 34 | for(var i=0;i 16 | */ 17 | public function index(){ 18 | $name = I('name'); 19 | $map['name'] = array('like', '%' . (string) $name . '%'); 20 | $list = $this->lists('@@tablenoprfixname@@', $map); 21 | int_to_string($list); 22 | $this->assign('_list', $list); 23 | $this->meta_title = '列表页标题'; 24 | $this->display(); 25 | } 26 | 27 | 28 | /** 29 | * 添加 30 | * @author YourName 31 | */ 32 | public function add(@@paramsstr@@){ 33 | if(IS_POST){ 34 | $@@tablenoprfixname@@ = array( 35 | @@addvalue@@ 36 | ); 37 | $id = M('@@tablenoprfixname@@')->add($@@tablenoprfixname@@); 38 | if (!$id) { 39 | $this->error('添加失败!'); 40 | } else { 41 | $this->success('添加成功!', U('index')); 42 | }; 43 | }else{ 44 | $this->display(); 45 | } 46 | } 47 | 48 | /** 49 | * 编辑 50 | * @author YourName 51 | */ 52 | public function edit(@@paramsstr@@){ 53 | if(IS_POST){ 54 | $@@tablenoprfixname@@ = array( 55 | @@editvalue@@ 56 | ); 57 | if (!M('@@tablenoprfixname@@')->where(array('id' => $id))->save($@@tablenoprfixname@@)) { 58 | $this->error('修改失败!'); 59 | } else { 60 | $this->success('修改成功!', U('index')); 61 | }; 62 | }else{ 63 | $data = M('@@tablenoprfixname@@')->where(array('id' => $id))->find(); 64 | $this->data = $data; 65 | $this->display(); 66 | } 67 | } 68 | 69 | 70 | /** 71 | * 删除方法 72 | * @author YourName 73 | */ 74 | public function del($id = ''){ 75 | if(!is_null($id)){ 76 | if (!M('@@tablenoprfixname@@')->where(array('id' => $id))->delete()){ 77 | $this->error('删除失败!'); 78 | } else { 79 | $this->success('删除成功!', U('index')); 80 | }; 81 | } 82 | } 83 | 84 | 85 | /** 86 | * 状态修改 87 | * @author YourName 88 | */ 89 | public function changeStatus($method = null, $id) { 90 | $id = is_array($id) ? implode(',', $id) : $id; 91 | if (empty($id)) { 92 | $this->error('请选择要操作的数据!'); 93 | } 94 | $map['id'] = array('in', $id); 95 | switch (strtolower($method)) { 96 | case 'forbid': 97 | $this->forbid('@@tablenoprfixname@@', $map); 98 | break; 99 | case 'resume': 100 | $this->resume('@@tablenoprfixname@@', $map); 101 | break; 102 | case 'delete': 103 | $this->delete('@@tablenoprfixname@@', $map); 104 | break; 105 | default: 106 | $this->error('@@tablenoprfixname@@'); 107 | } 108 | } 109 | 110 | 111 | } -------------------------------------------------------------------------------- /template/OneThink/add.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |

新增数据

6 |
7 |
8 | @@addcontrolsvalue@@ 9 | 10 |
11 | 12 | 13 |
14 |
15 |
16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /template/OneThink/edit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |

编辑数据

6 |
7 |
8 | @@editcontrolsvalue@@ 9 | 10 |
11 | 12 | 13 |
14 |
15 |
16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /template/OneThink/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |

@@tablefullname@@数据列表

7 |
8 |
9 |
10 | 新 增 11 | 12 | 13 | 14 |
15 | 16 | 17 |
18 |
19 | 20 | 21 |
22 |
23 |
24 | 25 |
26 | 27 | 28 | 29 | 30 | @@tablethvalue@@ 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | @@tabletdvalue@@ 41 | 42 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
状态操作
{$vo.status_text} 43 | 禁用 44 | 45 | 启用 46 | 47 | 删除 48 |
aOh! 暂时还没有内容!
56 |
57 |
58 | {$_page} 59 |
60 |
61 | 62 | 63 | 64 | 65 | 89 | 90 | -------------------------------------------------------------------------------- /template/OneThink/thinkphp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Myron on 2016/9/23. 3 | */ 4 | 5 | hcApp.factory('ThinkPHPFactory',['$http','$q',function($http,$q){ 6 | var service={}; 7 | service.replaceAll=function(str , replaceKey , replaceVal){ 8 | var reg = new RegExp(replaceKey , 'g');//g就是代表全部 9 | return str.replace(reg , replaceVal || ''); 10 | } 11 | 12 | service.getControllerCode=function(data){ 13 | 14 | var deferred=$q.defer(); 15 | var templatecode = fs.readFileSync('template/OneThink/Controller.php','utf-8'); 16 | 17 | var template=new Array(); 18 | //类名的处理 19 | 20 | template.classname=data.TableName.replace(data.DB_PREFIX,"").replace(/_/g,"").replace(/(\w)/,function(v){return v.toUpperCase()}); 21 | template.tablefullname=data.TableName; 22 | template.tablenoprfixname=data.TableName.replace(data.DB_PREFIX,""); 23 | template.ParamsStr=data.ParamsStr; 24 | template.FieldNameArray=data.FieldNameArray; 25 | template.addvalue=""; 26 | console.log(template); 27 | for(var i=0;i$"+template.FieldNameArray[i]+",\n\t\t\t\t"; 29 | } 30 | template.addvalue=template.addvalue.substring(0,template.addvalue.length-1); 31 | template.editvalue=template.addvalue; 32 | var code; 33 | code=service.replaceAll(templatecode,"@@classname@@",template.classname); 34 | code=service.replaceAll(code,"@@tablenoprfixname@@",template.tablenoprfixname); 35 | code=service.replaceAll(code,"@@paramsstr@@",template.ParamsStr); 36 | code=service.replaceAll(code,"@@addvalue@@",template.addvalue); 37 | code=service.replaceAll(code,"@@editvalue@@",template.editvalue); 38 | deferred.resolve(code); 39 | return deferred.promise; 40 | } 41 | 42 | service.getViewIndexCode=function(data){ 43 | var deferred=$q.defer(); 44 | var templatecode = fs.readFileSync('template/OneThink/index.html','utf-8'); 45 | 46 | var template=new Array(); 47 | //类名的处理 48 | 49 | template.classname=data.TableName.replace(data.DB_PREFIX,"").replace(/_/g,"").replace(/(\w)/,function(v){return v.toUpperCase()}); 50 | template.tablefullname=data.TableName; 51 | template.tablenoprfixname=data.TableName.replace(data.DB_PREFIX,""); 52 | template.ParamsStr=data.ParamsStr; 53 | template.FieldNameArray=data.FieldNameArray; 54 | 55 | template.tablethvalue=""; 56 | template.tabletdvalue=""; 57 | console.log(template); 58 | for(var i=0;i$"+template.FieldNameArray[i]+",\n\t\t\t\t"; 60 | template.tablethvalue=template.tablethvalue+""+template.FieldNameArray[i]+"\n\t\t\t\t"; 61 | template.tabletdvalue=template.tabletdvalue+"{$vo."+template.FieldNameArray[i]+"}\n\t\t\t\t\t\t"; 62 | } 63 | var code; 64 | code=service.replaceAll(templatecode,"@@classname@@",template.classname); 65 | code=service.replaceAll(code,"@@tablenoprfixname@@",template.tablenoprfixname); 66 | code=service.replaceAll(code,"@@tablefullname@@",template.tablefullname); 67 | code=service.replaceAll(code,"@@paramsstr@@",template.ParamsStr); 68 | code=service.replaceAll(code,"@@tablethvalue@@",template.tablethvalue); 69 | code=service.replaceAll(code,"@@tabletdvalue@@",template.tabletdvalue); 70 | 71 | deferred.resolve(code); 72 | return deferred.promise; 73 | } 74 | service.getViewEditCode=function(data){ 75 | var deferred=$q.defer(); 76 | var templatecode = fs.readFileSync('template/OneThink/edit.html','utf-8'); 77 | 78 | var template=new Array(); 79 | //类名的处理 80 | 81 | template.classname=data.TableName.replace(data.DB_PREFIX,"").replace(/_/g,"").replace(/(\w)/,function(v){return v.toUpperCase()}); 82 | template.tablefullname=data.TableName; 83 | template.tablenoprfixname=data.TableName.replace(data.DB_PREFIX,""); 84 | template.ParamsStr=data.ParamsStr; 85 | template.FieldNameArray=data.FieldNameArray; 86 | 87 | 88 | template.editcontrolsvalue="\n"; 89 | console.log(template); 90 | for(var i=0;i$"+template.FieldNameArray[i]+",\n\t\t\t\t"; 92 | template.editcontrolsvalue=template.editcontrolsvalue+ 93 | "\t\t
\n"+ 94 | "\t\t\t\n"+ 95 | "\t\t\t
\n"+ 96 | "\t\t\t\t\n"+ 97 | "\t\t\t
\n"+ 98 | "\t\t
\n\t\t"; 99 | } 100 | var code; 101 | code=service.replaceAll(templatecode,"@@classname@@",template.classname); 102 | code=service.replaceAll(code,"@@tablenoprfixname@@",template.tablenoprfixname); 103 | code=service.replaceAll(code,"@@tablefullname@@",template.tablefullname); 104 | code=service.replaceAll(code,"@@paramsstr@@",template.ParamsStr); 105 | code=service.replaceAll(code,"@@editcontrolsvalue@@",template.editcontrolsvalue); 106 | 107 | 108 | deferred.resolve(code); 109 | return deferred.promise; 110 | } 111 | service.getViewAddCode=function(data){ 112 | var deferred=$q.defer(); 113 | var templatecode = fs.readFileSync('template/OneThink/add.html','utf-8'); 114 | 115 | var template=new Array(); 116 | //类名的处理 117 | 118 | template.classname=data.TableName.replace(data.DB_PREFIX,"").replace(/_/g,"").replace(/(\w)/,function(v){return v.toUpperCase()}); 119 | template.tablefullname=data.TableName; 120 | template.tablenoprfixname=data.TableName.replace(data.DB_PREFIX,""); 121 | template.ParamsStr=data.ParamsStr; 122 | template.FieldNameArray=data.FieldNameArray; 123 | 124 | 125 | template.addcontrolsvalue=""; 126 | console.log(template); 127 | for(var i=0;i$"+template.FieldNameArray[i]+",\n\t\t\t\t"; 129 | template.addcontrolsvalue=template.addcontrolsvalue+ 130 | "
\n"+ 131 | "\t\t\t\n"+ 132 | "\t\t\t
\n"+ 133 | "\t\t\t\t\n"+ 134 | "\t\t\t
\n"+ 135 | "\t\t
\n\t\t"; 136 | } 137 | var code; 138 | code=service.replaceAll(templatecode,"@@classname@@",template.classname); 139 | code=service.replaceAll(code,"@@tablenoprfixname@@",template.tablenoprfixname); 140 | code=service.replaceAll(code,"@@tablefullname@@",template.tablefullname); 141 | code=service.replaceAll(code,"@@paramsstr@@",template.ParamsStr); 142 | code=service.replaceAll(code,"@@addcontrolsvalue@@",template.addcontrolsvalue); 143 | 144 | 145 | deferred.resolve(code); 146 | return deferred.promise; 147 | } 148 | //返回 149 | return service; 150 | }]) 151 | 152 | -------------------------------------------------------------------------------- /view/choice.html: -------------------------------------------------------------------------------- 1 |
2 |
DataBase / 通过数据库生产代码
3 |
4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /view/connect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | Now connect to MySQL 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 32 | 33 | 34 | 35 |
36 |
37 |

HyperCoder

38 |

Integrated Development Environment
39 |

40 |
41 |
42 |
43 |
44 |
45 |

Now connect to MySQL

46 |
47 | 48 | 49 |
50 | 51 | 52 |
53 | 54 | 55 |
56 | 57 | 58 |
59 | 60 | 61 |
62 |
63 |
64 | 65 |
66 |
67 |
68 |

© 2016 CaoMengLong@GitHub, Inc. Licensed under MIT license.

69 |
70 |
71 | 72 | 73 |
74 |
75 |
HyperCoder
76 |
77 | MySQL connection failed. 78 |
79 | 82 |
83 |
84 | 85 |
86 |
87 |
Connecting to MySQL
88 |
89 | 90 |
91 |
92 |
93 | 94 | 95 | 96 | 97 | 101 | 102 | -------------------------------------------------------------------------------- /view/empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | Now connect to MySQL 11 | 12 | 13 | 14 |

15 | Hello Amaze UI. 16 |

17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /view/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | HyperCoder 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | HyperCoder 代码生成器 28 |
29 | 30 | 31 | 32 |
33 | 34 | 39 |
40 |
41 | 42 |
43 | 44 |
45 |
46 | 56 | 57 |
58 |
59 |

Gift

60 |

有朋友同行是一种力量,有朋友鼓励是一种安慰,有朋友思念是一种福气,有朋友关心是一种幸福。
61 | 1.0版本_将她献给我的朋友
62 | @梁俊 @王帆 @王元林 @张伟 @张士明 @陈继伟 @孙玉峰 @张海涛

63 |
64 |
65 | 66 |
67 |
68 | 69 | 70 | 71 |
72 |
73 |
74 |
75 | 76 |
77 |
78 |

© 2016 CaoMengLong@GitHub, Inc. Licensed under MIT license.

79 |
80 |
81 | 82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /view/table.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 |

5 | 8 |
9 |
10 | 13 | 16 | 17 | 20 | 21 | 24 | 25 | 28 | 29 |
30 |
31 |
32 | 33 |
Hello World ! 42 |
43 | 44 | 45 | 46 |
47 |
48 |
表结构设计 49 | × 50 |
51 |
52 |
53 |
54 | 55 |
56 |
57 | 58 | 全选
59 |
    60 |
  • 61 |
    62 | {{fl.name}} 63 |
    {{fl.comment}} 64 |
    65 |
  • 66 |
67 |
68 | 69 | 70 |
71 | 72 |
73 |
74 | 75 | 76 |
77 |
78 | 79 | 80 |
81 |
82 | 83 | 84 |
85 |
86 | 87 |
88 | 89 |
90 |
91 | 94 |
95 |
96 | 97 | -------------------------------------------------------------------------------- /view/table2.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | Amaze UI 4 |

5 | 6 | 7 | 8 |
9 | 27 | 28 | 33 | 34 |
35 |
36 | 37 | 41 |
42 |
43 | 44 |
45 | 46 |
47 |
48 |
49 | 50 | 51 | 52 | 53 |
54 |
55 | / 56 | 代码生成 57 |
58 |
59 | 60 |
61 |
62 |
63 |
代码生成
65 |
66 |
67 |
68 | 69 |
70 |
71 | 75 | 79 |
80 | 81 |
82 | 83 | 84 |
85 | 86 |
87 | 88 | 89 |
90 | 91 |
92 |
93 |
94 |
95 | 96 |
97 | 98 |
99 | 100 | 101 |
102 |
103 |
104 |
代码生成
106 |
107 |
108 | 113 |
114 |
115 |
class IndexController extends Controller 124 |
125 |
126 |
OneThink
127 |
...
128 |
129 |
130 | 131 |
132 |
133 |
134 | 135 |
136 | 137 | 138 | 139 | 144 | --------------------------------------------------------------------------------