Commit b9d65507 authored by 王飞's avatar 王飞

Merge branch 'gaoying' into 'dev'

Gaoying

See merge request !96
parents 138e1e7a 8de2cbc3
package com.ruoyi.domain; package com.ruoyi.domain;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.domain.vo.SampleTaskVo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -93,4 +95,6 @@ public class Sample extends BaseEntity ...@@ -93,4 +95,6 @@ public class Sample extends BaseEntity
/** 车企名称 */ /** 车企名称 */
@ApiModelProperty("车企名称") @ApiModelProperty("车企名称")
private String carCompanyName; private String carCompanyName;
private List<SampleTaskVo> taskSampleRelation;
} }
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@ApiModel( description = "样品任务联查字段")
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SampleTaskVo {
private Long taskId;
private Long SampleId;
private String taskName;
}
...@@ -2,6 +2,7 @@ package com.ruoyi.mapper; ...@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.TaskSampleRelation; import com.ruoyi.domain.TaskSampleRelation;
import com.ruoyi.domain.vo.SampleTaskVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -16,4 +17,9 @@ public interface TaskSampleRelationMapper extends BaseMapper<TaskSampleRelation> ...@@ -16,4 +17,9 @@ public interface TaskSampleRelationMapper extends BaseMapper<TaskSampleRelation>
* @return * @return
*/ */
List<TaskSampleRelation> selectByTaskId(@Param("taskId") Long taskId,@Param("flag") String flag); List<TaskSampleRelation> selectByTaskId(@Param("taskId") Long taskId,@Param("flag") String flag);
/**
* 根据样品id查询*/
List<SampleTaskVo> selectTaskBysampleId(@Param("idList") List<Long> idList);
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -7,7 +8,9 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -7,7 +8,9 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.Sample; import com.ruoyi.domain.Sample;
import com.ruoyi.domain.vo.SampleTaskVo;
import com.ruoyi.mapper.SampleManagementMapper; import com.ruoyi.mapper.SampleManagementMapper;
import com.ruoyi.mapper.TaskSampleRelationMapper;
import com.ruoyi.service.SampleManagementService; import com.ruoyi.service.SampleManagementService;
import com.ruoyi.web.request.SampleManagementRequest; import com.ruoyi.web.request.SampleManagementRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,6 +30,9 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap ...@@ -27,6 +30,9 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
@Autowired @Autowired
private SampleManagementMapper sampleManagementMapper; private SampleManagementMapper sampleManagementMapper;
@Autowired
private TaskSampleRelationMapper taskSampleRelationMapper;
/** /**
* 查询样品管理 * 查询样品管理
* *
...@@ -48,7 +54,11 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap ...@@ -48,7 +54,11 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
@Override @Override
public List<Sample> selectSampleManagementList(SampleManagementRequest sampleManagementRequest) public List<Sample> selectSampleManagementList(SampleManagementRequest sampleManagementRequest)
{ {
return sampleManagementMapper.selectSampleManagementList(sampleManagementRequest); List<Sample> list = sampleManagementMapper.selectSampleManagementList(sampleManagementRequest);
if(list.size()>0){
setSampleTask(list);
}
return list;
} }
/** /**
...@@ -106,4 +116,24 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap ...@@ -106,4 +116,24 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
public List<Sample> selectSampleList(SampleManagementRequest sampleManagementRequest){ public List<Sample> selectSampleList(SampleManagementRequest sampleManagementRequest){
return sampleManagementMapper.selectSampleList(sampleManagementRequest); return sampleManagementMapper.selectSampleList(sampleManagementRequest);
} }
/**
* 给样品的数据赋值任务集合*/
public void setSampleTask(List<Sample> sampleList){
List<Long> listId = new ArrayList<>();
for(Sample sample : sampleList){
listId.add(sample.getId());
}
List<SampleTaskVo> sampleTaskVoList = taskSampleRelationMapper.selectTaskBysampleId(listId);
for(Sample sample : sampleList){
List<SampleTaskVo> sampleTaskVos = new ArrayList<>();
for (SampleTaskVo sampleTaskVo : sampleTaskVoList){
if(sampleTaskVo.getSampleId().equals(sample.getId())){
sampleTaskVos.add(sampleTaskVo);
}
}
sample.setTaskSampleRelation(sampleTaskVos);
}
}
} }
...@@ -42,11 +42,12 @@ public class SampleManagementController extends BaseController ...@@ -42,11 +42,12 @@ public class SampleManagementController extends BaseController
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/list") @RequestMapping(method = RequestMethod.POST, value = "/list")
public TableDataInfo list(@Validated @RequestBody SampleManagementRequest request) public TableDataInfo<Sample> list(@Validated @RequestBody SampleManagementRequest request)
{ {
startPage(); startPage(request);
List<Sample> list = sampleManagementService.selectSampleManagementList(request); List<Sample> list = sampleManagementService.selectSampleManagementList(request);
return getDataTable(list); return getDataTable(list);
} }
/** /**
......
...@@ -7,6 +7,7 @@ import com.ruoyi.domain.Sample; ...@@ -7,6 +7,7 @@ import com.ruoyi.domain.Sample;
import com.ruoyi.domain.TestScenario; import com.ruoyi.domain.TestScenario;
import com.ruoyi.service.ITestScenarioService; import com.ruoyi.service.ITestScenarioService;
import com.ruoyi.web.request.TestScenarioRequest; import com.ruoyi.web.request.TestScenarioRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag; import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags; import org.apache.skywalking.apm.toolkit.trace.Tags;
...@@ -20,10 +21,12 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,10 +21,12 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@Api(tags = "测试场景")
@RestController @RestController
@RequestMapping("/system/scenario") @RequestMapping("/system/scenario")
public class TestScenarioController extends BaseController { public class TestScenarioController extends BaseController {
@Autowired @Autowired
private ITestScenarioService testScenarioService; private ITestScenarioService testScenarioService;
...@@ -34,8 +37,8 @@ public class TestScenarioController extends BaseController { ...@@ -34,8 +37,8 @@ public class TestScenarioController extends BaseController {
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList") @RequestMapping(method = RequestMethod.POST, value = "/getList")
public TableDataInfo list(@Validated @RequestBody TestScenarioRequest testScenarioRequest){ public TableDataInfo<TestScenario> list(@Validated @RequestBody TestScenarioRequest testScenarioRequest){
startPage(); startPage(testScenarioRequest);
List<TestScenario> list = testScenarioService.selectTestScenarioList(testScenarioRequest); List<TestScenario> list = testScenarioService.selectTestScenarioList(testScenarioRequest);
return getDataTable(list); return getDataTable(list);
} }
......
...@@ -3,11 +3,10 @@ package com.ruoyi.web; ...@@ -3,11 +3,10 @@ package com.ruoyi.web;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.TestScenario;
import com.ruoyi.domain.TestType; import com.ruoyi.domain.TestType;
import com.ruoyi.service.ITestTypeService; import com.ruoyi.service.ITestTypeService;
import com.ruoyi.web.request.TestScenarioRequest;
import com.ruoyi.web.request.TestTypeRequest; import com.ruoyi.web.request.TestTypeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag; import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags; import org.apache.skywalking.apm.toolkit.trace.Tags;
...@@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@Api(tags = "测试类型")
@RestController @RestController
@RequestMapping("/system/type") @RequestMapping("/system/type")
public class TestTypeController extends BaseController { public class TestTypeController extends BaseController {
...@@ -28,22 +28,22 @@ public class TestTypeController extends BaseController { ...@@ -28,22 +28,22 @@ public class TestTypeController extends BaseController {
private ITestTypeService testTypeService; private ITestTypeService testTypeService;
/** /**
* 测试场景分页 * 查询测试类型分页
*/ */
@ApiOperation("查询测试场景分页查询") @ApiOperation("查询测试类型分页查询")
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList") @RequestMapping(method = RequestMethod.POST, value = "/getList")
public TableDataInfo list(@Validated @RequestBody TestTypeRequest testTypeRequest){ public TableDataInfo<TestType> list(@Validated @RequestBody TestTypeRequest testTypeRequest){
startPage(); startPage(testTypeRequest);
List<TestType> list = testTypeService.selectTestTypeList(testTypeRequest); List<TestType> list = testTypeService.selectTestTypeList(testTypeRequest);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 测试场景列表不分页 * 查询测试类型列表不分页
*/ */
@ApiOperation("查询测试场景") @ApiOperation("查询测试类型")
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getListAll") @RequestMapping(method = RequestMethod.POST, value = "/getListAll")
......
...@@ -25,4 +25,17 @@ ...@@ -25,4 +25,17 @@
</if> </if>
</select> </select>
<select id="selectTaskBysampleId" resultType="com.ruoyi.domain.vo.SampleTaskVo">
SELECT
relation.sample_id,
relation.task_id,
task.NAME As taskName
FROM
t_task_sample_relation relation
LEFT JOIN t_task task ON task.id = relation.task_id
WHERE relation.sample_id IN
<foreach item="id" collection="idList" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment