Commit cd6e9cf5 authored by yuanshuo's avatar yuanshuo

标准内容库更新了界面布局,所以更新一个接口getReviewStandardList以及对应的实体类来提供使用

parent 329a9f4e
......@@ -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,15 @@ 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);
}
......@@ -17,10 +17,7 @@ import com.ruoyi.service.ReviewDetailsService;
import com.ruoyi.service.ReviewKeyPointService;
import com.ruoyi.service.ReviewSceneService;
import com.ruoyi.service.ReviewStandardService;
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;
......@@ -28,9 +25,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
......@@ -464,4 +459,34 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
}
/*
* 标准内容库新界面接口
* */
@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,16 @@ 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;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@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;
}
......@@ -97,7 +97,23 @@
and standard_id = #{request.standardId}
and type = #{request.type}
</select>
<select id="getListNew" resultType="com.ruoyi.web.response.ReviewStandardListNewResponse">
select type,chapter
from t_review_standard
where standard_no = #{request.standardNo} and standard_id = #{request.standardId}
</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