package com.lxzn.nc.controller; import com.lxzn.framework.domain.nc.DeviceType; import com.lxzn.framework.model.response.CommonCode; import com.lxzn.framework.model.response.QueryListResponseResult; import com.lxzn.framework.model.response.ResponseResult; import com.lxzn.nc.service.IDeviceTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; @Slf4j @Api(tags = "设备类信息") @RestController @RequestMapping("/nc/deviceType") public class DeviceTypeController{ @Autowired private IDeviceTypeService deviceTypeService; /** * 根据业务id查询设备类列表 * @param attributionId * @param attributionType * @return */ @ApiOperation(value = "设备类信息-根据业务id查询设备类列表", notes = "设备类信息-根据业务id查询设备类列表") @GetMapping("/getByBusinessId") public QueryListResponseResult getByBusinessId(String attributionId, String attributionType){ return new QueryListResponseResult<>(CommonCode.SUCCESS,deviceTypeService.getByBusinessId(attributionId,attributionType)); } /** * 新增设备类 * @param deviceType * @return */ @ApiOperation(value = "设备类信息-新增设备类", notes = "设备类信息-新增设备类") @PostMapping("/add") public ResponseResult add(@RequestBody DeviceType deviceType){ boolean b = deviceTypeService.add(deviceType); if(b) { return new ResponseResult(CommonCode.SUCCESS); } return new ResponseResult(CommonCode.FAIL); } /** * 编辑设备类 * @param deviceType * @return */ @ApiOperation(value = "设备类信息-编辑设备类", notes = "设备类信息-编辑设备类") @PutMapping("/edit") public ResponseResult edit(@RequestBody DeviceType deviceType){ boolean b = deviceTypeService.edit(deviceType); if(b) { return new ResponseResult(CommonCode.SUCCESS); } return new ResponseResult(CommonCode.FAIL); } /** * 根据id删除设备类 * @param id * @return */ @ApiOperation(value = "设备类信息-根据id删除设备类", notes = "设备类信息-根据id删除设备类") @DeleteMapping("/delete") public ResponseResult delete(String id){ boolean b = deviceTypeService.delete(id); if(b) { return new ResponseResult(CommonCode.SUCCESS); } return new ResponseResult(CommonCode.FAIL); } }