Merge branch 'master' of https://codeup.aliyun.com/61c0318acd8b75daa5a125f7/medical/openhis
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
package com.openhis.common.utils;
|
package com.openhis.common.utils;
|
||||||
|
|
||||||
import com.openhis.common.enums.HisEnumInterface;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.openhis.common.enums.HisEnumInterface;
|
||||||
|
|
||||||
public class EnumUtils {
|
public class EnumUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,10 +15,7 @@ public class EnumUtils {
|
|||||||
* @return 对应的 info,如果未找到则返回 null
|
* @return 对应的 info,如果未找到则返回 null
|
||||||
*/
|
*/
|
||||||
public static <E extends Enum<E> & HisEnumInterface> String getInfoByValue(Class<E> enumClass, Integer value) {
|
public static <E extends Enum<E> & HisEnumInterface> String getInfoByValue(Class<E> enumClass, Integer value) {
|
||||||
return Arrays.stream(enumClass.getEnumConstants())
|
return Arrays.stream(enumClass.getEnumConstants()).filter(e -> e.getValue().equals(value)).findFirst()
|
||||||
.filter(e -> e.getValue().equals(value))
|
.map(HisEnumInterface::getInfo).orElse(null);
|
||||||
.findFirst()
|
|
||||||
.map(HisEnumInterface::getInfo)
|
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.openhis.common.utils;
|
package com.openhis.common.utils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class HisPageUtils {
|
public class HisPageUtils {
|
||||||
|
|
||||||
@@ -22,8 +23,8 @@ public class HisPageUtils {
|
|||||||
* @param <R> 目标对象类型(DTO 类)
|
* @param <R> 目标对象类型(DTO 类)
|
||||||
* @return 分页结果(目标类型)
|
* @return 分页结果(目标类型)
|
||||||
*/
|
*/
|
||||||
public static <T, R> Page<R> selectPage(BaseMapper<T> mapper, QueryWrapper<T> queryWrapper,
|
public static <T, R> Page<R> selectPage(BaseMapper<T> mapper, QueryWrapper<T> queryWrapper, int pageNo,
|
||||||
int pageNo, int pageSize, Class<R> targetClass) {
|
int pageSize, Class<R> targetClass) {
|
||||||
// 构建分页对象
|
// 构建分页对象
|
||||||
Page<T> page = new Page<>(pageNo, pageSize);
|
Page<T> page = new Page<>(pageNo, pageSize);
|
||||||
// 执行分页查询
|
// 执行分页查询
|
||||||
@@ -47,9 +48,7 @@ public class HisPageUtils {
|
|||||||
* @return 目标对象列表
|
* @return 目标对象列表
|
||||||
*/
|
*/
|
||||||
private static <T, R> List<R> convertToDtoList(List<T> sourceList, Class<R> targetClass) {
|
private static <T, R> List<R> convertToDtoList(List<T> sourceList, Class<R> targetClass) {
|
||||||
return sourceList.stream()
|
return sourceList.stream().map(source -> convertToDto(source, targetClass)).collect(Collectors.toList());
|
||||||
.map(source -> convertToDto(source, targetClass))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user