| | |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("testPlan") |
| | | @Api(tags = "试验计划/试验结论") |
| | | @Api(tags = "试验计划、试验结论") |
| | | @Slf4j |
| | | public class TestPlanController { |
| | | @Autowired |
| | | private TestPlanService service; |
| | | @Autowired |
| | | private DeviceInfService deviceInfService; |
| | | |
| | | |
| | | @GetMapping("all") |
| | | @ApiOperation(value = "查询所有-分页") |
| | |
| | | return service.getPageByCondition(pageNum,pageSize,testPlan); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("conclusion") |
| | | @ApiOperation(value = "试验结论查询分页-根据筛选条件") |
| | | public Response<IPage<TestPlan>> getConclusion(@RequestParam int pageNum, @RequestParam int pageSize, @RequestBody TestPlan testPlan){ |
| | | return service.getConclusion(pageNum,pageSize,testPlan); |
| | | } |
| | | |
| | | @GetMapping |
| | | @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 = "新增") |