Merge branch 'feature/noticews'
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.youlai.boot.common.enums;
|
||||
|
||||
import com.youlai.boot.common.base.IBaseEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 通知类型枚举
|
||||
* 0-系统消息
|
||||
*
|
||||
* @since 2024-9-1 17:33:06
|
||||
* @author Theo
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum NoticeTypeEnum implements IBaseEnum<Integer> {
|
||||
|
||||
/**
|
||||
* 通知类型
|
||||
*/
|
||||
SYSTEM_MESSAGE(0, "系统消息");
|
||||
|
||||
@Getter
|
||||
private Integer value;
|
||||
|
||||
@Getter
|
||||
private String label;
|
||||
|
||||
NoticeTypeEnum(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.youlai.boot.common.enums;
|
||||
|
||||
import com.youlai.boot.common.base.IBaseEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 通知方式枚举
|
||||
* @author Theo
|
||||
* @since 2024-9-2 14:32:58
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum NoticeWayEnum implements IBaseEnum<String> {
|
||||
/**
|
||||
* 通知方式
|
||||
*/
|
||||
WEBSOCKET("webSocket", "发送websocket消息");
|
||||
|
||||
@Getter
|
||||
private String value;
|
||||
|
||||
@Getter
|
||||
private String label;
|
||||
|
||||
NoticeWayEnum(String value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class PageResult<T> implements Serializable {
|
||||
PageResult<T> result = new PageResult<>();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
|
||||
Data data = new Data<T>();
|
||||
Data<T> data = new Data<>();
|
||||
data.setList(page.getRecords());
|
||||
data.setTotal(page.getTotal());
|
||||
|
||||
|
||||
67
src/main/java/com/youlai/boot/common/util/CommonUtil.java
Normal file
67
src/main/java/com/youlai/boot/common/util/CommonUtil.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.youlai.boot.common.util;
|
||||
|
||||
import com.youlai.boot.common.constant.SymbolConstant;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-9-1 23:42:33
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class CommonUtil {
|
||||
|
||||
private CommonUtil(){}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将List转换为字符串
|
||||
*
|
||||
* @param list List
|
||||
* @param separator 分隔符
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String listToStr(List<String> list, String separator) {
|
||||
return list.stream().collect(Collectors.joining(separator));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转换为List
|
||||
*
|
||||
* @param list List
|
||||
* @return List
|
||||
*/
|
||||
public static String listToStr(List<String> list) {
|
||||
return listToStr(list, SymbolConstant.COMMA);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转换为List
|
||||
*
|
||||
* @param str 字符串
|
||||
* @return List
|
||||
*/
|
||||
public static List<String> strToList(String str) {
|
||||
return strToList(str, SymbolConstant.COMMA);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转换为List
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param separator 分隔符
|
||||
* @return List
|
||||
*/
|
||||
public static List<String> strToList(String str, String separator) {
|
||||
return List.of(str.split(separator));
|
||||
}
|
||||
|
||||
|
||||
public static String delHtmlTags(String htmlStr) {
|
||||
return htmlStr.replaceAll("<[^>]+>", "");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user