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);

View File

@@ -10,8 +10,8 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/youlai_boot?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
username: root
url: jdbc:mysql://www.youlai.tech:3306/youlai_boot?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
username: youlai
password: 123456
data:
redis:

View File

@@ -14,14 +14,10 @@
t1.publish_status,
t1.publish_time,
t1.revoke_time,
t3.name typeLabel,
t4.name levelLabel,
t1.create_time
FROM
sys_notice t1
LEFT JOIN sys_user t2 ON t2.id = t1.publisher_id
LEFT JOIN sys_dict_data t3 ON t1.type = t3.value AND t3.dict_code = 'notice_type'
LEFT JOIN sys_dict_data t4 ON t1.level = t4.value AND t4.dict_code = 'notice_level'
WHERE
t1.is_deleted = 0
<if test="queryParams.title != null and queryParams.title != ''">

View File

@@ -7,9 +7,7 @@
SELECT
t2.id,
t2.title,
t4.name typeLabel,
t3.nickname publisherName,
t5.name levelLabel,
t2.publish_time,
t1.is_read,
t2.level
@@ -17,8 +15,6 @@
sys_user_notice t1
INNER JOIN sys_notice t2 ON t1.notice_id = t2.id AND t2.publish_status = 1
LEFT JOIN sys_user t3 ON t2.publisher_id = t3.id
LEFT JOIN sys_dict_data t4 ON t2.type = t4.value AND t4.dict_code = 'notice_type'
LEFT JOIN sys_dict_data t5 ON t2.level = t5.value AND t5.dict_code = 'notice_level'
WHERE
t1.user_id = #{queryParams.userId} AND t1.is_deleted = 0 AND t2.is_deleted = 0
<if test="queryParams.title != null and queryParams.title != ''">