Commit dfdcac44 authored by 高滢's avatar 高滢

指定检测方案

parent 3db9d149
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author gaoying
*/
@Data
@ApiModel(value = "t_test_object_data", description = "指定检测方案")
public class TestObjectData {
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
private Long id;
@ApiModelProperty("类型")
private String type;
@ApiModelProperty("对象")
private String object;
@ApiModelProperty("描述")
private String describe;
@ApiModelProperty("用例编号")
private String useCaseNo;
@ApiModelProperty("排序")
private int sort;
}
package com.ruoyi.domain;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel
@TableName(value ="t_test_plan_record")
@Data
public class TestPlanRecord extends BaseEntity {
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("被检车企")
private String inspectCarCompany;
@ApiModelProperty("被检车企id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long inspectCarCompanyId;
@ApiModelProperty("车辆型号")
private String carModel;
@ApiModelProperty("检测方案生成时间")
private Date generationTime;
@ApiModelProperty("检测机构")
private String testOrganization;
@ApiModelProperty("文件路径")
private String fileUrl;
@ApiModelProperty("测试结果")
private String testResult;
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.TestObjectData;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TestObjectDataMapper extends BaseMapper<TestObjectData> {
public List<TestObjectData> selectTestObjectDataList();
}
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.TestObjectData;
import java.util.List;
public interface TestObjectDataService extends IService<TestObjectData> {
List<TestObjectData> selectTestObjectDataList();
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestObjectData;
import com.ruoyi.mapper.TestObjectDataMapper;
import com.ruoyi.service.TestObjectDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class TestObjectDataServiceImpl extends ServiceImpl<TestObjectDataMapper, TestObjectData> implements TestObjectDataService {
@Autowired
private TestObjectDataMapper testObjectDataMapper;
@Override
public List<TestObjectData> selectTestObjectDataList(){
return testObjectDataMapper.selectTestObjectDataList();
}
}
package com.ruoyi.web;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.TestObjectData;
import com.ruoyi.service.TestObjectDataService;
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;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
@Api(tags = "制定检测方案")
@RestController
@RequestMapping("/Object/Data")
public class TestObjectDataController {
@Autowired
private TestObjectDataService testObjectDataService;
@ApiOperation("获取制定方案列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getList")
public R<List> SelectTestObjectDataList(){
List<TestObjectData> objectList = testObjectDataService.selectTestObjectDataList();
Map<String, List<TestObjectData>> groupedObject = objectList.stream() .sorted(Comparator.comparingInt(TestObjectData::getSort)).collect(Collectors.groupingBy(TestObjectData::getDescribe));
List list= new ArrayList<>();
groupedObject.forEach((key,value)->{
Map map=new HashMap();
map.put("describe",value.get(0).getDescribe());
map.put("type",value.get(0).getType());
Map mapObj =new HashMap();
mapObj.put("options",value);
map.put("componentProps",mapObj);
list.add(map);
});
return R.ok(list);
}
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author gaoying
*/
@Data
@ApiModel(value = "TestPlanRecordRequest", description = "检测方案记录分页查询")
public class TestPlanRecordRequest extends PageDomain {
@ApiModelProperty("被检车企")
private String inspectCarCompany;
@ApiModelProperty("车辆型号")
private String carModel;
@ApiModelProperty("标准要求id")
private Long keyPointId;
@ApiModelProperty("文件路径")
private String fileUrl;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mapper.TestObjectDataMapper">
<resultMap type="com.ruoyi.domain.TestObjectData" id="TestObjectData">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="object" column="object" />
<result property="describe" column="describe" />
<result property="useCaseNo" column="use_case_no" />
<result property="sort" column="sort" />
</resultMap>
<sql id="TestObjectDataVo">
select * from t_test_object_data order by sort asc
</sql>
<select id="selectTestObjectDataList" parameterType="com.ruoyi.domain.TestObjectData">
<include refid="TestObjectDataVo"/>
</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