|
|
|
@ -207,11 +207,11 @@ public class GenerateCode {
|
|
|
|
|
Map<String, String> fieldsComment = (Map<String, String>) jo.get("fieldsComment");
|
|
|
|
|
|
|
|
|
|
String parasWithoutPrimaryKey = "";//带数据类型+字段名称
|
|
|
|
|
String daoFillParameters = "";//不带数据类型,只有字段名称
|
|
|
|
|
String parasWithoutPrimaryKeyAndDataType = "";//不带数据类型,只有字段名称
|
|
|
|
|
for (Map.Entry<String, String> entry : fields.entrySet()) {
|
|
|
|
|
if (!entry.getKey().equals("create_time") && !entry.getKey().equals("b_use")) {
|
|
|
|
|
parasWithoutPrimaryKey += entry.getValue() + " " + entry.getKey() + " , ";//这里必须是反着来的,否则数据类型会重复
|
|
|
|
|
daoFillParameters += entry.getKey() + " , ";
|
|
|
|
|
parasWithoutPrimaryKeyAndDataType += entry.getKey() + " , ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//移除最后一个逗号
|
|
|
|
@ -219,9 +219,9 @@ public class GenerateCode {
|
|
|
|
|
if (parasWithoutPrimaryKey.endsWith(",")) {//去掉最后的逗号
|
|
|
|
|
parasWithoutPrimaryKey = parasWithoutPrimaryKey.substring(0, parasWithoutPrimaryKey.length() - 1);
|
|
|
|
|
}
|
|
|
|
|
daoFillParameters = daoFillParameters.substring(0, daoFillParameters.length() - 1);
|
|
|
|
|
if (daoFillParameters.endsWith(",")) {
|
|
|
|
|
daoFillParameters = daoFillParameters.substring(0, daoFillParameters.length() - 1);
|
|
|
|
|
parasWithoutPrimaryKeyAndDataType = parasWithoutPrimaryKeyAndDataType.substring(0, parasWithoutPrimaryKeyAndDataType.length() - 1);
|
|
|
|
|
if (parasWithoutPrimaryKeyAndDataType.endsWith(",")) {
|
|
|
|
|
parasWithoutPrimaryKeyAndDataType = parasWithoutPrimaryKeyAndDataType.substring(0, parasWithoutPrimaryKeyAndDataType.length() - 1);
|
|
|
|
|
}
|
|
|
|
|
//后缀名称
|
|
|
|
|
String beanName = jo.getStr("beanNameWithoutT");
|
|
|
|
@ -253,8 +253,8 @@ public class GenerateCode {
|
|
|
|
|
dataModel.put("paraList", paraList);//用于注释,显示@para 参数名 参数含义
|
|
|
|
|
dataModel.put("daoName", PropKit.get("daoName"));//显示dao的名称,比如ym
|
|
|
|
|
dataModel.put("beanName", beanName);//实体Bean的名称,用于构建方法名
|
|
|
|
|
dataModel.put("parasWithoutPrimaryKey", parasWithoutPrimaryKey);//包括主键的参数列表,用于构建方法的参数
|
|
|
|
|
dataModel.put("daoFillParameters", daoFillParameters);//不包括主键的参数列表,用于构建方法的参数
|
|
|
|
|
dataModel.put("parasWithoutPrimaryKey", parasWithoutPrimaryKey);//不包括主键的参数列表,用于构建方法的参数
|
|
|
|
|
dataModel.put("parasWithoutPrimaryKeyAndDataType", parasWithoutPrimaryKeyAndDataType);//不包括数据类型的parasWithoutPrimaryKey
|
|
|
|
|
dataModel.put("key", key);//主键名称
|
|
|
|
|
dataModel.put("key_type", key_type);//主键类型
|
|
|
|
|
dataModel.put("table", table);//表名
|
|
|
|
|