MCPcopy Index your code
hub / github.com/Bit0r/java-util / upEntityClass

Method upEntityClass

src/main/java/util/AddTableField.java:123–209  ·  view source on GitHub ↗

修改实体类

(String fileName)

Source from the content-addressed store, hash-verified

121 * 修改实体类
122 */
123 public static void upEntityClass(String fileName) {
124 //import com.baomidou.mybatisplus.annotation.FieldStrategy;
125// String fileName = "D:\\test-server\\src\\test\\java\\com\\test\\trade\\api\\impl" +
126// "\\PurchaseBusinessShipmentsElementGradePo.java";
127 String fileName1 = "D:\\test-server\\src\\test\\java\\com\\test\\trade\\rpc" +
128 "\\User1.java";
129 List<String> strList = readFileByLine(fileName);
130 List<String> returnList = new ArrayList<>();
131 StringBuffer strSb = new StringBuffer();
132 String fieldStrategy = "import com.baomidou.mybatisplus.annotation.FieldStrategy;";
133 String tableField = "import com.baomidou.mybatisplus.annotation.TableField;";
134 String ignored = "@TableField(updateStrategy = FieldStrategy.IGNORED)";
135 String exist = "@TableField(exist = false)";
136 String zc = "zhichong";
137 Boolean isFieldStrategy = true;
138 Boolean isTableField = true;
139 Boolean isZc = false;
140 //判断是否存在 fieldStrategy
141 if (strList.contains(fieldStrategy)) {
142 isFieldStrategy = false;
143 }
144 //判断是否存在 tableField
145 if (strList.contains(tableField)) {
146 isTableField = false;
147 }
148 //判断是否存在 有些字段已经添加了 ignored
149 List<Integer> ignoredList = new ArrayList<>();
150 List<Integer> existList = new ArrayList<>();
151
152 for (int i = 0; i < strList.size(); i++) {
153 String data = strList.get(i);
154 if(data.contains(zc)){
155 isZc = true;
156 }
157
158 if (data.contains(ignored) || data.contains(exist)) {
159 Boolean is = true;
160 while (is) {
161 i++;
162 if (i == strList.size()) {
163 is = false;
164 }
165 data = strList.get(i);
166 if (data.contains("private ")) {
167 ignoredList.add(i);
168 is = false;
169 }
170 }
171 }
172 }
173 if(isZc != true){
174 return;
175 }
176
177 //插入数据
178 for (int i = 0; i < strList.size(); i++) {
179 //tt.endsWith(",");
180 String data = strList.get(i);

Callers 1

mainMethod · 0.95

Calls 2

readFileByLineMethod · 0.95
writeToFileAppendMethod · 0.95

Tested by

no test coverage detected