refactor: 字典重构完成

This commit is contained in:
ray
2024-10-05 23:42:44 +08:00
parent 3f2a5a28df
commit 5d67ab0b62
11 changed files with 711 additions and 671 deletions

View File

@@ -29,12 +29,23 @@ public class Option<T> {
this.children= children;
}
public Option(T value, String label, String tag) {
this.value = value;
this.label = label;
this.tag= tag;
}
@Schema(description="选项的值")
private T value;
@Schema(description="选项的标签")
private String label;
@Schema(description = "标签类型")
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
private String tag;
@Schema(description="子选项列表")
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
private List<Option<T>> children;

View File

@@ -53,4 +53,9 @@ public class DictData extends BaseEntity {
* 备注
*/
private String remark;
/**
* 标签类型
*/
private String tagType;
}

View File

@@ -34,4 +34,7 @@ public class DictDataForm {
@Schema(description = "状态1-启用0-禁用)")
private Integer status;
@Schema(description = "字典类型")
private String tagType;
}

View File

@@ -33,7 +33,7 @@ public class NoticePageVO implements Serializable {
private Integer publishStatus;
@Schema(description = "通知类型")
private String typeLabel;
private Integer type;
@Schema(description = "发布人姓名")
private String publisherName;

View File

@@ -103,7 +103,7 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
return this.list(new LambdaQueryWrapper<DictData>()
.eq(DictData::getDictCode, dictCode)
.eq(DictData::getStatus, 1)
).stream().map(item -> new Option<>(item.getValue(), item.getLabel()))
).stream().map(item -> new Option<>(item.getValue(), item.getLabel(),item.getTagType()))
.toList();
}
}

View File

@@ -188,14 +188,21 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
);
// 添加新的用户通知数据
List<String> targetUserIdList = Arrays.asList(targetUserIds.split(","));
List<String> targetUserIdList = null;
if (NoticeTargetTypeEnum.SPECIFIED.getValue().equals(targetType)) {
targetUserIdList = Arrays.asList(targetUserIds.split(","));
}
List<User> targetUserList = userService.list(
new LambdaQueryWrapper<User>()
// 如果是指定用户,则筛选出指定用户
.in(NoticeTargetTypeEnum.SPECIFIED.getValue().equals(targetType), User::getId, targetUserIdList)
.in(
NoticeTargetTypeEnum.SPECIFIED.getValue().equals(targetType),
User::getId,
targetUserIdList
)
);
List<UserNotice> userNoticeList = targetUserList.stream().map(user -> {
UserNotice userNotice = new UserNotice();
userNotice.setNoticeId(id);