Commit 860507cf authored by yuanshuo's avatar yuanshuo

标准内容库添加接口/getReviewStandardList 用于获取数据

parent 1a8c04b5
......@@ -6,9 +6,8 @@ import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewFindListRequest;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import com.ruoyi.web.request.StandardListNewRequest;
import com.ruoyi.web.response.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -39,4 +38,14 @@ public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
// 根据要点列表查询标准列表
List<ReviewStandard> findByKeyPointList(@Param("keyPointList") List<ReviewKeyPoint> keyPointList, @Param("request") ReviewFindListRequest request);
/*
* 标准内容库新界面接口
* */
List<StandardTypeListResponse> findTypeByStandard(@Param("request") StandardListNewRequest request);
/*
* 标准内容库新界面接口
* */
List<ReviewStandardChapterListResponse> findChaptersByStandard(@Param("request") StandardListNewRequest request);
}
......@@ -2,10 +2,7 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewFindListRequest;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.*;
import java.io.IOException;
......@@ -85,4 +82,9 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
* @return
*/
List<UseCaseListResponse> getUseCaseList(String request) throws IOException ;
/*
* 标准内容库新界面接口
* */
ReviewStandardListNewResponse getListNew(StandardListNewRequest request);
}
......@@ -12,10 +12,7 @@ import com.ruoyi.domain.vo.OptionalUseCasesVO;
import com.ruoyi.domain.vo.UseCaseUrlVO;
import com.ruoyi.mapper.*;
import com.ruoyi.service.*;
import com.ruoyi.web.request.ReviewFindListRequest;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.*;
import okhttp3.*;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,9 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Transactional
......@@ -458,5 +453,35 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
return reviewStandardList;
}
/*
* 标准内容库新界面接口
* */
@Override
public ReviewStandardListNewResponse getListNew(StandardListNewRequest request) {
// 获取标准类型列表
List<StandardTypeListResponse> typeListResponses = reviewStandardMapper.findTypeByStandard(request);
// 获取章节列表
List<ReviewStandardChapterListResponse> chapterList = reviewStandardMapper.findChaptersByStandard(request);
// 去重类型列表,并为每种类型分配章节列表
Set<String> uniqueTypes = new HashSet<>();
List<StandardTypeListResponse> uniqueTypeList = typeListResponses.stream()
.filter(type -> uniqueTypes.add(type.getType())) // 去重 type
.peek(type -> {
// 过滤并设置对应的章节列表
List<ReviewStandardChapterListResponse> filteredChapters = chapterList.stream()
.filter(chapter -> chapter.getType().equals(type.getType())) // 这里使用 getType 方法
.collect(Collectors.toList());
type.setReviewStandardChapterListResponses(filteredChapters);
})
.collect(Collectors.toList());
// 构建响应对象
ReviewStandardListNewResponse response = new ReviewStandardListNewResponse();
response.setTypeList(uniqueTypeList);
return response;
}
}
......@@ -152,4 +152,15 @@ public class ReviewStandardController extends BaseController {
return getDataTable(reviewStandardService.getUseCaseList(request));
}
/*
* 标准内容库新界面接口
* */
@ApiOperation("标准内容库新界面接口")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getReviewStandardList", produces="application/json;charset=UTF-8")
public R<ReviewStandardListNewResponse> getReviewStandardList(@RequestBody StandardListNewRequest request){
ReviewStandardListNewResponse response = reviewStandardService.getListNew(request);
return R.ok(response);
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "StandardListNewRequest", description = "标准内容库新界面接口")
public class StandardListNewRequest {
@ApiModelProperty("标准id")
private String standardId;
@ApiModelProperty("标准编号")
private String standardNo;
public String getStandardId() {
return standardId;
}
public void setStandardId(String standardId) {
this.standardId = standardId;
}
public String getStandardNo() {
return standardNo;
}
public void setStandardNo(String standardNo) {
this.standardNo = standardNo;
}
public StandardListNewRequest() {
}
public StandardListNewRequest(String standardId, String standardNo) {
this.standardId = standardId;
this.standardNo = standardNo;
}
@Override
public String toString() {
return "StandardListNewRequest{" +
"standardId='" + standardId + '\'' +
", standardNo='" + standardNo + '\'' +
'}';
}
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "ReviewStandardChapterListResponse", description = "标准内容库新界面接口")
public class ReviewStandardChapterListResponse {
@ApiModelProperty("标准号id")
private String standardId;
@ApiModelProperty("章节")
private String chapter;
@ApiModelProperty("章节内容")
private String text;
@ApiModelProperty("标准分类")
private String type;
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "ReviewStandardListNewResponse", description = "标准内容库新界面接口")
public class ReviewStandardListNewResponse {
@ApiModelProperty("标准分类集合")
private List<StandardTypeListResponse> typeList;
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "StandardTypeList", description = "标准内容库新界面接口")
public class StandardTypeListResponse {
@ApiModelProperty("标准分类")
private String type;
@ApiModelProperty("章节集合")
private List<ReviewStandardChapterListResponse> reviewStandardChapterListResponses;
}
......@@ -98,6 +98,19 @@
and type = #{request.type}
</select>
<select id="findTypeByStandard" resultType="com.ruoyi.web.response.StandardTypeListResponse">
SELECT DISTINCT type
FROM t_review_standard
WHERE standard_no = #{request.standardNo}
AND standard_id = #{request.standardId}
</select>
<select id="findChaptersByStandard" resultType="com.ruoyi.web.response.ReviewStandardChapterListResponse">
SELECT chapter, text, type ,standard_id as standardId <!-- 添加 type 字段 -->
FROM t_review_standard
WHERE standard_no = #{request.standardNo}
AND standard_id = #{request.standardId}
</select>
</mapper>
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