Commit 419b11fe authored by 高滢's avatar 高滢

样品分页查询 联查任务

parent d13cedd8
package com.ruoyi.domain;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.domain.vo.SampleTaskVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -93,4 +95,6 @@ public class Sample extends BaseEntity
/** 车企名称 */
@ApiModelProperty("车企名称")
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;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.TaskSampleRelation;
import com.ruoyi.domain.vo.SampleTaskVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -16,4 +17,9 @@ public interface TaskSampleRelationMapper extends BaseMapper<TaskSampleRelation>
* @return
*/
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;
import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -7,7 +8,9 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.Sample;
import com.ruoyi.domain.vo.SampleTaskVo;
import com.ruoyi.mapper.SampleManagementMapper;
import com.ruoyi.mapper.TaskSampleRelationMapper;
import com.ruoyi.service.SampleManagementService;
import com.ruoyi.web.request.SampleManagementRequest;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,6 +30,9 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
@Autowired
private SampleManagementMapper sampleManagementMapper;
@Autowired
private TaskSampleRelationMapper taskSampleRelationMapper;
/**
* 查询样品管理
*
......@@ -48,7 +54,11 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
@Override
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,21 @@ public class SampleManagementServiceImpl extends ServiceImpl<SampleManagementMap
public List<Sample> selectSampleList(SampleManagementRequest 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
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@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);
return getDataTable(list);
}
/**
......
......@@ -37,7 +37,7 @@ public class TestScenarioController extends BaseController {
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList")
public TableDataInfo<TestScenario> list(@Validated TestScenarioRequest testScenarioRequest){
public TableDataInfo<TestScenario> list(@Validated @RequestBody TestScenarioRequest testScenarioRequest){
startPage(testScenarioRequest);
List<TestScenario> list = testScenarioService.selectTestScenarioList(testScenarioRequest);
return getDataTable(list);
......
......@@ -3,11 +3,10 @@ package com.ruoyi.web;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.TestScenario;
import com.ruoyi.domain.TestType;
import com.ruoyi.service.ITestTypeService;
import com.ruoyi.web.request.TestScenarioRequest;
import com.ruoyi.web.request.TestTypeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
......@@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = "测试类型")
@RestController
@RequestMapping("/system/type")
public class TestTypeController extends BaseController {
......@@ -28,22 +28,22 @@ public class TestTypeController extends BaseController {
private ITestTypeService testTypeService;
/**
* 测试场景分页
* 查询测试类型分页
*/
@ApiOperation("查询测试场景分页查询")
@ApiOperation("查询测试类型分页查询")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList")
public TableDataInfo<TestType> list(@Validated TestTypeRequest testTypeRequest){
public TableDataInfo<TestType> list(@Validated @RequestBody TestTypeRequest testTypeRequest){
startPage(testTypeRequest);
List<TestType> list = testTypeService.selectTestTypeList(testTypeRequest);
return getDataTable(list);
}
/**
* 测试场景列表不分页
* 查询测试类型列表不分页
*/
@ApiOperation("查询测试场景")
@ApiOperation("查询测试类型")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getListAll")
......
......@@ -25,4 +25,17 @@
</if>
</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>
\ 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