Commit 093845b5 authored by 王飞's avatar 王飞

1、实现预览企业留档文件功能。

parent 31fd4081
......@@ -27,7 +27,7 @@ public class ReviewEnterpriseArchive implements Serializable {
/**
* 企业名称
*/
private String enterpriceName;
private String enterpriseName;
/**
* 文件名称
......@@ -69,6 +69,4 @@ public class ReviewEnterpriseArchive implements Serializable {
*/
private Long taskId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.ruoyi.domain.vo;
import lombok.Data;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@Data
public class ReviewEnterpriseArchiveViewItemVO {
......@@ -16,4 +18,7 @@ public class ReviewEnterpriseArchiveViewItemVO {
// 要点要求
private String keyPoint;
// 企业留档文件id
private Long archiveId;
}
......@@ -7,7 +7,10 @@ import java.util.List;
@Data
public class ReviewEnterpriseArchiveViewVO {
// 文件名称
// 企业留档文件id
private Long id;
// 企业留档文件名称
private String fileName;
// 条目
......
......@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -17,6 +18,8 @@ import java.util.List;
public interface ReviewEnterpriseArchiveMapper extends BaseMapper<ReviewEnterpriseArchive> {
List<ReviewEnterpriseArchive> findByTaskId(@Param("taskId") Long taskId);
List<ReviewEnterpriseArchiveViewItemVO> findViewItemVOByTaskId(@Param("taskId") Long taskId);
}
......
......@@ -2,12 +2,14 @@ package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.mapper.ReviewEnterpriseArchiveMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -17,18 +19,48 @@ import java.util.List;
*/
@Service
public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterpriseArchiveMapper, ReviewEnterpriseArchive>
implements ReviewEnterpriseArchiveService{
implements ReviewEnterpriseArchiveService {
@Autowired
private ReviewEnterpriseArchiveMapper reviewEnterpriseArchiveMapper;
@Override
public List<ReviewEnterpriseArchiveViewVO> view(Long taskId) {
List<ReviewEnterpriseArchive> archives = reviewEnterpriseArchiveMapper.findByTaskId(taskId);
List<ReviewEnterpriseArchiveViewItemVO> viewItems = reviewEnterpriseArchiveMapper.findViewItemVOByTaskId(taskId);
return buildReviewEnterpriseArchiveViewVO(archives, viewItems);
}
private List<ReviewEnterpriseArchiveViewVO> buildReviewEnterpriseArchiveViewVO(List<ReviewEnterpriseArchive> archives, List<ReviewEnterpriseArchiveViewItemVO> viewItems) {
List<ReviewEnterpriseArchiveViewVO> viewList = new ArrayList();
for(ReviewEnterpriseArchive archive : archives) {
ReviewEnterpriseArchiveViewVO view = new ReviewEnterpriseArchiveViewVO();
view.setId(archive.getId());
view.setFileName(archive.getFileName());
setReviewEnterpriseArchiveViewItemVO(view, viewItems);
viewList.add(view);
}
return viewList;
}
private void setReviewEnterpriseArchiveViewItemVO(ReviewEnterpriseArchiveViewVO view, List<ReviewEnterpriseArchiveViewItemVO> viewItems) {
List<ReviewEnterpriseArchiveViewItemVO> subList = new ArrayList();
Long archiveId = view.getId();
for(ReviewEnterpriseArchiveViewItemVO item : viewItems) {
if(item.getArchiveId().equals(archiveId)) {
subList.add(item);
}
}
return null;
view.setItems(subList);
}
}
......
......@@ -6,7 +6,7 @@
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewEnterpriseArchive">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="enterpriceName" column="enterprice_name" jdbcType="VARCHAR"/>
<result property="enterpriseName" column="enterprice_name" jdbcType="VARCHAR"/>
<result property="fileName" column="file_name" jdbcType="VARCHAR"/>
<result property="version" column="version" jdbcType="VARCHAR"/>
<result property="publishDate" column="publish_date" jdbcType="DATE"/>
......@@ -17,13 +17,21 @@
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id,enterprice_name,file_name,
version,publish_date,status,
identify_number,storage,photo,
task_id
</sql>
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewEnterpriseArchive">
SELECT id, enterpriceName, fileName, version, publishDate, status, identifyNumber, storage, photo, taskId FROM t_review_enterprise_archive WHERE task_id = #{taskId}
SELECT id, enterprise_name, file_name, version, publish_date, status, identify_number, storage, photo, task_id FROM t_review_enterprise_archive WHERE task_id = #{taskId}
</select>
<select id="findViewItemVOByTaskId" resultType="com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO">
SELECT
result.catalogue AS catalogue,
standard.chapter AS chapter,
standard.text AS standard,
keypoint.text AS keyPoint,
archive.id AS archiveId
FROM t_review_details_result result
LEFT JOIN t_review_details details ON result.review_details_id = details.id
LEFT JOIN t_review_keypoint keypoint ON details.review_keypoint_id = keypoint.id
LEFT JOIN t_review_standard standard ON keypoint.review_standard_id = standard.id
LEFT JOIN t_review_enterprise_archive archive ON result.review_enterprise_archive_id = archive.id
WHERE result.task_id = #{taskId};
</select>
</mapper>
package com.ruoyi;
import cn.hutool.json.JSONUtil;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest
public class ReviewEnterpriseArchiveTest {
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
@Test
public void viewTest() {
List<ReviewEnterpriseArchiveViewVO> view = reviewEnterpriseArchiveService.view(1744255874929094658L);
JSONUtil.toJsonPrettyStr(view);
}
}
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