| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.DeviceInf; |
| | | import com.whyc.pojo.TestPlan; |
| | | import com.whyc.service.DeviceInfService; |
| | | import com.whyc.service.TestPlanService; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("testPlan") |
| | |
| | | public class TestPlanController { |
| | | @Autowired |
| | | private TestPlanService service; |
| | | @Autowired |
| | | private DeviceInfService deviceInfService; |
| | | |
| | | |
| | | @GetMapping("all") |
| | | @ApiOperation(value = "查询所有-分页") |
| | |
| | | return service.getOne(num); |
| | | } |
| | | |
| | | @GetMapping("getDeviceInf") |
| | | @ApiOperation(value = "设备信息") |
| | | public Response getDeviceInf(@RequestParam Integer num){ |
| | | TestPlan testPlan = service.getOneById(num); |
| | | String devices = testPlan.getDevices(); |
| | | String[] ids = devices.split(","); |
| | | List<DeviceInf> list = new ArrayList<>(); |
| | | for (String deviceId:ids) { |
| | | DeviceInf deviceInf = deviceInfService.getOneByDeviceId(Integer.valueOf(deviceId)); |
| | | list.add(deviceInf); |
| | | } |
| | | return new Response().set(1,list); |
| | | } |
| | | |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "新增") |