diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java index 0b7470ab..3c9213d8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.nanjing; +import java.util.ArrayList; import java.util.List; import com.ruoyi.common.core.text.Convert; @@ -78,9 +79,20 @@ public class TBdProductinfoController extends BaseController public String add(ModelMap map) { List list = tBdProductinfoService.selectTBdProductinfo(); - int max = Convert.toInt(list.get(0).getProductID()); - list.get(0).setProductID(max+1L); - map.addAttribute("pt",list); + int max; + if(list.size()==0){ + max=0; + List list1 = new ArrayList<>(); + TBdProductinfo tBdProductinfo = new TBdProductinfo(); + tBdProductinfo.setProductID(max+1L); + list1.add(tBdProductinfo); + map.addAttribute("pt",list1); + } + else{ + max = Convert.toInt(list.get(0).getProductID()); + list.get(0).setProductID(max+1L); + map.addAttribute("pt",list); + } return prefix + "/add"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java index abd3a622..8cabeb40 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java @@ -1,8 +1,10 @@ package com.ruoyi.web.controller.nanjing; +import java.util.ArrayList; import java.util.List; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.nanjing.domain.TBdProductinfo; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -77,10 +79,20 @@ public class TBdProducttypeController extends BaseController public String add(ModelMap map) { List list = tBdProducttypeService.selectTBdProducttype(); - int max = Convert.toInt(list.get(0).getProductTypeID()); - String oper = max + 1+""; - list.get(0).setProductTypeID(oper); - map.addAttribute("pt",list); + int max ; + if(list.size()==0){ + max = 0; + List list1 = new ArrayList<>(); + TBdProducttype tBdProducttype = new TBdProducttype(); + tBdProducttype.setProductTypeID(max+1L+""); + map.addAttribute("pt",list1); + }else{ + max = Convert.toInt(list.get(0).getProductTypeID()); + String oper = max + 1+""; + list.get(0).setProductTypeID(oper); + map.addAttribute("pt",list); + } + return prefix + "/add"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java index 871bfc7b..f2a230de 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java @@ -1,9 +1,6 @@ package com.ruoyi.web.controller.nanjing; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.text.Convert; @@ -108,17 +105,36 @@ public class TBdSubstationController extends BaseController { //工位序号+ List list = tBdSubstationService.selectStationcode(); - int max = Convert.toInt(list.get(0).getStationID()); - list.get(0).setStationID(max+1L); + int max; + if(list.size()==0){ + max = 0; + List lists = new ArrayList<>(); + TBdSubstation tBdSubstation = new TBdSubstation(); + tBdSubstation.setStationID(max+1L); + lists.add(tBdSubstation); + map.addAttribute("si",lists); + }else{ + max = Convert.toInt(list.get(0).getStationID()); + list.get(0).setStationID(max+1L); + map.addAttribute("si",list); + } //排序id+ List list1 = tBdSubstationService.selectOrderid(); - int max1 = Convert.toInt(list.get(0).getOrderID()); - list.get(0).setOrderID(max1+1L); - + int max1; + if(list1.size()==0){ + max1 = 0; + List list2 = new ArrayList<>(); + TBdSubstation tBdSubstation = new TBdSubstation(); + tBdSubstation.setOrderID(max1+1L); + list2.add(tBdSubstation); + map.addAttribute("oi",list2); + }else{ + max1 = Convert.toInt(list.get(0).getOrderID()); + list1.get(0).setOrderID(max1+1L); + map.addAttribute("oi",list1); + } List linetypes = linetypeService.selectTBdLinetypeList(new TBdLinetype()); List stationtypes = stationtypeService.selectTBdStationtypeList(new TBdStationtype()); - map.addAttribute("si",list); - map.addAttribute("oi",list); map.addAttribute("linename",linetypes); map.addAttribute("stationtype",stationtypes); return prefix + "/add"; diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index e19abc6f..c454cbd1 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:sqlserver://121.36.58.109:1433;SelectMethod=cursor;DatabaseName=SecondNanjing + url: jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=FYATJ username: sa - password: haiwei@123 + password: 123456 # 从库数据源 slave: # 从数据源开关/默认关闭