Skip to content

Commit

Permalink
style: 优化部分代码格式
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Nov 5, 2023
1 parent 7b741d5 commit 2f87310
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void insertFill(MetaObject metaObject) {

Long createUser = LoginHelper.getUserId();
LocalDateTime createTime = LocalDateTime.now();
if (metaObject.getOriginalObject()instanceof BaseDO baseDO) {
if (metaObject.getOriginalObject() instanceof BaseDO baseDO) {
// 继承了 BaseDO 的类,填充创建信息
baseDO.setCreateUser(ObjectUtil.defaultIfNull(baseDO.getCreateUser(), createUser));
baseDO.setCreateTime(ObjectUtil.defaultIfNull(baseDO.getCreateTime(), createTime));
Expand Down Expand Up @@ -89,7 +89,7 @@ public void updateFill(MetaObject metaObject) {

Long updateUser = LoginHelper.getUserId();
LocalDateTime updateTime = LocalDateTime.now();
if (metaObject.getOriginalObject()instanceof BaseDO baseDO) {
if (metaObject.getOriginalObject() instanceof BaseDO baseDO) {
// 继承了 BaseDO 的类,填充修改信息
baseDO.setUpdateUser(updateUser);
baseDO.setUpdateTime(updateTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import lombok.RequiredArgsConstructor;

Expand Down Expand Up @@ -91,8 +90,7 @@ public DashboardGeoDistributionResp getGeoDistribution() {
List<Map<String, Object>> locationIpStatistics = logService.listDashboardGeoDistribution();
DashboardGeoDistributionResp geoDistribution = new DashboardGeoDistributionResp();
geoDistribution.setLocationIpStatistics(locationIpStatistics);
geoDistribution.setLocations(
locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).collect(Collectors.toList()));
geoDistribution.setLocations(locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).toList());
return geoDistribution;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ public PageDataResp<SystemLogResp> page(SystemLogQuery query, PageQuery pageQuer
public SystemLogDetailResp get(Long id) {
LogDO logDO = logMapper.selectById(id);
CheckUtils.throwIfNotExists(logDO, "LogDO", "ID", id);

SystemLogDetailResp detailVO = BeanUtil.copyProperties(logDO, SystemLogDetailResp.class);
this.fill(detailVO);
return detailVO;
SystemLogDetailResp detail = BeanUtil.copyProperties(logDO, SystemLogDetailResp.class);
this.fill(detail);
return detail;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void update(DeptReq req, Long id) {
String oldName = oldDept.getName();
DisEnableStatusEnum newStatus = req.getStatus();
Long oldParentId = oldDept.getParentId();
if (oldDept.getIsSystem()) {
if (Boolean.TRUE.equals(oldDept.getIsSystem())) {
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置部门,不允许禁用", oldName);
CheckUtils.throwIfNotEqual(req.getParentId(), oldParentId, "[{}] 是系统内置部门,不允许变更上级部门", oldName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void update(RoleReq req, Long id) {
RoleDO oldRole = super.getById(id);
DataScopeEnum oldDataScope = oldRole.getDataScope();
String oldCode = oldRole.getCode();
if (oldRole.getIsSystem()) {
if (Boolean.TRUE.equals(oldRole.getIsSystem())) {
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, req.getStatus(), "[{}] 是系统内置角色,不允许禁用",
oldRole.getName());
CheckUtils.throwIfNotEqual(req.getCode(), oldCode, "[{}] 是系统内置角色,不允许修改角色编码", oldRole.getName());
Expand Down Expand Up @@ -152,7 +152,7 @@ public List<LabelValueResp<Long>> buildDict(List<RoleResp> list) {
if (CollUtil.isEmpty(list)) {
return new ArrayList<>(0);
}
return list.stream().map(r -> new LabelValueResp<>(r.getName(), r.getId())).collect(Collectors.toList());
return list.stream().map(r -> new LabelValueResp<>(r.getName(), r.getId())).toList();
}

@Override
Expand Down

0 comments on commit 2f87310

Please sign in to comment.