Commit b45d0c9b authored by 吴卿华's avatar 吴卿华

修改设备信息添加报错bug

parent 3ef1b5d7
...@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; ...@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/** /**
* 启动程序 * 启动程序
* *
* @author zehong * @author zehong
*/ */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
...@@ -15,5 +15,6 @@ public class GasSafetyApplication ...@@ -15,5 +15,6 @@ public class GasSafetyApplication
public static void main(String[] args) public static void main(String[] args)
{ {
SpringApplication.run(GasSafetyApplication.class, args); SpringApplication.run(GasSafetyApplication.class, args);
System.out.println("启动成功");
} }
} }
...@@ -105,7 +105,6 @@ public class TDeviceInfoController extends BaseController { ...@@ -105,7 +105,6 @@ public class TDeviceInfoController extends BaseController {
@Log(title = "设备信息", businessType = BusinessType.INSERT) @Log(title = "设备信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody TDeviceInfo tDeviceInfo) { public AjaxResult add(@RequestBody TDeviceInfo tDeviceInfo) {
System.out.println(tDeviceInfo.getEquipmentList());
int result = tDeviceInfoService.insertTDeviceInfo(tDeviceInfo); int result = tDeviceInfoService.insertTDeviceInfo(tDeviceInfo);
if (result <= 0) { if (result <= 0) {
new Exception("设备信息插入失败"); new Exception("设备信息插入失败");
......
...@@ -318,14 +318,14 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -318,14 +318,14 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
public int insertTDeviceInfo(TDeviceInfo tDeviceInfo) public int insertTDeviceInfo(TDeviceInfo tDeviceInfo)
{ {
int deviceId = tDeviceInfoMapper.insertTDeviceInfo(tDeviceInfo); int deviceId = tDeviceInfoMapper.insertTDeviceInfo(tDeviceInfo);
for (int i=0;i<tDeviceInfo.getEquipmentList().size();i++){ if (tDeviceInfo.getEquipmentList().size()!=0){
tDeviceInfo.getEquipmentList().get(i).setCreateTime(new Date()); for (int i=0;i<tDeviceInfo.getEquipmentList().size();i++){
tDeviceInfo.getEquipmentList().get(i).setRelationDeviceId(tDeviceInfo.getDeviceId()); tDeviceInfo.getEquipmentList().get(i).setCreateTime(new Date());
} tDeviceInfo.getEquipmentList().get(i).setRelationDeviceId(tDeviceInfo.getDeviceId());
/*添加下级设备*/ }
tDeviceInfoMapper.insertTrelation(tDeviceInfo.getEquipmentList()); /*添加下级设备*/
/**添加*/ tDeviceInfoMapper.insertTrelation(tDeviceInfo.getEquipmentList());
System.out.println(tDeviceInfo.getDeviceId()); }
return deviceId; return deviceId;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment