refactor: 优化部分代码
This commit is contained in:
parent
d5138e1e43
commit
883dbecb1b
@ -57,4 +57,9 @@ public class SysConsts {
|
|||||||
* 退出登录 URI
|
* 退出登录 URI
|
||||||
*/
|
*/
|
||||||
public static final String LOGOUT_URI = "/auth/logout";
|
public static final String LOGOUT_URI = "/auth/logout";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VO 描述类字段后缀
|
||||||
|
*/
|
||||||
|
public static final String VO_DESCRIPTION_FIELD_SUFFIX = "String";
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,9 @@ public class LogServiceImpl implements LogService {
|
|||||||
|
|
||||||
// 限定查询信息
|
// 限定查询信息
|
||||||
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogVO.class);
|
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogVO.class);
|
||||||
List<String> columnNameList = fieldNameList.stream().map(StrUtil::toUnderlineCase)
|
List<String> columnNameList =
|
||||||
.filter(n -> !n.endsWith("string")).collect(Collectors.toList());
|
fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.VO_DESCRIPTION_FIELD_SUFFIX))
|
||||||
|
.map(StrUtil::toUnderlineCase).collect(Collectors.toList());
|
||||||
queryWrapper.select(columnNameList);
|
queryWrapper.select(columnNameList);
|
||||||
|
|
||||||
// 分页查询
|
// 分页查询
|
||||||
@ -100,8 +101,9 @@ public class LogServiceImpl implements LogService {
|
|||||||
|
|
||||||
// 限定查询信息
|
// 限定查询信息
|
||||||
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogVO.class);
|
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogVO.class);
|
||||||
List<String> columnNameList = fieldNameList.stream().map(StrUtil::toUnderlineCase)
|
List<String> columnNameList =
|
||||||
.filter(n -> !n.endsWith("string")).collect(Collectors.toList());
|
fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.VO_DESCRIPTION_FIELD_SUFFIX))
|
||||||
|
.map(StrUtil::toUnderlineCase).collect(Collectors.toList());
|
||||||
queryWrapper.select(columnNameList);
|
queryWrapper.select(columnNameList);
|
||||||
|
|
||||||
// 分页查询
|
// 分页查询
|
||||||
@ -119,8 +121,9 @@ public class LogServiceImpl implements LogService {
|
|||||||
|
|
||||||
// 限定查询信息
|
// 限定查询信息
|
||||||
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogVO.class);
|
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogVO.class);
|
||||||
List<String> columnNameList = fieldNameList.stream().map(StrUtil::toUnderlineCase)
|
List<String> columnNameList =
|
||||||
.filter(n -> !n.endsWith("string")).collect(Collectors.toList());
|
fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.VO_DESCRIPTION_FIELD_SUFFIX))
|
||||||
|
.map(StrUtil::toUnderlineCase).collect(Collectors.toList());
|
||||||
queryWrapper.select(columnNameList);
|
queryWrapper.select(columnNameList);
|
||||||
|
|
||||||
// 分页查询
|
// 分页查询
|
||||||
|
@ -101,7 +101,6 @@ public class UserInfoVO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@Schema(description = "创建时间", example = "2023-08-08 08:08:08", type = "string")
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ -62,22 +62,18 @@ public class AnnouncementVO extends BaseVO {
|
|||||||
private LocalDateTime terminateTime;
|
private LocalDateTime terminateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态(1:待发布,2:已发布,3:已过期)
|
||||||
*
|
*
|
||||||
* @return 公告状态
|
* @return 公告状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "状态(1:待发布,2:已发布,3:已过期)", example = "1")
|
@Schema(description = "状态(1:待发布,2:已发布,3:已过期)", example = "1")
|
||||||
public Integer getStatus() {
|
public Integer getStatus() {
|
||||||
int status = 2;
|
int status = 2;
|
||||||
if (null != this.effectiveTime) {
|
if (null != this.effectiveTime && this.effectiveTime.isAfter(LocalDateTime.now())) {
|
||||||
if (this.effectiveTime.isAfter(LocalDateTime.now())) {
|
status = 1;
|
||||||
status = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (null != this.terminateTime) {
|
if (null != this.terminateTime && this.terminateTime.isBefore(LocalDateTime.now())) {
|
||||||
if (this.terminateTime.isBefore(LocalDateTime.now())) {
|
status = 3;
|
||||||
status = 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user