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

修改设备信息添加报错bug

parent 3ef1b5d7
......@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
* 启动程序
*
*
* @author zehong
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
......@@ -15,5 +15,6 @@ public class GasSafetyApplication
public static void main(String[] args)
{
SpringApplication.run(GasSafetyApplication.class, args);
System.out.println("启动成功");
}
}
......@@ -105,7 +105,6 @@ public class TDeviceInfoController extends BaseController {
@Log(title = "设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDeviceInfo tDeviceInfo) {
System.out.println(tDeviceInfo.getEquipmentList());
int result = tDeviceInfoService.insertTDeviceInfo(tDeviceInfo);
if (result <= 0) {
new Exception("设备信息插入失败");
......
......@@ -318,14 +318,14 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
public int insertTDeviceInfo(TDeviceInfo tDeviceInfo)
{
int deviceId = tDeviceInfoMapper.insertTDeviceInfo(tDeviceInfo);
for (int i=0;i<tDeviceInfo.getEquipmentList().size();i++){
tDeviceInfo.getEquipmentList().get(i).setCreateTime(new Date());
tDeviceInfo.getEquipmentList().get(i).setRelationDeviceId(tDeviceInfo.getDeviceId());
}
/*添加下级设备*/
tDeviceInfoMapper.insertTrelation(tDeviceInfo.getEquipmentList());
/**添加*/
System.out.println(tDeviceInfo.getDeviceId());
if (tDeviceInfo.getEquipmentList().size()!=0){
for (int i=0;i<tDeviceInfo.getEquipmentList().size();i++){
tDeviceInfo.getEquipmentList().get(i).setCreateTime(new Date());
tDeviceInfo.getEquipmentList().get(i).setRelationDeviceId(tDeviceInfo.getDeviceId());
}
/*添加下级设备*/
tDeviceInfoMapper.insertTrelation(tDeviceInfo.getEquipmentList());
}
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