文献相关接口
This commit is contained in:
@@ -3,8 +3,8 @@ package com.bicloud.controller;
|
||||
import com.bicloud.common.result.PageResult;
|
||||
import com.bicloud.common.result.Result;
|
||||
import com.bicloud.pojo.dto.LiteratureCreateDto;
|
||||
import com.bicloud.pojo.dto.LiteratureDto;
|
||||
import com.bicloud.pojo.dto.LiteraturePageQueryDto;
|
||||
import com.bicloud.pojo.vo.DocumentTypeVo;
|
||||
import com.bicloud.pojo.vo.LiteratureListVo;
|
||||
import com.bicloud.service.LiteratureService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/literature")
|
||||
@@ -51,4 +53,12 @@ public class LiteratureController {
|
||||
PageResult<LiteratureListVo> result = literatureService.pageQuery(queryDTO);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
// 文献分类下拉框(document_type)
|
||||
@GetMapping("/types")
|
||||
@Operation(summary = "获取文献分类下拉列表")
|
||||
public Result<List<DocumentTypeVo>> types() {
|
||||
return Result.success(literatureService.listTypes());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@ package com.bicloud.mapper;
|
||||
|
||||
import com.bicloud.pojo.dto.LiteratureCreateDto;
|
||||
import com.bicloud.pojo.dto.LiteraturePageQueryDto;
|
||||
import com.bicloud.pojo.vo.DocumentTypeVo;
|
||||
import com.bicloud.pojo.vo.LiteratureListVo;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface LiteratureMapper {
|
||||
|
||||
@@ -17,4 +20,7 @@ public interface LiteratureMapper {
|
||||
|
||||
// 分页查询:返回列表VO(PageHelper自动分页)
|
||||
Page<LiteratureListVo> pageQuery(LiteraturePageQueryDto queryDTO);
|
||||
|
||||
// 获取文献分类
|
||||
List<DocumentTypeVo> listTypes();
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
package com.bicloud.pojo.dto;
|
||||
package com.bicloud.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 列表页筛选 + 分页参数
|
||||
*/
|
||||
@Data
|
||||
public class LiteraturePageQueryDto {
|
||||
/**
|
||||
* 列表页筛选 + 分页参数
|
||||
*/
|
||||
@Data
|
||||
public class LiteraturePageQueryDto {
|
||||
|
||||
private Integer page;
|
||||
private Integer pageSize;
|
||||
private Integer page;
|
||||
private Integer pageSize;
|
||||
|
||||
private Integer year; // YEAR(publish_time)
|
||||
private String docTitle; // 文章标题(模糊)
|
||||
private String publication; // 期刊名称(模糊)
|
||||
private String techniques; // 样品来源(模糊)
|
||||
private Integer docType; // 文献分类(类型ID,下拉建议传这个)
|
||||
private Integer year; // YEAR(publish_time)
|
||||
private String docTitle; // 文章标题(模糊)
|
||||
private String publication; // 期刊名称(模糊)
|
||||
private String techniques; // 样品来源(模糊)
|
||||
private Integer docType; // 文献分类(类型ID,下拉建议传这个)
|
||||
|
||||
private String keyword; // 关键字搜索(可选:对标题/期刊/作者/简介做模糊)
|
||||
private String keyword; // 关键字搜索(可选:对标题/期刊/作者/简介做模糊)
|
||||
|
||||
private BigDecimal impactFactorMin; // IF最小值
|
||||
private BigDecimal impactFactorMax; // IF最大值
|
||||
}
|
||||
private BigDecimal impactFactorMin; // IF最小值
|
||||
private BigDecimal impactFactorMax; // IF最大值
|
||||
}
|
||||
|
||||
12
src/main/java/com/bicloud/pojo/vo/DocumentTypeVo.java
Normal file
12
src/main/java/com/bicloud/pojo/vo/DocumentTypeVo.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.bicloud.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 文献分类(document_type)下拉项
|
||||
*/
|
||||
@Data
|
||||
public class DocumentTypeVo {
|
||||
private Integer id;
|
||||
private String name;
|
||||
}
|
||||
@@ -8,11 +8,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class LiteratureListVo {
|
||||
|
||||
private Long id; // 隐藏id(用于操作)
|
||||
private Integer year; // 年份:由 YEAR(publish_time) 计算得到
|
||||
private Long id; // 隐藏id
|
||||
private Integer year; // 年份
|
||||
private String docTitle; // 文章标题
|
||||
private String publication; // 期刊
|
||||
private String impactFactor; // IF(varchar原样返回,避免精度/格式问题)
|
||||
private String techniques; // 样品来源(先用 techniques)
|
||||
private String typeName; // 文献分类名(来自 biology_document_type.name)
|
||||
private String typeName; // 文献分类名
|
||||
private String docUrl; //链接
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package com.bicloud.service;
|
||||
import com.bicloud.common.result.PageResult;
|
||||
import com.bicloud.pojo.dto.LiteratureCreateDto;
|
||||
import com.bicloud.pojo.dto.LiteraturePageQueryDto;
|
||||
import com.bicloud.pojo.vo.DocumentTypeVo;
|
||||
import com.bicloud.pojo.vo.LiteratureListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LiteratureService {
|
||||
|
||||
// 新增文献(写入 biology_document_info)
|
||||
@@ -15,4 +18,7 @@ public interface LiteratureService {
|
||||
|
||||
// 分页查询(返回列表VO)
|
||||
PageResult<LiteratureListVo> pageQuery(LiteraturePageQueryDto queryDTO);
|
||||
|
||||
// 获取文献分类下拉列表
|
||||
List<DocumentTypeVo> listTypes();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.bicloud.common.result.PageResult;
|
||||
import com.bicloud.mapper.LiteratureMapper;
|
||||
import com.bicloud.pojo.dto.LiteratureCreateDto;
|
||||
import com.bicloud.pojo.dto.LiteraturePageQueryDto;
|
||||
import com.bicloud.pojo.vo.DocumentTypeVo;
|
||||
import com.bicloud.pojo.vo.LiteratureListVo;
|
||||
import com.bicloud.service.LiteratureService;
|
||||
import com.github.pagehelper.Page;
|
||||
@@ -11,6 +12,8 @@ import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class LiteratureServiceImpl implements LiteratureService {
|
||||
|
||||
@@ -45,4 +48,10 @@ public class LiteratureServiceImpl implements LiteratureService {
|
||||
// 4) 取 total + records
|
||||
return new PageResult<>(p.getTotal(), p.getResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DocumentTypeVo> listTypes() {
|
||||
return literatureMapper.listTypes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
d.publication AS publication,
|
||||
d.impact_factor AS impactFactor,
|
||||
d.techniques AS techniques,
|
||||
t.name AS typeName
|
||||
t.name AS typeName,
|
||||
d.doc_url AS docUrl
|
||||
FROM biology_document_info d
|
||||
LEFT JOIN biology_document_type t
|
||||
ON t.id = d.doc_type
|
||||
@@ -92,4 +93,16 @@
|
||||
ORDER BY d.id DESC
|
||||
</select>
|
||||
|
||||
<!-- 文献分类(document_type)下拉列表 -->
|
||||
<select id="listTypes" resultType="com.bicloud.pojo.vo.DocumentTypeVo">
|
||||
SELECT
|
||||
id,
|
||||
name
|
||||
FROM biology_document_type
|
||||
WHERE removed = '0'
|
||||
ORDER BY position ASC, id ASC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user