|
@@ -7,6 +7,8 @@ import com.jpsoft.smart.modules.base.service.DeviceInfoService;
|
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.smart.modules.lapi.service.ILapiService;
|
|
|
+import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
|
|
|
import com.jpsoft.smart.modules.sys.entity.User;
|
|
|
import com.jpsoft.smart.modules.base.entity.PersonDeviceRelation;
|
|
|
import com.jpsoft.smart.modules.base.service.PersonDeviceRelationService;
|
|
@@ -20,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -44,6 +47,9 @@ public class PersonDeviceRelationController {
|
|
|
@Autowired
|
|
|
private DataDictionaryService dataDictionaryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ILapiService lapiService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value="添加设备和人员绑定")
|
|
|
@PostMapping("add")
|
|
@@ -255,19 +261,18 @@ public class PersonDeviceRelationController {
|
|
|
personDeviceRelation.setUpdateBy(subject);
|
|
|
personDeviceRelation.setUpdateTime(new Date());
|
|
|
|
|
|
- int affectCount = personDeviceRelationService.update(personDeviceRelation);
|
|
|
+ int affectCount = personDeviceRelationService.updateDevicePerson(personDeviceRelation);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(affectCount);
|
|
|
} else {
|
|
|
msgResult.setResult(false);
|
|
|
- msgResult.setMessage("删除失败");
|
|
|
+ msgResult.setMessage("数据库更新失败");
|
|
|
}
|
|
|
}
|
|
|
catch(Exception ex){
|
|
|
logger.error(ex.getMessage(),ex);
|
|
|
-
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage(ex.getMessage());
|
|
|
}
|
|
@@ -290,7 +295,7 @@ public class PersonDeviceRelationController {
|
|
|
personDeviceRelation.setUpdateBy(subject);
|
|
|
personDeviceRelation.setUpdateTime(new Date());
|
|
|
|
|
|
- affectCount += personDeviceRelationService.update(personDeviceRelation);
|
|
|
+ affectCount = personDeviceRelationService.updateDevicePerson(personDeviceRelation);
|
|
|
}
|
|
|
|
|
|
if (affectCount > 0) {
|