parent
5c22d78daf
commit
2dda758b7e
@ -0,0 +1,53 @@ |
||||
package digital.laboratory.platform.inspection.convert; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import digital.laboratory.platform.inspection.entity.TestRecordReagent; |
||||
import digital.laboratory.platform.inspection.vo.TestRecordReagentVO; |
||||
|
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author ChenJiangBao |
||||
* @version 1.0 |
||||
* @description: 实验中用到的试剂耗材 的转换类 |
||||
* @date 2025/3/20 14:59 |
||||
*/ |
||||
public class TestRecordReagentConvert { |
||||
|
||||
/** |
||||
* 实体类转vo类 |
||||
*/ |
||||
public static TestRecordReagentVO entityToVOPage(TestRecordReagent entity) { |
||||
if (entity == null) return null; |
||||
TestRecordReagentVO testRecordReagentVO = new TestRecordReagentVO(); |
||||
testRecordReagentVO.setId(entity.getId()); |
||||
testRecordReagentVO.setDrugId(entity.getDrugId()); |
||||
testRecordReagentVO.setReagentConsumableName(entity.getReagentConsumableName()); |
||||
testRecordReagentVO.setCategory(entity.getCategory()); |
||||
testRecordReagentVO.setSpecifications(entity.getSpecifications()); |
||||
testRecordReagentVO.setPurityGrade(entity.getPurityGrade()); |
||||
testRecordReagentVO.setNumber(entity.getNumber()); |
||||
testRecordReagentVO.setSortIndex(entity.getSortIndex()); |
||||
testRecordReagentVO.setSource(entity.getSource()); |
||||
return testRecordReagentVO; |
||||
} |
||||
|
||||
/** |
||||
* 实体分页对象转 VO 分页对象 |
||||
*/ |
||||
public static IPage<TestRecordReagentVO> entityToVOPage(IPage<TestRecordReagent> entityPage) { |
||||
// 创建 VO 的分页对象
|
||||
IPage<TestRecordReagentVO> voPage = new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal()); |
||||
|
||||
// 将实体列表转换为 VO 列表
|
||||
List<TestRecordReagentVO> voList = entityPage.getRecords().stream() |
||||
.map(TestRecordReagentConvert::entityToVOPage) |
||||
.collect(Collectors.toList()); |
||||
|
||||
// 设置转换后的记录
|
||||
voPage.setRecords(voList); |
||||
return voPage; |
||||
} |
||||
} |
@ -0,0 +1,52 @@ |
||||
package digital.laboratory.platform.inspection.vo; |
||||
|
||||
import com.lcsoft.dlp.common.aop.annotation.DlpFeign; |
||||
import digital.laboratory.platform.sys.entity.Drug; |
||||
import digital.laboratory.platform.sys.feign.RemoteCommDrugService; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author xy |
||||
* @version 1.0 |
||||
* @title TestRecordReagent |
||||
* @description 实验中用到的试剂耗材VO |
||||
* @create 2023/12/20 11:02 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "实验中用到的试剂耗材VO", description = "实验中用到的试剂耗材VO") |
||||
public class TestRecordReagentVO { |
||||
|
||||
@ApiModelProperty(value = "主键ID") |
||||
private String id; |
||||
|
||||
@ApiModelProperty(value = "标准品的成分,关联的毒品清单中的毒品ID") |
||||
private String drugId; |
||||
|
||||
@ApiModelProperty(value = "试剂耗材或标准物质名称") |
||||
private String reagentConsumableName; |
||||
|
||||
@ApiModelProperty(value = "类别,表示是试剂、耗材,还是标准物质") |
||||
private String category; |
||||
|
||||
@ApiModelProperty(value = "型号规格") |
||||
private String specifications; |
||||
|
||||
@ApiModelProperty(value = "纯度等级,仅适用于试剂,耗材时为空") |
||||
private String purityGrade; |
||||
|
||||
@ApiModelProperty(value = "标准物质编号,仅当类别为标准物质时设置") |
||||
private String number; |
||||
|
||||
@ApiModelProperty(value = "排序索引") |
||||
private Integer sortIndex; |
||||
|
||||
@ApiModelProperty(value = "数据来源") |
||||
private Integer source; |
||||
|
||||
@ApiModelProperty(value = "关联的毒品实体信息") |
||||
@DlpFeign(feignClient = RemoteCommDrugService.class, methodName = "getById", params = {"drugId"}) |
||||
private Drug drug; |
||||
} |
||||
|
Loading…
Reference in new issue