Commit 893a37bc authored by zhuxiang's avatar zhuxiang
Browse files

当前月只可查看上个月的数据

parent d04dcfd6
...@@ -45,7 +45,7 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re ...@@ -45,7 +45,7 @@ public class ReportDataInfoServiceImpl extends ServiceImpl<ReportDataInfoDao, Re
// 获取当前日期 // 获取当前日期
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
// 获取当前月份(1 到 12) // 获取当前月份(1 到 12)
int currentMonth = now.getMonthValue(); int currentMonth = now.getMonthValue() - 1;
reportDataInfoDTO.setMonth(currentMonth); reportDataInfoDTO.setMonth(currentMonth);
return baseMapper.queryList(reportDataInfoDTO); return baseMapper.queryList(reportDataInfoDTO);
} }
......
...@@ -25,11 +25,14 @@ public class UserPerformanceServiceImpl extends ServiceImpl<UserPerformanceDao, ...@@ -25,11 +25,14 @@ public class UserPerformanceServiceImpl extends ServiceImpl<UserPerformanceDao,
@Override @Override
public List<UserPerformanceVO> queryList(UserPerformanceDTO userPerformanceDTO) { public List<UserPerformanceVO> queryList(UserPerformanceDTO userPerformanceDTO) {
//获取当前年月 //获取当前年月
// 获取当前日期
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
// 获取上个月的日期
LocalDate lastMonth = now.minusMonths(1);
// 格式化为 "yyyy-MM" // 格式化为 "yyyy-MM"
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
String currentYearMonth = now.format(formatter); String lastYearMonth = lastMonth.format(formatter);
userPerformanceDTO.setPerformanceDate(currentYearMonth); userPerformanceDTO.setPerformanceDate(lastYearMonth);
return baseMapper.queryList(userPerformanceDTO); return baseMapper.queryList(userPerformanceDTO);
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment