Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 131

bercz/codeMan

forked from 小螺旋丸/codeMan
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
Tags (2)
master
v2.35
v2.33
master
Branches (1)
Tags (2)
master
v2.35
v2.33
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
Tags (2)
master
v2.35
v2.33
codeMan
/
src
/
main
/
java
/
codeMaker
/
TablesQuery.java
codeMan
/
src
/
main
/
java
/
codeMaker
/
TablesQuery.java
TablesQuery.java 16.76 KB
Copy Edit Raw Blame History
zhangruixuann authored 2021年12月07日 14:34 +08:00 . feat:多数据源模式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
package codeMaker;
import codeMaker.impl.TablesQueryImpl;
import constant.ChildWindowConstant;
import constant.CodeConstant;
import entity.DataSourceModel;
import entity.Parameters;
import entity.TableRelationModel;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zrx
*/
public class TablesQuery {
protected JFrame frame;
protected JTextField currentModelName;
protected JTextField currentModelName_cn;
protected JTextField methodNameField;
protected JTextField methodName_cnField;
protected JTextField entityNameField;
protected JTextField entityName_cnField;
public JFrame getFrame() {
return frame;
}
public void setFrame(JFrame frame) {
this.frame = frame;
}
/**
* Launch the application.
*/
public static void main(final Parameters parameters) {
EventQueue.invokeLater(() -> {
try {
//获取当前数据源,设置相关信息
String dataSourceName = parameters.getDataSourceName();
DataSourceModel dataSourceModel = ChildWindowConstant.dataSourceModelMap.get(dataSourceName);
ChildWindowConstant.tablesQueryMap = dataSourceModel.getTablesQueryMap();
ChildWindowConstant.tablesQueryEndAndCnMap = dataSourceModel.getTablesQueryEndAndCnMap();
TablesQuery window = TablesQueryImpl.getInstance();
window.initialize(parameters);
ChildWindowConstant.tablesQuery = window;
window.frame.setVisible(true);
JOptionPane.showMessageDialog(window.frame,
"表1字段、表2字段:多个字段使用 & 隔开,字段个数保持一致" + CodeConstant.NEW_LINE + "类型描述:" + CodeConstant.NEW_LINE
+ " 布尔示例:是#否 其中是和否填写数据库中用来表示是和否的值" + CodeConstant.NEW_LINE
+ " 状态码示例:状态名称&状态值#状态名称&状态值(填写状态名称和状态值便于前台生成样式)" + CodeConstant.NEW_LINE
+ " 其他类型将根据类型生成对应的样式,无需描述" + CodeConstant.NEW_LINE + "注意:关联表信息配置完点击确定才会生效!!!",
"提示", JOptionPane.INFORMATION_MESSAGE);
} catch (Exception ignored) {
}
});
}
protected TablesQuery() {
}
/***
* 狗杂函数
* @param parameters
*/
protected TablesQuery(Parameters parameters) {
initialize(parameters);
}
/**
* Initialize the contents of the frame.
*/
private void initialize(Parameters parameters) {
frame = new JFrame();
frame.setResizable(true);
frame.setIconImage(Toolkit.getDefaultToolkit().getImage(TablesQuery.class
.getResource("/org/pushingpixels/substance/internal/contrib/randelshofer/quaqua/images/palette.png")));
frame.setTitle("多表查询配置");
frame.setBounds(100, 100, 1186, 831);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JScrollPane addTableScrollPane = new JScrollPane();
JScrollPane queryScrollPane = new JScrollPane();
JButton addTable = new JButton("添加关联表信息");
JButton addQuery = new JButton("添加查询字段");
JLabel label = new JLabel("当前模块英文名称");
currentModelName = new JTextField();
currentModelName.setColumns(10);
JButton confirm = new JButton("确定");
JLabel label_1 = new JLabel("查看已配置模块");
JButton addCondition = new JButton("添加条件字段");
addQuery.setEnabled(false);
addCondition.setEnabled(false);
JScrollPane conditionScrollPane = new JScrollPane();
JButton restart = new JButton("清空重配");
JComboBox<String> tableConfigExit = new JComboBox<>();
String[] modelArr = ChildWindowConstant.tablesQueryMap.keySet().toArray(new String[]{});
tableConfigExit.setModel(new DefaultComboBoxModel<>(new String[]{"--请选择--"}));
for (String model : modelArr) {
tableConfigExit.addItem(model);
}
JButton confirmRelTable = new JButton("确定");
JLabel label_3 = new JLabel("———》");
JLabel cnLable = new JLabel("中文名称");
currentModelName_cn = new JTextField();
currentModelName_cn.setColumns(10);
JButton button = new JButton("配置说明");
TablesQueryImpl.getInstance().setConfigIntroduceListener(button);
JLabel label_2 = new JLabel("*");
label_2.setForeground(Color.RED);
JLabel methodNameLable = new JLabel("方法名");
methodNameField = new JTextField();
methodNameField.setColumns(10);
JLabel lblNewLabel = new JLabel("*");
lblNewLabel.setForeground(Color.RED);
JLabel methodListLable = new JLabel("模块下方法");
JComboBox<String> methodListCombox = new JComboBox<>();
methodListCombox.setModel(new DefaultComboBoxModel<>(new String[]{"--请选择--"}));
JLabel label_5 = new JLabel("方法中文名称");
methodName_cnField = new JTextField();
methodName_cnField.setColumns(10);
JLabel label_4 = new JLabel("实体名称");
entityNameField = new JTextField();
entityNameField.setColumns(10);
JLabel label_6 = new JLabel("实体中文名称");
entityName_cnField = new JTextField();
entityName_cnField.setColumns(10);
JLabel label_7 = new JLabel("*");
label_7.setForeground(Color.RED);
JButton deleteTable = new JButton("删除尾行");
JButton deleteQuery = new JButton("删除尾行");
JButton deleteCondition = new JButton("删除尾行");
JPanel conditionPanel = new JPanel();
conditionScrollPane.setViewportView(conditionPanel);
JPanel querysPanel = new JPanel();
queryScrollPane.setViewportView(querysPanel);
JPanel tablesPanel = new JPanel();
addTableScrollPane.setViewportView(tablesPanel);
tablesPanel.setLayout(new GridLayout(0, 5, 5, 5));
querysPanel.setLayout(new GridLayout(0, 6, 5, 5));
conditionPanel.setLayout(new GridLayout(0, 8, 5, 5));
String[] tablesArr = new String[]{"关联关系", "表1", "表2", "表1字段", "表2字段"};
String[] querysArr = new String[]{"表名", "字段", "中文名称", "字段类型", "类型描述", "是否可排序"};
String[] conditionsArr = new String[]{"关联关系", "表名", "字段", "中文名称", "字段类型", "类型描述", "比较关系", "固定值"};
List<TableRelationModel> tableRelationModelLists = new ArrayList<>();
Map<String, String> tableMap = new HashMap<>();
TablesQueryImpl.getInstance().setAddTableListener(addTable, addQuery, addCondition, tablesPanel, tablesArr);
// 删除关联表尾行
TablesQueryImpl.getInstance().setDeleteTableListener(deleteTable, tablesPanel);
TablesQueryImpl.getInstance().setAddQueryListener(addQuery, querysPanel, querysArr, tableMap);
TablesQueryImpl.getInstance().setDeleteQueryListener(deleteQuery, querysPanel);
TablesQueryImpl.getInstance().setAddConditionListener(addCondition, conditionPanel, conditionsArr, tableMap);
//删除条件字段
TablesQueryImpl.getInstance().setDeleteConditionListener(deleteCondition, conditionPanel);
TablesQueryImpl.getInstance().setRestartListener(restart, conditionPanel, querysPanel, tablesPanel);
TablesQueryImpl.getInstance().setConfirmListener(parameters, addQuery, confirm, addCondition, tableConfigExit, methodListCombox, conditionPanel, querysPanel, tablesPanel, tableRelationModelLists, tableMap);
TablesQueryImpl.getInstance().setConfirmRelTableListener(addQuery, addCondition, confirmRelTable, conditionPanel, querysPanel, tablesPanel, tableRelationModelLists, tableMap);
// 配置模块下拉框监听
TablesQueryImpl.getInstance().setTableConfigExitListener(tableConfigExit, methodListCombox, conditionPanel, querysPanel, tablesPanel);
// 方法下拉框监听
TablesQueryImpl.getInstance().setMethodComboxListener(tableConfigExit, methodListCombox, conditionPanel, querysPanel, tablesPanel, tablesArr, querysArr, conditionsArr);
JButton delMethodBtn = new JButton("删除当前配置");
// 删除当前模板监听
TablesQueryImpl.getInstance().setDelMethodBtnListener(delMethodBtn, tableConfigExit, methodListCombox, conditionPanel, querysPanel, tablesPanel);
//样式
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(25)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(addQuery)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(deleteQuery))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(addTable)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(deleteTable))
.addGroup(groupLayout.createSequentialGroup()
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(button)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(restart)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(confirm)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(delMethodBtn, GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
.addComponent(queryScrollPane, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 990, GroupLayout.PREFERRED_SIZE)
.addComponent(addTableScrollPane, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 990, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(label_3)))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(confirmRelTable, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(conditionScrollPane, GroupLayout.PREFERRED_SIZE, 1065, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(addCondition)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(deleteCondition))))
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(cnLable)
.addComponent(label))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(currentModelName)
.addComponent(currentModelName_cn, GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE))
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addGroup(groupLayout.createSequentialGroup()
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(label_2)
.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(methodNameLable))
.addGroup(groupLayout.createSequentialGroup()
.addGap(35)
.addComponent(label_5)))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(methodNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblNewLabel))
.addComponent(methodName_cnField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_4)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(entityNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_6)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(entityName_cnField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(label_7)
.addGap(18)
.addComponent(label_1))
.addComponent(methodListLable))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(methodListCombox, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addComponent(tableConfigExit, GroupLayout.PREFERRED_SIZE, 134, GroupLayout.PREFERRED_SIZE))))
.addGap(42))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label)
.addComponent(currentModelName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_2)
.addComponent(methodNameLable)
.addComponent(methodNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel)
.addComponent(entityNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_7)
.addComponent(label_4)
.addComponent(label_1)
.addComponent(tableConfigExit, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(5)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(cnLable)
.addComponent(currentModelName_cn, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_5)
.addComponent(methodName_cnField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_6)
.addComponent(entityName_cnField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(methodListLable)
.addComponent(methodListCombox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(addTable)
.addComponent(deleteTable))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(addTableScrollPane, GroupLayout.PREFERRED_SIZE, 138, GroupLayout.PREFERRED_SIZE)
.addGap(22)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(addQuery)
.addComponent(deleteQuery)))
.addGroup(groupLayout.createSequentialGroup()
.addGap(143)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(label_3)
.addComponent(confirmRelTable))))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(queryScrollPane, GroupLayout.PREFERRED_SIZE, 185, GroupLayout.PREFERRED_SIZE)
.addGap(22)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(addCondition)
.addComponent(deleteCondition))
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(conditionScrollPane, GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(button)
.addComponent(restart)
.addComponent(confirm)
.addComponent(delMethodBtn))
.addContainerGap())
);
frame.getContentPane().setLayout(groupLayout);
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

代码生成器源码,可一键生成controller,service,dao,实体类,单表、多表的sql语句,日志处理、事务支持等,同时可以生成dubbo和springCloud脚手架方便开发微服务项目,能在很大程度上提高开发效率,节约开发时间。代码生成完毕后即为一个前台到后台的完整项目。目前后台支持SSM/SpringBoot,数据库支持mysql/postgresql/oracle,前台样式使用BootStrap,js支持jquery/vue,导入eclipse/idea便可运行,可根据需求自由扩展!
No labels
Apache-2.0
Use Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/bercz/codeMan.git
git@gitee.com:bercz/codeMan.git
bercz
codeMan
codeMan
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /