nutz有占位符的封装吗 列如 这样 字符串拼接
public static String getFileName(String template, TableInfo table, String moduleName) {
// 小写类名
String classname = table.getClassname();
// 大写类名
String className = table.getClassName();
String javaPath = PROJECT_PATH;
String javaPathOpen = PROJECT_PATH_OPEN;
String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + classname;
if (Lang.isNotEmpty(classname)) {
javaPath = javaPath.replace(".", "/") + "/";
}
if (template.contains("Models.java.vm")) {
return javaPath + "models" + "/" + className + ".java";
}
if (template.contains("Service.java.vm")) {
return javaPath + "services" + "/" + className + "Service.java";
}
if (template.contains("ServiceImpl.java.vm")) {
return javaPath + "services/impl" + "/" + className + "ServiceImpl.java";
}
if (template.contains("ApiController.java.vm")) {
return javaPathOpen + "/Api" + className + "Controller.java";
}
if (template.contains("Controller.java.vm")) {
return javaPath + "controller" + "/" + className + "Controller.java";
}
if (template.contains("list.html.vm")) {
return htmlPath + "/" + classname + ".html";
}
if (template.contains("add.html.vm")) {
return htmlPath + "/" + "add.html";
}
if (template.contains("edit.html.vm")) {
return htmlPath + "/" + "edit.html";
}
if (template.contains("tree.html.vm")) {
return htmlPath + "/" + "tree.html";
}
if (template.contains("sql.vm")) {
return classname + "Menu.sql";
}
return null;
}
有没有nutz的工具 可以用占位符 传参数进去
public static String getFileName(String template, GenTable genTable)
{
// 文件名称
String fileName = "";
// 包路径
String packageName = genTable.getPackageName();
// 模块名
String moduleName = genTable.getModuleName();
// 大写类名
String className = genTable.getClassName();
// 业务名称
String businessName = genTable.getBusinessName();
String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/");
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + businessName;
if (template.contains("domain.java.vm"))
{
fileName = StringUtils.format("{}/{}/domain/{}.java", javaPath, businessName, className);
}
else if (template.contains("mapper.java.vm"))
{
fileName = StringUtils.format("{}/{}/mapper/{}Mapper.java", javaPath, businessName, className);
}
else if (template.contains("service.java.vm"))
{
fileName = StringUtils.format("{}/{}/service/I{}Service.java", javaPath, businessName, className);
}
else if (template.contains("serviceImpl.java.vm"))
{
fileName = StringUtils.format("{}/{}/service/impl/{}ServiceImpl.java", javaPath, businessName, className);
}
else if (template.contains("controller.java.vm"))
{
fileName = StringUtils.format("{}/{}/controller/{}Controller.java", javaPath, businessName, className);
}
else if (template.contains("mapper.xml.vm"))
{
fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className);
}
else if (template.contains("list.html.vm"))
{
fileName = StringUtils.format("{}/{}.html", htmlPath, businessName);
}
else if (template.contains("list-tree.html.vm"))
{
fileName = StringUtils.format("{}/{}.html", htmlPath, businessName);
}
else if (template.contains("tree.html.vm"))
{
fileName = StringUtils.format("{}/tree.html", htmlPath);
}
else if (template.contains("add.html.vm"))
{
fileName = StringUtils.format("{}/add.html", htmlPath);
}
else if (template.contains("edit.html.vm"))
{
fileName = StringUtils.format("{}/edit.html", htmlPath);
}
else if (template.contains("sql.vm"))
{
fileName = businessName + "Menu.sql";
}
return fileName;
}