package org.jeecg.modules.dnc.controller;
|
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.modules.dnc.entity.DeviceInfo;
|
import org.jeecg.modules.dnc.entity.DocRelative;
|
import org.jeecg.modules.dnc.response.CommonCode;
|
import org.jeecg.modules.dnc.response.QueryListResponseResult;
|
import org.jeecg.modules.dnc.response.ResponseResult;
|
import org.jeecg.modules.dnc.service.IDocRelativeService;
|
import org.jeecg.modules.mdc.entity.MdcEquipment;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Collections;
|
import java.util.List;
|
|
@Slf4j
|
@Api(tags = "设备关联文档表")
|
@RestController
|
@RequestMapping("/doc/relative")
|
public class DocRelativeController extends JeecgController<DocRelative, IDocRelativeService> {
|
@Autowired
|
private IDocRelativeService relativeService;
|
|
@AutoLog(value = "设备关联文档表-删除设备下的文档接口")
|
@ApiOperation(value = "设备关联文档表-删除设备下的文档接口", notes = "设备关联文档表-删除设备下的文档接口")
|
@DeleteMapping("/delete/device/{docId}/{deviceId}")
|
public ResponseResult deleteDocByDeviceId(@PathVariable("docId") String docId, @PathVariable("deviceId") String deviceId) {
|
boolean b = relativeService.deleteDocByAttr(docId, 4, deviceId);
|
if(b)
|
return new ResponseResult(CommonCode.SUCCESS);
|
return new ResponseResult(CommonCode.FAIL);
|
}
|
|
@AutoLog(value = "设备关联文档表-查询文档下的所有关联设备信息")
|
@ApiOperation(value = "设备关联文档表-查询文档下的所有关联设备信息", notes = "设备关联文档表-查询文档下的所有关联设备信息")
|
@GetMapping("/get/device/{docId}")
|
public QueryListResponseResult<MdcEquipment> findDeviceByDocId(@PathVariable("docId") String docId) {
|
List<MdcEquipment> list = relativeService.findDeviceByDocId(docId);
|
if(list == null)
|
list = Collections.emptyList();
|
return new QueryListResponseResult<>(CommonCode.SUCCESS, list);
|
}
|
}
|