專案地址
碼云地址:點擊訪問
專案簡介
CodeBuilder可以幫助你快速實作一整套CRUD操作,自研制代碼模板渲染引擎,目前支持mysql、oracle、sql server等資料庫,內置大量代碼模板可供選擇,其次,您也可以自己制作代碼模板并添加到模板目錄,幫助您可以應付各種開發場景,
使用須知
- 資料庫的名稱全部小寫,名稱要見名之意,多個單詞,用“_”分隔,例如:store
- 資料庫表名稱全部小寫,建議用“tb_”開頭,多個單詞,用“_”分隔,表備注是必須要寫的,例如:tb_goods_item、商品表
- 資料庫欄位名全部小寫,名稱要見名之意,多個單詞,用“_”分隔,列備注是必須要寫的,例如:goods_name、商品名稱
- 資料庫主鍵必須存在且唯一,資料庫型別必須是整數型別,否則代碼生成器將會出錯
替換符
1、全域替換符
注意:“全域替換符”能在模板任意地方使用,包名最少三層,例如:“com.caochenlei.store”
| 替換符代碼 | 替換符含義 | 渲染后內容 |
|---|---|---|
| [project] | 工程名稱 | store |
| [projectComment] | 工程描述 | 在線商城 |
| [projectAuthor] | 工程作者 | caochenlei |
| [projectVersion] | 工程版本 | 1.0.0 |
| [packageName] | 包名 | com.caochenlei.store |
| [path_all] | 全路徑包名 | com/caochenlei/store |
| [path_1] | 1級包名 | com |
| [path_2] | 2級包名 | caochenlei |
| [path_3] | 3級包名 | store |
| [path_n] | n級包名 | … |
| [dbIp] | 資料庫IP | 127.0.0.1 |
| [dbPort] | 資料庫埠 | 3306 |
| [dbName] | 資料庫名稱 | store |
| [dbUrl] | 資料庫地址 | jdbc:mysql://127.0.0.1:3306/store |
| [dbUser] | 資料庫用戶 | root |
| [dbPassword] | 資料庫密碼 | root |
| [dbType] | 資料庫型別 | MYSQL |
| [dbDriverName] | 資料庫驅動 | com.mysql.jdbc.Driver |
| [dbDataSourceType] | 資料庫資料源型別 | com.mchange.v2.c3p0.ComboPooledDataSource |
| [dbDialect] | 資料庫方言 | DbType.MYSQL |
| [dbGenerator] | 資料庫主鍵生成策略 | IdType.AUTO |
2、表級替換符
注意:“標記替換符”能在模板任意地方使用
| 替換符代碼 | 替換符含義 | 渲染后內容 |
|---|---|---|
| [tableName] | 表名稱 | tb_goods_item |
| [tableComment] | 表描述 | 商品表 |
| [table1] | 表名,小寫開頭 | tb_goods_item |
| [Table1Upper] | 表名,大寫開頭 | Tb_goods_item |
| [table2] | 表名,小寫開頭,駝峰格式 | tbGoodsItem |
| [Table2Upper] | 表名,大寫開頭,駝峰格式 | TbGoodsItem |
| [table3] | 表名,小寫開頭,去除前綴,駝峰格式 | goodsItem |
| [Table3Upper] | 表名,大寫開頭,去除前綴,駝峰格式 | GoodsItem |
| [tablePrimaryKeyName] | 表主鍵,名稱 | order_id |
| [tablePrimaryKeyComment] | 表主鍵,備注 | 商品主鍵 |
| [tablePrimaryKeyType] | 表主鍵,資料庫型別 | BIGINT |
| [tablePrimaryKeyLanguageType] | 表主鍵,編程語言型別 | Long |
| [tablePrimary1] | 表主鍵,小寫開頭 | order_id |
| [TablePrimary1Upper] | 表主鍵,大寫開頭 | Order_id |
| [tablePrimary2] | 表主鍵,小寫開頭,駝峰格式 | orderId |
| [TablePrimary2Upper] | 表主鍵,大寫開頭,駝峰格式 | OrderId |
| [tablePrimary3] | 表主鍵,小寫開頭,去除前綴,駝峰格式 | id |
| [TablePrimary3Upper] | 表主鍵,大寫開頭,去除前綴,駝峰格式 | Id |
3、列級替換符
注意:“列級替換符”只能在表級模板中使用
| 替換符代碼 | 替換符含義 | 替換后舉例 |
|---|---|---|
| [columnName] | 列名稱 | tb_goods_name |
| [columnComment] | 列描述 | 商品名稱 |
| [columnType] | 欄位,資料庫型別 | varchar |
| [columnLanguageType] | 欄位,編程語言型別 | String |
| [column1] | 欄位名,小寫開頭 | tb_goods_name |
| [Column1Upper] | 欄位名,大寫開頭 | Tb_goods_name |
| [column2] | 欄位名,小寫開頭,駝峰處理 | tbGoodsName |
| [Column2Upper] | 欄位名,大寫開頭,駝峰處理 | TbGoodsName |
| [column3] | 欄位名,小寫開頭,去除前綴,駝峰處理 | goodsName |
| [Column3Upper] | 欄位名,大寫開頭,去除前綴,駝峰處理 | GoodsName |
聯系作者
Email:774908833@qq.com
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/243977.html
標籤:其他
上一篇:特征工程閱讀筆記(第三章)
