Commit 598b48fd authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents c16ab5ba ce10da5e
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 车企留档文件
* @TableName t_review_enterprise_archive
*/
@TableName(value ="t_review_enterprise_archive")
@Data
public class ReviewEnterpriseArchive implements Serializable {
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
/**
* 企业名称
*/
private String enterpriseName;
/**
* 文件名称
*/
private String fileName;
/**
* 文件版本
*/
private String version;
/**
* 发布日期
*/
private Date publishDate;
/**
* 文件状态
*/
private String status;
/**
* 文件识别号
*/
private String identifyNumber;
/**
* 存储位置
*/
private String storage;
/**
* 图片地址
*/
private String photo;
/**
* 关联到任务id
*/
private Long taskId;
}
\ 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 {
// 文件目录
private String catalogue;
// 标准章节
private String chapter;
// 标准要求
private String standard;
// 要点要求
private String keyPoint;
// 企业留档文件id
private Long archiveId;
}
package com.ruoyi.domain.vo;
import lombok.Data;
import java.util.List;
@Data
public class ReviewEnterpriseArchiveViewVO {
// 企业留档文件id
private Long id;
// 企业留档文件名称
private String fileName;
// 条目
private List<ReviewEnterpriseArchiveViewItemVO> items;
}
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;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_enterprise_archive(车企留档文件)】的数据库操作Mapper
* @createDate 2024-02-22 15:32:57
* @Entity com.ruoyi.domain.ReviewEnterpriseArchive
*/
@Repository
public interface ReviewEnterpriseArchiveMapper extends BaseMapper<ReviewEnterpriseArchive> {
List<ReviewEnterpriseArchive> findByTaskId(@Param("taskId") Long taskId);
List<ReviewEnterpriseArchiveViewItemVO> findViewItemVOByTaskId(@Param("taskId") Long taskId);
}
package com.ruoyi.service;
import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import java.util.List;
/**
* @author wangfei
* @description 针对表【t_review_enterprise_archive(车企留档文件)】的数据库操作Service
* @createDate 2024-02-22 15:32:57
*/
public interface ReviewEnterpriseArchiveService extends IService<ReviewEnterpriseArchive> {
List<ReviewEnterpriseArchiveViewVO> view(Long taskId);
}
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;
/**
* @author wangfei
* @description 针对表【t_review_enterprise_archive(车企留档文件)】的数据库操作Service实现
* @createDate 2024-02-22 15:32:57
*/
@Service
public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterpriseArchiveMapper, ReviewEnterpriseArchive>
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);
}
}
view.setItems(subList);
}
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel(value = "ReviewEnterpriseArchiveViewResponse", description = "预览企业留档文件")
@Data
public class ReviewEnterpriseArchiveViewResponse {
}
<?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.ReviewEnterpriseArchiveMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewEnterpriseArchive">
<id property="id" column="id" jdbcType="BIGINT"/>
<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"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="identifyNumber" column="identify_number" jdbcType="VARCHAR"/>
<result property="storage" column="storage" jdbcType="VARCHAR"/>
<result property="photo" column="photo" jdbcType="VARCHAR"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
</resultMap>
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewEnterpriseArchive">
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