You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.3 KiB
Java
36 lines
1.3 KiB
Java
package com.supervision;
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
import java.io.File;
|
|
import java.nio.charset.Charset;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class GenerateXml {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
String sourcePath = "/Users/flevance/Java/virtual-patient/virtual-patient-graph/src/main/java/com/supervision/dao";
|
|
String targetPath = "/Users/flevance/Java/virtual-patient/virtual-patient-graph/src/main/resources/nebulaMapper/";
|
|
String packageName = "com.supervision.dao.";
|
|
List<String> sourceFileList = FileUtil.listFileNames(sourcePath);
|
|
for (String sourceFile : sourceFileList) {
|
|
String newFileName = sourceFile.replace(".java", ".xml");
|
|
/**
|
|
* <mapper namespace="com.supervision.dao.MedicalRecDao">
|
|
*
|
|
* </mapper>
|
|
*/
|
|
if (!FileUtil.exist(targetPath + newFileName)) {
|
|
File file = FileUtil.newFile(targetPath + newFileName);
|
|
List<Object> lineList = new ArrayList<>();
|
|
lineList.add("<mapper namespace=\"" + packageName + newFileName.replace(".xml", "") + "\">");
|
|
lineList.add("");
|
|
lineList.add("</mapper>");
|
|
FileUtil.writeLines(lineList, file, Charset.defaultCharset());
|
|
}
|
|
}
|
|
}
|
|
}
|