1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00
Signed-off-by: Hai Liang Wang <hai@chatopera.com>
This commit is contained in:
Hai Liang Wang 2022-12-29 15:47:27 +08:00
parent d3c9d711a2
commit 78f7be35ee
9 changed files with 15 additions and 348 deletions

View File

@ -1,37 +0,0 @@
.vscode
*.swp
*.swo
*.sublime-*
*.pyc
jmeter.log
__pycache__
tmp/
package-lock.json
node_modules/
sftp-config.json
.DS_Store
*.iml
*.ipr
*.iws
*.idea
~$*.xls*
~$*.ppt*
~$*.doc*
nohup.out
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
build
build-*
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
.env
.fid
_build

View File

@ -1,15 +0,0 @@
# 数据字典
生成春松客服数据库数据字典。
## Prerequisite
* Php
* pandoc
## Generate
```
cp sample.env .env
./bin/gen-mysql-table-dicts.sh
```

View File

@ -1,123 +0,0 @@
<?php
/**
* 生成mysql数据字典
*/
header("Content-type: text/html; charset=utf-8");
// 配置数据库
// options
$shortopts = "";
$shortopts .= "H:"; // host
$shortopts .= "P:"; // port
$shortopts .= "d:"; // database
$shortopts .= "u:"; // username
$shortopts .= "p:"; // password
$shortopts .= "v:"; // version
$shortopts .= "s:"; // version
$shortopts .= "m:"; // version
$options = getopt($shortopts);
define('DB_HOST',$options["H"]);
define('DB_PORT', (int)$options["P"]);
define('DB_NAME',$options["d"]);
define('DB_USER',$options["u"]);
define('DB_PASS',$options["p"]);
define('DB_CHAR', "utf8");
// 其他配置
$title = '春松客服-数据字典';
$version = $options["v"];
$link_sql = $options["s"];
$link_model = $options["m"];
$conn = @mysqli_connect(DB_HOST.':'.DB_PORT,DB_USER,DB_PASS) or die("Mysql connect is error.");
mysqli_select_db($conn, DB_NAME);
mysqli_query($conn, 'SET NAMES '.DB_CHAR);
$table_result = mysqli_query($conn, 'show tables');
// 取得所有的表名
while($row = mysqli_fetch_array($table_result)) {
$tables [] ['TABLE_NAME'] = $row [0];
}
// 循环取得所有表的备注及表中列消息
foreach($tables as $k => $v){
$sql = 'SELECT * FROM ';
$sql .= 'INFORMATION_SCHEMA.TABLES ';
$sql .= 'WHERE ';
$sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '".DB_NAME."'";
$table_result = mysqli_query($conn, $sql);
while($t = mysqli_fetch_array($table_result)) {
$tables [$k] ['TABLE_COMMENT'] = $t ['TABLE_COMMENT'];
}
$sql = 'SELECT * FROM ';
$sql .= 'INFORMATION_SCHEMA.COLUMNS ';
$sql .= 'WHERE ';
$sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '".DB_NAME."'";
$fields = array();
$field_result = mysqli_query($conn, $sql);
while($t = mysqli_fetch_array($field_result)) {
$fields [] = $t;
}
$tables [$k] ['COLUMN'] = $fields;
}
mysqli_close($conn);
$content = '';
// 循环所有表
foreach($tables as $k => $v){
$content .= '<p><h2>'. $v['TABLE_NAME'] . '&nbsp;</h2>';
$content .= '<table border="1" cellspacing="0" cellpadding="0" align="center">';
$content .= '<caption>' . ' ' . $v ['TABLE_COMMENT'] . '</caption>';
$content .= '<tbody><tr><th>字段名</th><th>数据类型</th><th>默认值</th>
<th>允许非空</th>
<th>自动递增</th><th>备注</th></tr>';
$content .= '';
foreach($v ['COLUMN'] as $f){
$content .= '<tr><td class="c1">' . $f ['COLUMN_NAME'] . '</td>';
$content .= '<td class="c2">' . $f ['COLUMN_TYPE'] . '</td>';
$content .= '<td class="c3">&nbsp;' . $f ['COLUMN_DEFAULT'] . '</td>';
$content .= '<td class="c4">&nbsp;' . $f ['IS_NULLABLE'] . '</td>';
$content .= '<td class="c5">' . ($f ['EXTRA'] == 'auto_increment' ? '是' : '&nbsp;') . '</td>';
$content .= '<td class="c6">&nbsp;' . $f ['COLUMN_COMMENT'] . '</td>';
$content .= '</tr>';
}
$content .= '</tbody></table></p>';
}
// 输出
$date = date('Y-m-d');
$html = <<<EOT
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>$title</title>
<style>
body,td,th {font-family:"宋体"; font-size:12px;}
table{border-collapse:collapse;border:1px solid #CCC;background:#6089D4;}
table caption{text-align:left; background-color:#fff; line-height:2em; font-size:14px; font-weight:bold; }
table th{text-align:left; font-weight:bold;height:26px; line-height:25px; font-size:16px; border:3px solid #fff; color:#ffffff; padding:5px;}
table td{height:25px; font-size:12px; border:3px solid #fff; background-color:#f0f0f0; padding:5px;}
.c1{ width: 150px;}
.c2{ width: 130px;}
.c3{ width: 70px;}
.c4{ width: 80px;}
.c5{ width: 80px;}
.c6{ width: 300px;}
</style>
</head>
<body>
<h1 style="text-align:center;">$title<span style="font-size:14px;color: #ccc;margin-left:20px;">(生成日期: $date)</span></h1>
<p><span>版本:$version</span>SQL<a href="$link_sql">下载链接</a>Models PDF<a href="$link_model">下载链接</a></p>
$content
</br>
<p style="text-align:center"> - 春松客服, <a href="https://www.cskefu.com">https://www.cskefu.com</a> - </p>
</body>
</html>
EOT;
file_put_contents('index.html', $html);
echo 'success!';
?>

View File

@ -1,88 +0,0 @@
<!DOCTYPE html>
<html $if(lang)$ lang="$lang$" $endif$ dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>$if(title)$$title$$endif$</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon.png">
$if(template_css)$
<link rel="stylesheet" href="$template_css$">
$else$
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.4/css/uikit.gradient.css">
$endif$
<link rel="stylesheet" href="style.css">
<script src="https://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
<script src="uikit.js"></script>
<script src="scripts.js"></script>
<script src="jquery.sticky-kit.js "></script>
<meta name="generator" content="pandoc-uikit" />
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
$if(date-meta)$
<meta name="date" content="$date-meta$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
<style type="text/css">code{white-space: pre;}</style>
$if(quotes)$
<style type="text/css">q { quotes: "“" "”" "" ""; }</style>
$endif$
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$for(css)$
<link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
$endfor$
$if(math)$
$math$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
<div class="uk-container uk-container-center uk-margin-top uk-margin-large-bottom">
$if(title)$
<div class="uk-grid" data-uk-grid-margin>
<div class="uk-width-1-1">
<h1 class="uk-heading-large">$title$</h1>
$if(date)$
<h3 class="uk-heading-large">$date$</p></h3>
$endif$
$for(author)$
<p class="uk-text-large">$author$</p>
$endfor$
</div>
</div>
$endif$
<div class="uk-grid" data-uk-grid-margin >
<div class="uk-width-medium-1-4">
<div class="uk-overflow-container" data-uk-sticky="{top:25,media: 768}">
<div class="uk-panel uk-panel-box menu-begin" >
$if(toc)$
$toc$
$endif$
</div>
</div>
</div>
<div class="uk-width-medium-3-4">
$body$
</div>
</div>
</div>
</body>
</html>

View File

@ -1,66 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
cwdDir=$PWD
export PYTHONUNBUFFERED=1
export PATH=/opt/miniconda3/envs/venv-py3/bin:$PATH
export TS=$(date +%Y%m%d%H%M%S)
export DATE=`date "+%Y%m%d"`
export DATE_WITH_TIME=`date "+%Y%m%d-%H%M%S"` #add %3N as we want millisecond too
php=/c/devel/php/php.exe
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/..
if [ ! -f .env ]; then
echo "Copy sample.env to .env, modify it at first."
exit 1
fi
source .env
# generate index.html
rm -rf tmp
mkdir tmp
cd tmp
$php ../app/generator.php -H$DB_HOST \
-P$DB_PORT \
-d$DATABASE \
-u$DB_USER \
-p$DB_PASS \
-v$PRODUCT_VERSION \
-s$DOWNLOAD_SQL \
-m$DOWNLOAD_MODEL_PDF
# generate beautiful html
rm -rf docs
mkdir docs
cd docs
pandoc ../index.html \
-o index.html \
-f html \
--template ../../assets/standalone.html \
--toc --toc-depth=2
cp index.html $baseDir/../../../docs/mysql-dicts.html
echo "Generated doc index.html in" `pwd`
# compress files
cd ..
DATABASE_DICTS_ZIP=$DATABASE.dicts.$TS.zip
if [ -f $DATABASE_DICTS_ZIP ]; then
rm -rf $DATABASE_DICTS_ZIP
fi
zip $DATABASE_DICTS_ZIP -r docs
echo "Compress with zip file" `pwd`/$DATABASE_DICTS_ZIP

View File

@ -1,8 +0,0 @@
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASS=123456
DATABASE=cskefu_v8_design
PRODUCT_VERSION=v8
DOWNLOAD_SQL=https://github.com/cskefu/cskefu
DOWNLOAD_MODEL_PDF=https://github.com/cskefu/cskefu

View File

@ -6,8 +6,11 @@
<body>
<h2>本站点仅用来托管以下内容</h2>
<h3>数据字典</h3>
参考链接:<a href="mysql-dicts.html">mysql-dicts.html</a>
<h3>数据字典</h3>
参考链接:<a href="mysql-dicts.html">mysql-dicts.html</a>
<h3>数据思维导图</h3>
参考链接:<a href="mysql-mindmap.xmind">mysql-mindmap.xmind</a>
<h2>官网</h2>
更多内容访问官方网站:<a href="https://www.cskefu.com">https://www.cskefu.com</a>

View File

@ -39,10 +39,10 @@
<ul>
<li><a
href="#春松客服-数据字典生成日期-2022-12-28"
id="toc-春松客服-数据字典生成日期-2022-12-28">春松客服-数据字典<span
href="#春松客服-数据字典生成日期-2022-12-29"
id="toc-春松客服-数据字典生成日期-2022-12-29">春松客服-数据字典<span
style="font-size:14px;color: #ccc;margin-left:20px;">(生成日期:
2022-12-28)</span></a>
2022-12-29)</span></a>
<ul>
<li><a
href="#cs_group_users"
@ -86,10 +86,11 @@
<div class="uk-width-medium-3-4">
<h1 style="text-align:center;"
id="春松客服-数据字典生成日期-2022-12-28">春松客服-数据字典<span
id="春松客服-数据字典生成日期-2022-12-29">春松客服-数据字典<span
style="font-size:14px;color: #ccc;margin-left:20px;">(生成日期:
2022-12-28)</span></h1>
<p><span>版本v8</span>SQL<a
2022-12-29)</span></h1>
<p><span>生成工具:<a
href="https://github.com/hailiang-wang/mysql-tables-design">mysql-tables-design</a></span><span>设计版本v8</span>SQL<a
href="https://github.com/cskefu/cskefu">下载链接</a>Models PDF<a
href="https://github.com/cskefu/cskefu">下载链接</a></p>
<h2 id="cs_group_users">cs_group_users </h2>
@ -441,7 +442,7 @@ data-align="center">
<td class="c4"> YES</td>
<td class="c5"> </td>
<td class="c6"> Plugin state, e.g. installed, activated, disabled,
expired</td>
expired, outdated</td>
</tr>
<tr class="odd">
<td class="c1">installerid</td>
@ -777,12 +778,12 @@ create, update, delete, admin</td>
<td class="c1">resourceid</td>
<td class="c2">varchar(45)</td>
<td class="c3"> </td>
<td class="c4"> NO</td>
<td class="c4"> YES</td>
<td class="c5"> </td>
<td class="c6"> Resource Id</td>
</tr>
<tr class="odd">
<td class="c1">pattern</td>
<td class="c1">pathpattern</td>
<td class="c2">varchar(500)</td>
<td class="c3"> </td>
<td class="c4"> NO</td>

BIN
docs/mysql-mindmap.xmind Normal file

Binary file not shown.