From b82c71a3e3a97a78bd18ff598d27f3062600d22a Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期五, 02 二月 2024 22:47:41 +0800
Subject: [PATCH] 增加车间和工段的维护接口

---
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopService.java            |   47 +-
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/WorkshopAssembler.java           |    2 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantQueryDTO.java                     |   19 +
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/Section.java                              |   12 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopQueryController.java |   47 ++
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopDTO.java                    |   12 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/SectionMapper.java                        |    2 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/Workshop.java                    |    6 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantService.java                  |   26 -
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/section/SectionService.java              |   52 ++
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopEditController.java  |   66 +++
 mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/utils/Lsv2Util.java                           |  269 ++++++-------
 mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/lsv2/Lsv2ClientTest.java              |   59 +++
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/SectionController.java       |   78 ++++
 mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/service/lsv2/Lsv2Client.java                  |    8 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/PlantMapper.java                          |   11 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopFullDTO.java                |   63 +++
 mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/WorkshopMapper.xml                           |   13 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/machine/MachineEditController.java    |    2 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantEditController.java        |   25 -
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantDTO.java                          |   17 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/SectionDTO.java                              |   12 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopQueryDTO.java               |   38 ++
 mdc-parent/mdc-show/pom.xml                                                                        |    6 
 mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/PlantMapper.xml                              |   13 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantQueryController.java       |   67 +++
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/WorkshopMapper.java                       |   15 
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopEditService.java        |   46 ++
 mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantQueryService.java             |   65 +++
 29 files changed, 856 insertions(+), 242 deletions(-)

diff --git a/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/service/lsv2/Lsv2Client.java b/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/service/lsv2/Lsv2Client.java
index 1f3e159..9a6e37b 100644
--- a/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/service/lsv2/Lsv2Client.java
+++ b/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/service/lsv2/Lsv2Client.java
@@ -12,7 +12,9 @@
 
 import com.qianwen.mdc.utils.Lsv2Util;
 import com.qianwen.mdc.utils.MdcException;
-
+/**
+ * Lsv2鍗忚鐨勬暟鎹噰闆嗗鎴风锛岀敤浜嶩eidenhain绯荤粺銆侺SV-2鐢ㄤ簬浠嶇劧浣跨敤16浣嶆�荤嚎鐨勮澶�
+ */
 public class Lsv2Client {
   private Shell shell;
   
@@ -27,6 +29,8 @@
   private boolean connected;
   
   private final Logger logger;
+  
+  private final String activeXClsid = "{F9EE051D-C65D-4480-8E35-76F10FAB15C6}";
   
   public Lsv2Client(String ipAddr) {
     this.connected = false;
@@ -43,7 +47,7 @@
             this.shell = new Shell(display, 1264);
             this.shell.setLayout(null);
             this.oleFrame = new OleFrame((Composite)this.shell, 0);
-            this.oleControlSite = new OleControlSite((Composite)this.oleFrame, 0, "{F9EE051D-C65D-4480-8E35-76F10FAB15C6}");
+            this.oleControlSite = new OleControlSite((Composite)this.oleFrame, 0, activeXClsid);
             this.oleAutomation = new OleAutomation((OleClientSite)this.oleControlSite);
             this.oleControlSite.doVerb(-3);
           }); 
diff --git a/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/utils/Lsv2Util.java b/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/utils/Lsv2Util.java
index 0f44d14..5523280 100644
--- a/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/utils/Lsv2Util.java
+++ b/mdc-parent/mdc-collect/src/main/java/com/qianwen/mdc/utils/Lsv2Util.java
@@ -1,152 +1,121 @@
-/*     */ package com.qianwen.mdc.utils;
-/*     */ 
-/*     */ import org.eclipse.swt.ole.win32.OleAutomation;
-/*     */ import org.eclipse.swt.ole.win32.Variant;
-/*     */ 
-/*     */ 
-/*     */ 
-/*     */ public class Lsv2Util
-/*     */ {
-/*     */   public static final String lsv2Ctrl3ProgId = "{F9EE051D-C65D-4480-8E35-76F10FAB15C6}";
-/*     */   
-/*     */   private static Variant execute(OleAutomation oleAutomation, String methodName) {
-/*  13 */     return execute(oleAutomation, methodName, null);
-/*     */   }
-/*     */   
-/*     */   private static Variant execute(OleAutomation oleAutomation, String methodName, Variant[] args) {
-/*  17 */     int mid = getID(oleAutomation, methodName);
-/*     */     
-/*  19 */     return execute(oleAutomation, mid, args);
-/*     */   }
-/*     */   private static Variant execute(OleAutomation oleAutomation, int mid, Variant[] args) {
-/*     */     Variant rtnv;
-/*  23 */     if (mid < 0) {
-/*  24 */       return null;
-/*     */     }
-/*     */ 
-/*     */     
-/*  28 */     if (args == null) {
-/*  29 */       rtnv = oleAutomation.invoke(mid);
-/*     */     } else {
-/*  31 */       rtnv = oleAutomation.invoke(mid, args);
-/*     */     } 
-/*     */     
-/*  34 */     return rtnv;
-/*     */   }
-/*     */   
-/*     */   private static int getID(OleAutomation oleAutomation, String name) {
-/*     */     try {
-/*  39 */       int[] ids = oleAutomation.getIDsOfNames(new String[] { name });
-/*  40 */       if (ids == null) {
-/*  41 */         return -1;
-/*     */       }
-/*     */       
-/*  44 */       return ids[0];
-/*  45 */     } catch (RuntimeException e) {
-/*  46 */       e.printStackTrace();
-/*     */ 
-/*     */       
-/*  49 */       return -1;
-/*     */     } 
-/*     */   }
-/*     */   public static String getLastError(OleAutomation oleAutomation) {
-/*  53 */     String methodName = "LastError";
-/*     */     
-/*  55 */     return execute(oleAutomation, methodName).getString();
-/*     */   }
-/*     */   
-/*     */   public static String getLastErrorString(OleAutomation oleAutomation) {
-/*  59 */     String methodName = "LastErrorString";
-/*     */     
-/*  61 */     return execute(oleAutomation, methodName).getString();
-/*     */   }
-/*     */   
-/*     */   public static boolean connect(OleAutomation oleAutomation) {
-/*  65 */     String methodName = "Connect";
-/*     */     
-/*  67 */     return execute(oleAutomation, methodName).getBoolean();
-/*     */   }
-/*     */   
-/*     */   public static boolean testConnection(OleAutomation oleAutomation) {
-/*  71 */     String methodName = "TestConnection";
-/*  72 */     Variant[] args = { new Variant(2) };
-/*     */     
-/*  74 */     return execute(oleAutomation, methodName, args).getBoolean();
-/*     */   }
-/*     */   
-/*     */   public static boolean disConnect(OleAutomation oleAutomation) {
-/*  78 */     String methodName = "DisConnect";
-/*     */     
-/*  80 */     return execute(oleAutomation, methodName).getBoolean();
-/*     */   }
-/*     */   
-/*     */   public static boolean reConnect(OleAutomation oleAutomation) {
-/*  84 */     String methodName = "ReConnect";
-/*     */     
-/*  86 */     return execute(oleAutomation, methodName).getBoolean();
-/*     */   }
-/*     */   
-/*     */   public static void setMedium(OleAutomation oleAutomation, int medium) {
-/*  90 */     String methodName = "Medium";
-/*  91 */     Variant[] args = { new Variant(medium) };
-/*     */     
-/*  93 */     execute(oleAutomation, methodName, args);
-/*     */   }
-/*     */   
-/*     */   public static void setIPAddress(OleAutomation oleAutomation, String ipAddress) {
-/*  97 */     String methodName = "IPAddress";
-/*  98 */     Variant[] args = { new Variant(ipAddress) };
-/*     */     
-/* 100 */     execute(oleAutomation, methodName, args);
-/*     */   }
-/*     */   
-/*     */   public static void setPort(OleAutomation oleAutomation) {
-/* 104 */     String methodName = "Port";
-/*     */     
-/* 106 */     execute(oleAutomation, methodName);
-/*     */   }
-/*     */   
-/*     */   public static void setTransferMode(OleAutomation oleAutomation, Integer mode) {
-/* 110 */     String methodName = "TransferMode";
-/* 111 */     Variant[] args = { new Variant(mode.intValue()) };
-/*     */     
-/* 113 */     execute(oleAutomation, methodName, args);
-/*     */   }
-/*     */   
-/*     */   public static void setHostFunction(OleAutomation oleAutomation, Boolean hostFunction) {
-/* 117 */     String methodName = "HostFunction";
-/* 118 */     Variant[] args = { new Variant(hostFunction.booleanValue()) };
-/*     */     
-/* 120 */     execute(oleAutomation, methodName, args);
-/*     */   }
-/*     */   
-/*     */   public static String getVersionTNC(OleAutomation oleAutomation) {
-/* 124 */     String methodName = "VersionTNC";
-/*     */     
-/* 126 */     return execute(oleAutomation, methodName).getString();
-/*     */   }
-/*     */ 
-/*     */ 
-/*     */   
-/*     */   public static String getProgramName(OleAutomation oleAutomation) {
-/* 132 */     String methodName = "ReceiveDNCInfo";
-/* 133 */     short type = 3;
-/* 134 */     int InfoPara = 0;
-/* 135 */     Variant[] args = { new Variant(type), new Variant(InfoPara) };
-/*     */     
-/* 137 */     return execute(oleAutomation, methodName, args).getString();
-/*     */   }
-/*     */   
-/*     */   public static String receiveMemBlock(OleAutomation oleAutomation, short type, short address, short count) {
-/* 141 */     String methodName = "ReceiveMemBlock";
-/* 142 */     Variant[] args = { new Variant(type), new Variant(address), new Variant(count) };
-/*     */     
-/* 144 */     return execute(oleAutomation, methodName, args).getString();
-/*     */   }
-/*     */ }
+package com.qianwen.mdc.utils;
 
 
-/* Location:              D:\yangys\mdm\鑰佷唬鐮乗mdcplugin\mdc-plugin-0.0.1-SNAPSHOT-鍒犻櫎lib.jar!\BOOT-INF\classes\cn\net\hx\md\\utils\Lsv2Util.class
- * Java compiler version: 8 (52.0)
- * JD-Core Version:       1.1.3
- */
\ No newline at end of file
+import org.eclipse.swt.ole.win32.OleAutomation;
+import org.eclipse.swt.ole.win32.Variant;
+
+public class Lsv2Util {
+  public static final String lsv2Ctrl3ProgId = "{F9EE051D-C65D-4480-8E35-76F10FAB15C6}";
+  
+  private static Variant execute(OleAutomation oleAutomation, String methodName) {
+    return execute(oleAutomation, methodName, null);
+  }
+  
+  private static Variant execute(OleAutomation oleAutomation, String methodName, Variant[] args) {
+    int mid = getID(oleAutomation, methodName);
+    return execute(oleAutomation, mid, args);
+  }
+  
+  private static Variant execute(OleAutomation oleAutomation, int mid, Variant[] args) {
+    Variant rtnv;
+    if (mid < 0)
+      return null; 
+    if (args == null) {
+      rtnv = oleAutomation.invoke(mid);
+    } else {
+      rtnv = oleAutomation.invoke(mid, args);
+    } 
+    return rtnv;
+  }
+  
+  private static int getID(OleAutomation oleAutomation, String name) {
+    try {
+      int[] ids = oleAutomation.getIDsOfNames(new String[] { name });
+      if (ids == null)
+        return -1; 
+      return ids[0];
+    } catch (RuntimeException e) {
+      e.printStackTrace();
+      return -1;
+    } 
+  }
+  
+  public static String getLastError(OleAutomation oleAutomation) {
+    String methodName = "LastError";
+    return execute(oleAutomation, methodName).getString();
+  }
+  
+  public static String getLastErrorString(OleAutomation oleAutomation) {
+    String methodName = "LastErrorString";
+    return execute(oleAutomation, methodName).getString();
+  }
+  
+  public static boolean connect(OleAutomation oleAutomation) {
+    String methodName = "Connect";
+    return execute(oleAutomation, methodName).getBoolean();
+  }
+  
+  public static boolean testConnection(OleAutomation oleAutomation) {
+    String methodName = "TestConnection";
+    Variant[] args = { new Variant(2) };
+    return execute(oleAutomation, methodName, args).getBoolean();
+  }
+  
+  public static boolean disConnect(OleAutomation oleAutomation) {
+    String methodName = "DisConnect";
+    return execute(oleAutomation, methodName).getBoolean();
+  }
+  
+  public static boolean reConnect(OleAutomation oleAutomation) {
+    String methodName = "ReConnect";
+    return execute(oleAutomation, methodName).getBoolean();
+  }
+  
+  public static void setMedium(OleAutomation oleAutomation, int medium) {
+    String methodName = "Medium";
+    Variant[] args = { new Variant(medium) };
+    execute(oleAutomation, methodName, args);
+  }
+  
+  public static void setIPAddress(OleAutomation oleAutomation, String ipAddress) {
+    String methodName = "IPAddress";
+    Variant[] args = { new Variant(ipAddress) };
+    execute(oleAutomation, methodName, args);
+  }
+  
+  public static void setPort(OleAutomation oleAutomation) {
+    String methodName = "Port";
+    execute(oleAutomation, methodName);
+  }
+  
+  public static void setTransferMode(OleAutomation oleAutomation, Integer mode) {
+    String methodName = "TransferMode";
+    Variant[] args = { new Variant(mode.intValue()) };
+    execute(oleAutomation, methodName, args);
+  }
+  
+  public static void setHostFunction(OleAutomation oleAutomation, Boolean hostFunction) {
+    String methodName = "HostFunction";
+    Variant[] args = { new Variant(hostFunction.booleanValue()) };
+    execute(oleAutomation, methodName, args);
+  }
+  
+  public static String getVersionTNC(OleAutomation oleAutomation) {
+    String methodName = "VersionTNC";
+    return execute(oleAutomation, methodName).getString();
+  }
+  
+  public static String getProgramName(OleAutomation oleAutomation) {
+    String methodName = "ReceiveDNCInfo";
+    short type = 3;
+    int InfoPara = 0;
+    Variant[] args = { new Variant(type), new Variant(InfoPara) };
+    return execute(oleAutomation, methodName, args).getString();
+  }
+  
+  public static String receiveMemBlock(OleAutomation oleAutomation, short type, short address, short count) {
+    String methodName = "ReceiveMemBlock";
+    Variant[] args = { new Variant(type), new Variant(address), new Variant(count) };
+    return execute(oleAutomation, methodName, args).getString();
+  }
+}
diff --git a/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/lsv2/Lsv2ClientTest.java b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/lsv2/Lsv2ClientTest.java
new file mode 100644
index 0000000..b5d4f36
--- /dev/null
+++ b/mdc-parent/mdc-collect/src/test/java/com/qianwen/mdc/service/lsv2/Lsv2ClientTest.java
@@ -0,0 +1,59 @@
+package com.qianwen.mdc.service.lsv2;
+
+import org.eclipse.swt.ole.win32.OleAutomation;
+import org.eclipse.swt.ole.win32.OleClientSite;
+import org.eclipse.swt.ole.win32.OleControlSite;
+import org.eclipse.swt.ole.win32.OleFrame;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.jupiter.api.Test;
+
+import com.qianwen.mdc.utils.Lsv2Util;
+
+public class Lsv2ClientTest {
+	private Shell shell;
+
+	private OleFrame oleFrame;
+
+	private OleControlSite oleControlSite;
+
+	private OleAutomation oleAutomation;
+
+	@Test
+	public void create() {
+
+		Display display = Display.getDefault();
+
+		if (!display.isDisposed())
+			display.syncExec(() -> {
+				this.shell = new Shell(display, 1264);
+				this.shell.setLayout(null);
+				this.oleFrame = new OleFrame((Composite) this.shell, 0);
+				this.oleControlSite = new OleControlSite((Composite) this.oleFrame, 0,
+						"{F9EE051D-C65D-4480-8E35-76F10FAB15C6}");
+				this.oleAutomation = new OleAutomation((OleClientSite) this.oleControlSite);
+				this.oleControlSite.doVerb(-3);
+			});
+
+		Lsv2Util.setMedium(this.oleAutomation, 1);
+	    Lsv2Util.setIPAddress(this.oleAutomation, "192.168.1.12");
+	    Lsv2Util.setHostFunction(this.oleAutomation, Boolean.valueOf(false));
+	    boolean connected = Lsv2Util.connect(this.oleAutomation);
+	    System.out.println(connected);
+		boolean b = Lsv2Util.testConnection(oleAutomation);
+		System.out.println(b);
+		
+		
+		//readNCState
+		 short type = 0;
+		  short address = 4176;
+		    short count = 1;
+		String state = Lsv2Util.receiveMemBlock(this.oleAutomation, type, address, count);
+		System.out.println(state);
+		
+		//readVersionTNC
+		String versionTNC =Lsv2Util.getVersionTNC(this.oleAutomation);
+		System.out.println(versionTNC);
+	}
+}
diff --git a/mdc-parent/mdc-show/pom.xml b/mdc-parent/mdc-show/pom.xml
index e08605a..d8ecd43 100644
--- a/mdc-parent/mdc-show/pom.xml
+++ b/mdc-parent/mdc-show/pom.xml
@@ -44,6 +44,12 @@
 		<dependency>
 			<groupId>com.baomidou</groupId>
 			<artifactId>mybatis-plus-boot-starter</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>com.zaxxer</groupId>
+					<artifactId>HikariCP</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/machine/MachineEditController.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/machine/MachineEditController.java
index 2113110..c4e970f 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/machine/MachineEditController.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/machine/MachineEditController.java
@@ -19,8 +19,8 @@
 import com.qianwen.mdc.common.OpResult;
 import com.qianwen.mdc.dto.IdsDTO;
 import com.qianwen.mdc.dto.MachineProtocolDTO;
-import com.qianwen.mdc.dto.WorkshopDTO;
 import com.qianwen.mdc.dto.machine.MachineDTO;
+import com.qianwen.mdc.dto.workshop.WorkshopDTO;
 import com.qianwen.mdc.service.machine.MachineEditService;
 import com.qianwen.mdc.service.workshop.WorkshopService;
 
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/PlantEditController.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantEditController.java
similarity index 82%
rename from mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/PlantEditController.java
rename to mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantEditController.java
index ea1c582..8613747 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/PlantEditController.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantEditController.java
@@ -1,6 +1,4 @@
-package com.qianwen.mdc.controller;
-
-import java.util.List;
+package com.qianwen.mdc.controller.plant;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -9,7 +7,6 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
@@ -17,10 +14,9 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.alibaba.fastjson.JSONObject;
 import com.qianwen.mdc.common.OpResult;
 import com.qianwen.mdc.dto.IdsDTO;
-import com.qianwen.mdc.dto.PlantDTO;
+import com.qianwen.mdc.dto.plant.PlantDTO;
 import com.qianwen.mdc.service.plant.PlantService;
 import com.qianwen.mdc.vallidate.AddGroup;
 import com.qianwen.mdc.vallidate.UpdateGroup;
@@ -93,20 +89,5 @@
         }
     }
     
-    /**
-     * 鍏ㄩ儴杞﹂棿鍒楄〃
-     * @param request
-     * @return
-     */
-    @GetMapping(value = "/list")
-    public OpResult<List<PlantDTO>> list() {
-        
-        try {
-        	return OpResult.success(plantService.list());
-        }catch(Exception ex) {
-        	logger.error("鏌ヨ鍘傛埧鍒楄〃澶辫触",ex);
-        	return OpResult.fail(ex.getMessage());
-        }
-
-    }
+    
 }
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantQueryController.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantQueryController.java
new file mode 100644
index 0000000..2dd6663
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/plant/PlantQueryController.java
@@ -0,0 +1,67 @@
+package com.qianwen.mdc.controller.plant;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qianwen.mdc.common.OpResult;
+import com.qianwen.mdc.dto.plant.PlantDTO;
+import com.qianwen.mdc.dto.plant.PlantQueryDTO;
+import com.qianwen.mdc.service.plant.PlantQueryService;
+import com.qianwen.mdc.service.sysaccount.AccountTokenService;
+
+
+/**
+ * 璁惧鏌ヨ鎺у埗鍣�
+ */
+@RestController
+@CrossOrigin
+@RequestMapping(value = "/plant")
+public class PlantQueryController {
+	@Autowired
+    private AccountTokenService accountTokenService;
+   
+    @Autowired
+    private PlantQueryService queryService;
+
+    public static final Logger logger = LoggerFactory.getLogger(PlantQueryController.class);
+    
+    /**
+     * 鍏ㄩ儴杞﹂棿鍒楄〃
+     * @param request
+     * @return
+     */
+    //@GetMapping(value = "/list")
+    @Deprecated
+    public OpResult<List<PlantDTO>> list() {
+        
+        try {
+        	return OpResult.success(queryService.list());
+        }catch(Exception ex) {
+        	logger.error("鏌ヨ鍘傛埧鍒楄〃澶辫触",ex);
+        	return OpResult.fail(ex.getMessage());
+        }
+
+    }
+    
+
+    @PostMapping(value = "/pageQuery")
+    public OpResult<Page<PlantDTO>> pageQuery(@RequestBody PlantQueryDTO dto) {
+    	try {
+    		return OpResult.success(queryService.pageQuery(dto));
+    	}catch(Exception e) {
+    		logger.error("鏈哄簥鍒嗛〉鏌ヨ寮傚父",e);
+    		return OpResult.fail(e.getMessage());
+    	}
+    }
+    
+    
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/SectionController.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/SectionController.java
new file mode 100644
index 0000000..a9c47b3
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/SectionController.java
@@ -0,0 +1,78 @@
+package com.qianwen.mdc.controller.workshop;
+
+import java.util.List;
+
+import javax.validation.groups.Default;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.qianwen.mdc.common.OpResult;
+import com.qianwen.mdc.dto.SectionDTO;
+import com.qianwen.mdc.service.section.SectionService;
+
+/**
+ * @author y_ys79
+ * 宸ユ鏁版嵁缁存姢鎺у埗鍣�
+ */
+@RestController
+@CrossOrigin
+@RequestMapping(value = "/section")
+public class SectionController {
+	@Autowired
+    private SectionService sectionService;
+	
+    public static final Logger logger = LoggerFactory.getLogger(SectionController.class);
+    
+    @PostMapping(value = "/create")
+    public OpResult<Void> create(@RequestHeader(value = "mdc-token", defaultValue = "") String token,
+    		@Validated(value = {Default.class}) @RequestBody SectionDTO sectionDTO) {
+    	
+        try {
+        	sectionService.save(sectionDTO);
+        }catch(Exception ex) {
+        	logger.error("鏂板杞﹂棿澶辫触",ex);
+        	return OpResult.fail(ex.getMessage());
+        }
+
+        return OpResult.success();
+    }
+    
+    @PostMapping(value = "/modify")
+    public OpResult<Void> modify(@RequestHeader(value = "mdc-token", defaultValue = "") String token,
+    		@Validated(value = {Default.class}) @RequestBody SectionDTO sectionDTO) {
+    	
+        try {
+        	sectionService.modify(sectionDTO);
+        }catch(Exception ex) {
+        	logger.error("鏂板杞﹂棿澶辫触",ex);
+        	return OpResult.fail(ex.getMessage());
+        }
+
+        return OpResult.success();
+    }
+    
+    
+    @GetMapping(value = "/listByWorkshop")
+    public OpResult<List<SectionDTO>> listByWorkshop(@RequestHeader(value = "mdc-token", defaultValue = "") String token,
+    		 Long workshopId) {
+    	
+        try {
+        	OpResult.success(sectionService.listByWorkshopId(workshopId));
+        }catch(Exception ex) {
+        	logger.error("鏌ヨ杞﹂棿涓嬪睘宸ユ澶辫触",ex);
+        	return OpResult.fail(ex.getMessage());
+        }
+
+        return OpResult.success();
+    }
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopEditController.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopEditController.java
new file mode 100644
index 0000000..8fb46f5
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopEditController.java
@@ -0,0 +1,66 @@
+package com.qianwen.mdc.controller.workshop;
+
+import javax.validation.groups.Default;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.qianwen.mdc.common.OpResult;
+import com.qianwen.mdc.dto.workshop.WorkshopDTO;
+import com.qianwen.mdc.service.workshop.WorkshopEditService;
+import com.qianwen.mdc.service.workshop.WorkshopService;
+
+/**
+ * @author y_ys79
+ * 杞﹂棿淇敼鎺у埗鍣�
+ */
+@RestController
+@CrossOrigin
+@RequestMapping(value = "/workshop")
+public class WorkshopEditController {
+	@Autowired
+    private WorkshopEditService editService;
+	@Autowired
+    private WorkshopService workshopService;
+	
+    public static final Logger logger = LoggerFactory.getLogger(WorkshopEditController.class);
+    
+    @PostMapping(value = "/create")
+    public OpResult<Void> create(@RequestHeader(value = "mdc-token", defaultValue = "") String token,
+    		@Validated(value = {Default.class}) @RequestBody WorkshopDTO workshopDTO) {
+    	
+        try {
+        	editService.save(workshopDTO);
+        }catch(Exception ex) {
+        	logger.error("鏂板杞﹂棿澶辫触",ex);
+        	return OpResult.fail(ex.getMessage());
+        }
+
+        return OpResult.success();
+    }
+    
+    @PostMapping(value = "/modify")
+    public OpResult<Void> modify(@RequestHeader(value = "mdc-token", defaultValue = "") String token,
+    		@Validated(value = {Default.class}) @RequestBody WorkshopDTO workshopDTO) {
+    	
+        try {
+        	editService.modify(workshopDTO);
+        }catch(Exception ex) {
+        	logger.error("鏂板杞﹂棿澶辫触",ex);
+        	return OpResult.fail(ex.getMessage());
+        }
+
+        return OpResult.success();
+    }
+    
+    
+    
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopQueryController.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopQueryController.java
new file mode 100644
index 0000000..c0364ca
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/controller/workshop/WorkshopQueryController.java
@@ -0,0 +1,47 @@
+package com.qianwen.mdc.controller.workshop;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qianwen.mdc.common.OpResult;
+import com.qianwen.mdc.dto.workshop.WorkshopFullDTO;
+import com.qianwen.mdc.dto.workshop.WorkshopQueryDTO;
+import com.qianwen.mdc.service.sysaccount.AccountTokenService;
+import com.qianwen.mdc.service.workshop.WorkshopService;
+
+
+/**
+ * 杞﹂棿鏌ヨ鎺у埗鍣�
+ */
+@RestController
+@CrossOrigin
+@RequestMapping(value = "/workshop")
+public class WorkshopQueryController {
+	@Autowired
+    private AccountTokenService accountTokenService;
+	@Autowired
+    private WorkshopService workshopService;
+
+    public static final Logger logger = LoggerFactory.getLogger(WorkshopQueryController.class);
+    
+	
+
+    @PostMapping(value = "/pageQuery")
+    public OpResult<Page<WorkshopFullDTO>> pageQuery(@RequestBody WorkshopQueryDTO dto) {
+    	try {
+    		return OpResult.success(workshopService.pageQuery(dto));
+    	}catch(Exception e) {
+    		logger.error("杞﹂棿鍒嗛〉鏌ヨ寮傚父",e);
+    		return OpResult.fail(e.getMessage());
+    	}
+    }
+    
+    
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/Section.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/Section.java
index 040d245..b89f8fe 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/Section.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/Section.java
@@ -14,7 +14,7 @@
      * primary key
      */
 	@TableId(type=IdType.ASSIGN_ID)
-    private Integer id;
+    private Long id;
 
     /**
      * section name
@@ -25,7 +25,7 @@
      * workshop id
      */
     //@Column(name = "workshop_id")
-    private Integer workshopId;
+    private Long workshopId;
 
     private static final long serialVersionUID = 1L;
 
@@ -34,7 +34,7 @@
      *
      * @return id - primary key
      */
-    public Integer getId() {
+    public Long getId() {
         return id;
     }
 
@@ -43,7 +43,7 @@
      *
      * @param id primary key
      */
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 
@@ -70,7 +70,7 @@
      *
      * @return workshop_id - workshop id
      */
-    public Integer getWorkshopId() {
+    public Long getWorkshopId() {
         return workshopId;
     }
 
@@ -79,7 +79,7 @@
      *
      * @param workshopId workshop id
      */
-    public void setWorkshopId(Integer workshopId) {
+    public void setWorkshopId(Long workshopId) {
         this.workshopId = workshopId;
     }
 
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/Workshop.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/Workshop.java
index c05a368..0ef334c 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/Workshop.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/Workshop.java
@@ -13,7 +13,7 @@
      * primary key
      */
 	@TableId(type=IdType.ASSIGN_ID)
-    private Integer id;
+    private Long id;
 
     /**
      * workshop name
@@ -27,7 +27,7 @@
      *
      * @return id - primary key
      */
-    public Integer getId() {
+    public Long getId() {
         return id;
     }
 
@@ -36,7 +36,7 @@
      *
      * @param id primary key
      */
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/WorkshopAssembler.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/WorkshopAssembler.java
index 36d442e..123de3c 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/WorkshopAssembler.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/workshop/WorkshopAssembler.java
@@ -6,7 +6,7 @@
 
 import com.qianwen.mdc.domain.Section;
 import com.qianwen.mdc.dto.SectionDTO;
-import com.qianwen.mdc.dto.WorkshopDTO;
+import com.qianwen.mdc.dto.workshop.WorkshopDTO;
 
 /**
  * 璐熻矗绫荤殑缁勮杞崲宸ヤ綔
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/SectionDTO.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/SectionDTO.java
index 7fcdc20..58fd9c8 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/SectionDTO.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/SectionDTO.java
@@ -11,18 +11,18 @@
 	 */
 	private static final long serialVersionUID = -2006517821720524176L;
 
-	private Integer id;
+	private Long id;
 
     private String name;
 
-    private Integer workshopId;
+    private Long workshopId;
 
-    public Integer getId() {
+    public Long getId() {
         return id;
     }
 
 
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 
@@ -36,12 +36,12 @@
     }
 
 
-	public Integer getWorkshopId() {
+	public Long getWorkshopId() {
 		return workshopId;
 	}
 
 
-	public void setWorkshopId(Integer workshopId) {
+	public void setWorkshopId(Long workshopId) {
 		this.workshopId = workshopId;
 	}
 
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/PlantDTO.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantDTO.java
similarity index 81%
rename from mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/PlantDTO.java
rename to mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantDTO.java
index 8010275..ac1a3d5 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/PlantDTO.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantDTO.java
@@ -1,4 +1,4 @@
-package com.qianwen.mdc.dto;
+package com.qianwen.mdc.dto.plant;
 
 import java.io.Serializable;
 
@@ -24,6 +24,11 @@
 	@NotBlank(message = "鍘傛埧璁剧疆涓嶈兘涓虹┖", groups = {AddGroup.class, UpdateGroup.class})
     private String gridSetting;
 
+	/**
+	 * 璁惧鏁伴噺
+	 */
+	private Integer machineCount;
+	
     public Long getId() {
         return id;
     }
@@ -53,5 +58,15 @@
 	}
 
 
+	public Integer getMachineCount() {
+		return machineCount;
+	}
+
+
+	public void setMachineCount(Integer machineCount) {
+		this.machineCount = machineCount;
+	}
+
+
 
 }
\ No newline at end of file
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantQueryDTO.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantQueryDTO.java
new file mode 100644
index 0000000..84a0e52
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/plant/PlantQueryDTO.java
@@ -0,0 +1,19 @@
+package com.qianwen.mdc.dto.plant;
+
+import com.qianwen.mdc.dto.BasePageDTO;
+/**
+ * 鍘傛埧鏌ヨ鏁版嵁浼犺緭瀵硅薄
+ */
+public class PlantQueryDTO  extends BasePageDTO{
+
+    private String name;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+    
+}
\ No newline at end of file
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/WorkshopDTO.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopDTO.java
similarity index 79%
rename from mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/WorkshopDTO.java
rename to mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopDTO.java
index 278e1c5..3f524ff 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/WorkshopDTO.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopDTO.java
@@ -1,7 +1,9 @@
-package com.qianwen.mdc.dto;
+package com.qianwen.mdc.dto.workshop;
 
 import java.io.Serializable;
 import java.util.List;
+
+import com.qianwen.mdc.dto.SectionDTO;
 /**
  * 杞﹂棿鏁版嵁浼犺緭瀵硅薄
  */
@@ -12,18 +14,18 @@
 	 */
 	private static final long serialVersionUID = -2006517821720524176L;
 
-	private Integer id;
+	private Long id;
 
     private String name;
 
     private List<SectionDTO> sections;
-
-    public Integer getId() {
+    
+    public Long getId() {
         return id;
     }
 
 
-    public void setId(Integer id) {
+    public void setId(Long id) {
         this.id = id;
     }
 
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopFullDTO.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopFullDTO.java
new file mode 100644
index 0000000..d2ed59b
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopFullDTO.java
@@ -0,0 +1,63 @@
+package com.qianwen.mdc.dto.workshop;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.qianwen.mdc.dto.SectionDTO;
+/**
+ * 杞﹂棿鏁版嵁浼犺緭瀵硅薄
+ */
+public class WorkshopFullDTO implements Serializable {
+
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -2006517821720524176L;
+
+	private Long id;
+
+    private String name;
+
+    private List<SectionDTO> sections;
+
+    private String sectionNames;
+    
+    public Long getId() {
+        return id;
+    }
+
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+ 
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+	public List<SectionDTO> getSections() {
+		return sections;
+	}
+
+
+	public void setSections(List<SectionDTO> sections) {
+		this.sections = sections;
+	}
+
+
+	public String getSectionNames() {
+		return sectionNames;
+	}
+
+
+	public void setSectionNames(String sectionNames) {
+		this.sectionNames = sectionNames;
+	}
+
+}
\ No newline at end of file
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopQueryDTO.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopQueryDTO.java
new file mode 100644
index 0000000..99c27a3
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/dto/workshop/WorkshopQueryDTO.java
@@ -0,0 +1,38 @@
+package com.qianwen.mdc.dto.workshop;
+
+import com.qianwen.mdc.dto.BasePageDTO;
+
+/**
+ * 璁惧绫诲瀷"鏁版嵁
+ */
+
+public class WorkshopQueryDTO extends BasePageDTO{
+
+    /*
+     * 绫诲瀷鍚嶇О
+     */
+    private String name;
+    
+    /*
+     * 鍒犻櫎鏍囪 0:鏈垹闄わ紱1:宸插垹闄�
+     */
+    private int deleteFlag;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public int getDeleteFlag() {
+		return deleteFlag;
+	}
+
+	public void setDeleteFlag(int deleteFlag) {
+		this.deleteFlag = deleteFlag;
+	}
+
+    
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/PlantMapper.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/PlantMapper.java
index e083f19..9fc27cd 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/PlantMapper.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/PlantMapper.java
@@ -1,8 +1,19 @@
 package com.qianwen.mdc.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qianwen.mdc.domain.plant.Plant;
+import com.qianwen.mdc.dto.plant.PlantDTO;
+import com.qianwen.mdc.dto.plant.PlantQueryDTO;
 
 public interface PlantMapper extends BaseMapper<Plant> {
+
+	/**
+	 * 鍒嗛〉鏌ヨ
+	 * @param rowPage
+	 * @param dto
+	 * @return
+	 */
+	Page<PlantDTO> queryPage(Page<PlantDTO> rowPage, PlantQueryDTO dto);
 	
 }
\ No newline at end of file
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/SectionMapper.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/SectionMapper.java
index b2fa994..965ddf0 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/SectionMapper.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/SectionMapper.java
@@ -11,5 +11,5 @@
 	 * @param workshopId 杞﹂棿id
 	 * @return
 	 */
-	List<Section> queryByWorkshopId(Integer workshopId);
+	List<Section> queryByWorkshopId(Long workshopId);
 }
\ No newline at end of file
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/WorkshopMapper.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/WorkshopMapper.java
index 70094d1..0c865fc 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/WorkshopMapper.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/mapper/WorkshopMapper.java
@@ -1,7 +1,20 @@
 package com.qianwen.mdc.mapper;
 
-import com.qianwen.mdc.domain.workshop.Workshop;
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qianwen.mdc.domain.workshop.Workshop;
+import com.qianwen.mdc.dto.workshop.WorkshopFullDTO;
+import com.qianwen.mdc.dto.workshop.WorkshopQueryDTO;
 
 public interface WorkshopMapper extends BaseMapper<Workshop> {
+
+	/**
+	 * 鍒嗛〉鏌ヨ杞﹂棿
+	 * @param rowPage
+	 * @param dto
+	 * @return
+	 */
+	Page<WorkshopFullDTO> queryPage(Page<WorkshopFullDTO> rowPage,@Param("dto")WorkshopQueryDTO dto);
 }
\ No newline at end of file
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantQueryService.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantQueryService.java
new file mode 100644
index 0000000..aff6fd1
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantQueryService.java
@@ -0,0 +1,65 @@
+package com.qianwen.mdc.service.plant;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qianwen.mdc.domain.plant.Plant;
+import com.qianwen.mdc.dto.plant.PlantDTO;
+import com.qianwen.mdc.dto.plant.PlantQueryDTO;
+import com.qianwen.mdc.mapper.PlantMapper;
+
+/**
+ * @author y_ys79
+ * 鍘傛埧鍦板浘鏌ヨ鏈嶅姟
+ */
+@Service
+public class PlantQueryService {
+	@Autowired
+    private PlantMapper plantMapper;
+	@Autowired
+	private PlantService plantService;
+	/**
+	 * 鎵�鏈夊巶鎴垮垪琛�
+	 * @return
+	 */
+	@Transactional(readOnly=true)
+	public List<PlantDTO> list() {
+
+		List<Plant> plist = plantMapper.selectList(null);
+		
+		return plist.stream().map(p -> {
+			PlantDTO dto = new PlantDTO();
+			dto.setId(p.getId());
+			dto.setName(p.getName());
+			dto.setGridSetting(p.getGridSetting());
+			return dto;
+			}).collect(Collectors.toList());
+       
+	}
+	
+	/**
+	 * 鍘傛埧鍒嗛〉鏌ヨ
+	 * @param dto
+	 * @return
+	 */
+	@Transactional(readOnly=true)
+	public Page<PlantDTO> pageQuery(PlantQueryDTO dto) {
+		
+		Page<PlantDTO> rowPage = new Page<>(dto.finalPageNo(),dto.finalPageSize());
+        rowPage = plantMapper.queryPage(rowPage, dto);
+        
+        List<PlantDTO> list = rowPage.getRecords();
+        //瑙f瀽鏈哄簥涓暟
+        for(PlantDTO p: list) {
+        	p.setMachineCount(plantService.parseMachineIdInGrid(p.getGridSetting()).size());
+        }
+        return rowPage;
+	}
+	
+	
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantService.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantService.java
index 593eb5f..2480006 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantService.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/plant/PlantService.java
@@ -1,12 +1,9 @@
 package com.qianwen.mdc.service.plant;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.stream.Collectors;
 
-import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +14,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.qianwen.mdc.domain.Machine;
 import com.qianwen.mdc.domain.plant.Plant;
-import com.qianwen.mdc.dto.PlantDTO;
+import com.qianwen.mdc.dto.plant.PlantDTO;
 import com.qianwen.mdc.mapper.MachineMapper;
 import com.qianwen.mdc.mapper.PlantMapper;
 
@@ -61,7 +58,7 @@
 		
 	}
 	
-	List<Integer> parseMachineIdInGrid(String gridSetting){
+	public List<Integer> parseMachineIdInGrid(String gridSetting){
 		List<Integer> macineIds = new ArrayList<>();
 		try {
 			
@@ -124,24 +121,7 @@
 		plantMapper.updateById(p);
 	}
 	
-	/**
-	 * 鎵�鏈夊巶鎴垮垪琛�
-	 * @return
-	 */
-	@Transactional(readOnly=true)
-	public List<PlantDTO> list() {
-
-		List<Plant> plist = plantMapper.selectList(null);
-		
-		return plist.stream().map(p -> {
-			PlantDTO dto = new PlantDTO();
-			dto.setId(p.getId());
-			dto.setName(p.getName());
-			dto.setGridSetting(p.getGridSetting());
-			return dto;
-			}).collect(Collectors.toList());
-       
-	}
+	
 	
 	/**
 	 * 鍒犻櫎鍘傛埧
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/section/SectionService.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/section/SectionService.java
new file mode 100644
index 0000000..c75250b
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/section/SectionService.java
@@ -0,0 +1,52 @@
+package com.qianwen.mdc.service.section;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.qianwen.mdc.domain.Section;
+import com.qianwen.mdc.dto.SectionDTO;
+import com.qianwen.mdc.mapper.SectionMapper;
+
+/**
+ * @author y_ys79
+ * 宸ユ鏈嶅姟锛屾彁渚涘鍒犳敼鏌ュ叏閮ㄦ搷浣滐紙閫昏緫姣旇緝绠�鍗曪級
+ */
+@Service
+public class SectionService {
+	@Autowired
+    private SectionMapper sectionMapper;
+	
+	@Transactional
+	public void save(SectionDTO sectionDTO) {
+		Section sec = new Section();
+		sec.setName(sectionDTO.getName());
+		sec.setWorkshopId(sectionDTO.getWorkshopId());
+		sectionMapper.insert(sec);
+	}
+	
+	@Transactional
+	public void modify(SectionDTO sectionDTO) {
+
+		Section sec = sectionMapper.selectById(sectionDTO.getId());
+		sec.setName(sectionDTO.getName());
+       
+		sectionMapper.updateById(sec);
+	}
+	
+	@Transactional(readOnly=true)
+	public List<SectionDTO> listByWorkshopId(Long workshopId) {
+
+		List<Section> list = sectionMapper.queryByWorkshopId(workshopId);
+       
+		return list.stream().map(s -> {
+			SectionDTO dto = new SectionDTO();
+			BeanUtils.copyProperties(s, dto);
+			return dto;
+		}).collect(Collectors.toList());
+	}
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopEditService.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopEditService.java
new file mode 100644
index 0000000..022d551
--- /dev/null
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopEditService.java
@@ -0,0 +1,46 @@
+package com.qianwen.mdc.service.workshop;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qianwen.mdc.domain.Section;
+import com.qianwen.mdc.domain.workshop.Workshop;
+import com.qianwen.mdc.domain.workshop.WorkshopAssembler;
+import com.qianwen.mdc.dto.workshop.WorkshopDTO;
+import com.qianwen.mdc.mapper.SectionMapper;
+import com.qianwen.mdc.mapper.WorkshopMapper;
+
+/**
+ * @author y_ys79
+ * 杞﹂棿鏈嶅姟锛屾彁渚涘鍒犳敼鏌ュ叏閮ㄦ搷浣滐紙閫昏緫姣旇緝绠�鍗曪級
+ */
+@Service
+public class WorkshopEditService {
+	@Autowired
+    private WorkshopMapper workshopMapper;
+	@Autowired
+    private SectionMapper sectionMapper;
+	
+	@Transactional
+	public void save(WorkshopDTO workshopDTO) {
+		Workshop ws = new Workshop();
+		ws.setName(workshopDTO.getName());
+       
+		workshopMapper.insert(ws);
+	}
+	
+	@Transactional
+	public void modify(WorkshopDTO workshopDTO) {
+
+		Workshop ws = workshopMapper.selectById(workshopDTO.getId());
+		ws.setName(workshopDTO.getName());
+       
+		workshopMapper.updateById(ws);
+	}
+	
+
+}
diff --git a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopService.java b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopService.java
index 99df22f..dcdf10c 100644
--- a/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopService.java
+++ b/mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/workshop/WorkshopService.java
@@ -1,19 +1,22 @@
 package com.qianwen.mdc.service.workshop;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import org.apache.tomcat.util.buf.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.qianwen.mdc.domain.Machine;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qianwen.mdc.domain.Section;
 import com.qianwen.mdc.domain.workshop.Workshop;
 import com.qianwen.mdc.domain.workshop.WorkshopAssembler;
-import com.qianwen.mdc.dto.WorkshopDTO;
-import com.qianwen.mdc.dto.machine.MachineDTO;
-import com.qianwen.mdc.mapper.MachineMapper;
+import com.qianwen.mdc.dto.workshop.WorkshopDTO;
+import com.qianwen.mdc.dto.workshop.WorkshopFullDTO;
+import com.qianwen.mdc.dto.workshop.WorkshopQueryDTO;
 import com.qianwen.mdc.mapper.SectionMapper;
 import com.qianwen.mdc.mapper.WorkshopMapper;
 
@@ -27,29 +30,15 @@
     private WorkshopMapper workshopMapper;
 	@Autowired
     private SectionMapper sectionMapper;
-	@Transactional
-	public void save(WorkshopDTO workshopDTO) {
-		Workshop ws = new Workshop();
-		ws.setName(workshopDTO.getName());
-       
-		workshopMapper.insert(ws);
-	}
-	@Transactional
-	public void modify(WorkshopDTO workshopDTO) {
-
-		Workshop ws = workshopMapper.selectById(workshopDTO.getId());
-		ws.setName(workshopDTO.getName());
-       
-		workshopMapper.updateById(ws);
-	}
 	
 
 	/**
 	 * 鑾峰彇杞﹂棿鍒楄〃锛岄檮甯﹁溅闂翠笅鐨勫伐娈垫暟鎹�
 	 * @return
 	 */
+	@Transactional(readOnly=true)
 	public List<WorkshopDTO> listWithSections() {
-		List<Workshop> list = workshopMapper.selectList(null);
+		List<Workshop> list = workshopMapper.selectList(Wrappers.emptyWrapper());
 		return list.stream().map(ws -> {
 			List<Section> sectionList = sectionMapper.queryByWorkshopId(ws.getId());
 			WorkshopDTO wsDTO = WorkshopAssembler.toDTO(ws,sectionList);
@@ -57,4 +46,22 @@
 			return wsDTO;
 			}).collect(Collectors.toList());
 	}
+
+	@Transactional(readOnly=true)
+	public Page<WorkshopFullDTO> pageQuery(WorkshopQueryDTO dto) {
+		Page<WorkshopFullDTO> rowPage = new Page<>(dto.finalPageNo(),dto.finalPageSize());
+        rowPage = workshopMapper.queryPage(rowPage, dto);
+        
+        rowPage.getRecords().forEach((ws) -> {
+        	List<Section> sectionList = sectionMapper.queryByWorkshopId(ws.getId());
+        	List<String> nameList = new ArrayList<>();
+        	for(Section s : sectionList) {
+        		nameList.add(s.getName());
+        	}
+        	
+        	ws.setSectionNames(StringUtils.join(nameList,','));
+        });
+	
+        return rowPage;
+	}
 }
diff --git a/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/PlantMapper.xml b/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/PlantMapper.xml
index d603d12..ce5dd22 100644
--- a/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/PlantMapper.xml
+++ b/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/PlantMapper.xml
@@ -7,4 +7,17 @@
     <result column="name" jdbcType="VARCHAR" property="name" />
     <result column="grid_setting" jdbcType="VARCHAR" property="gridSetting" />
   </resultMap>
+  
+  <select id="queryPage" resultType="com.qianwen.mdc.dto.plant.PlantDTO">
+  		select id,name,grid_setting gridSetting from plant
+        <where>
+	        
+	         <if test="dto.name != null and dto.name != ''">
+	        	<bind name="name" value="'%' + dto.name + '%'" />
+	            and name like #{name}
+	         </if>
+	         
+        </where>
+        order by id
+  </select>
 </mapper>
\ No newline at end of file
diff --git a/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/WorkshopMapper.xml b/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/WorkshopMapper.xml
index ab371b4..269baa7 100644
--- a/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/WorkshopMapper.xml
+++ b/mdc-parent/mdc-showdb-mysql/src/main/resources/mapper/WorkshopMapper.xml
@@ -8,4 +8,17 @@
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="name" jdbcType="VARCHAR" property="name" />
   </resultMap>
+   
+  <select id="queryPage" resultType="com.qianwen.mdc.dto.workshop.WorkshopFullDTO">
+  		select id,name from workshop
+        <where>
+	        
+	         <if test="dto.name != null and dto.name != ''">
+	        	<bind name="name" value="'%' + dto.name + '%'" />
+	            and name like #{name}
+	         </if>
+	         
+        </where>
+        order by id
+  </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3