Browse Source

fix field

AE86 5 years ago
parent
commit
a4942d477d

+ 7 - 0
dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/TableGroupServiceImpl.java

@@ -6,6 +6,7 @@ import org.dbsyncer.connector.config.Field;
 import org.dbsyncer.connector.config.MetaInfo;
 import org.dbsyncer.connector.config.Table;
 import org.dbsyncer.manager.Manager;
+import org.dbsyncer.parser.model.FieldMapping;
 import org.dbsyncer.parser.model.Mapping;
 import org.dbsyncer.parser.model.TableGroup;
 import org.slf4j.Logger;
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -65,6 +67,11 @@ public class TableGroupServiceImpl implements TableGroupService {
     public TableGroup getTableGroup(String id) {
         TableGroup tableGroup = manager.getTableGroup(id);
         Assert.notNull(tableGroup, "TableGroup can not be null");
+        // TODO 模拟数据
+        FieldMapping m = new FieldMapping();
+        m.setSource(new Field("ID1", "VARCHAR", 12));
+        m.setTarget(new Field("ID2", "VARCHAR", 12));
+        tableGroup.setFieldMapping(Arrays.asList(m));
         return tableGroup;
     }
 

+ 2 - 2
dbsyncer-connector/src/main/java/org/dbsyncer/connector/enums/OperationEnum.java

@@ -12,11 +12,11 @@ public enum OperationEnum {
     /**
      * 并且
      */
-    AND("", "and"),
+    AND("and", "and"),
     /**
      * 或者
      */
-    OR("", "or");
+    OR("or", "or");
 
     // 描述
     private String name;

+ 1 - 1
dbsyncer-web/src/main/java/org/dbsyncer/web/controller/BaseController.java

@@ -46,7 +46,7 @@ public abstract class BaseController {
     protected void initConfig(ModelMap model){
         model.put("condition", filterService.getCondition());
         model.put("convert", convertService.getConvertEnumAll());
-        model.put("plugins", pluginService.getPluginAll());
+        model.put("plugin", pluginService.getPluginAll());
     }
 
 }

+ 7 - 1
dbsyncer-web/src/main/resources/templates/mapping/editMappingTableGroup.html

@@ -125,7 +125,13 @@
                                         <th>操作</th>
                                     </tr>
                                     </thead>
-                                    <tbody id="fieldMappingList" ></tbody>
+                                    <tbody id="fieldMappingList">
+                                        <tr title='双击设为主键' th:each="f,s:${tableGroup?.fieldMapping}">
+                                            <td>[[${f?.source?.name}]]</td>
+                                            <td>[[${f?.target?.name}]]</td>
+                                            <td><a class='fa fa-remove fa-2x fieldMappingDelete dbsyncer_pointer' title='删除' ></a></td>
+                                        </tr>
+                                    </tbody>
                                 </table>
                             </div>
                         </div>