|
@@ -80,6 +80,7 @@ public class TdDeviceController extends BaseController {
|
80
|
80
|
@ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
81
|
81
|
public ResponseBean tdDeviceAdd(@ApiParam("保存内容") @RequestBody TdDevice tdDevice) throws Exception{
|
82
|
82
|
|
|
83
|
+ tdDevice.setDeviceId(null);
|
83
|
84
|
boolean isNew = StringUtils.isEmpty(tdDevice.getDeviceId());
|
84
|
85
|
|
85
|
86
|
if (StringUtils.isEmpty(tdDevice.getMachineryId())) {
|
|
@@ -169,10 +170,16 @@ public class TdDeviceController extends BaseController {
|
169
|
170
|
* 根据id删除对象
|
170
|
171
|
* @param id 实体ID
|
171
|
172
|
*/
|
172
|
|
- @RequestMapping(value="/admin/device/{id}", method= RequestMethod.DELETE)
|
|
173
|
+ @RequestMapping(value="/admin/device", method= RequestMethod.DELETE)
|
173
|
174
|
@ApiOperation(value="取消绑定", notes = "取消绑定", httpMethod = "DELETE", response = ResponseBean.class)
|
174
|
|
- public ResponseBean tdDeviceDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
|
175
|
|
- if(iTdDeviceService.removeLogicById(id)){
|
|
175
|
+ public ResponseBean tdDeviceDelete(@ApiParam("设备类型") @RequestParam String deviceType,
|
|
176
|
+ @ApiParam("设备号") @RequestParam String deviceNo) throws Exception{
|
|
177
|
+ TdDevice device = iTdDeviceService.getExistByDevice(deviceType, deviceNo);
|
|
178
|
+ if (null == device) {
|
|
179
|
+ return ResponseBean.error("未找到设备", ResponseBean.ERROR_UNAVAILABLE);
|
|
180
|
+ }
|
|
181
|
+
|
|
182
|
+ if(iTdDeviceService.removeLogicById(device.getDeviceId())){
|
176
|
183
|
return ResponseBean.success("success");
|
177
|
184
|
} else {
|
178
|
185
|
return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|