|
@@ -25,27 +25,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
@Resource
|
|
|
private ReportMapper reportMapper;
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取报告列表
|
|
|
- * 可以基于报告者id 报告种类 报告日期来筛选
|
|
|
- *
|
|
|
- * @param creatorId
|
|
|
- * @param reportType
|
|
|
- * @param startDate
|
|
|
- * @param endDate
|
|
|
- * @return
|
|
|
- */
|
|
|
+ //获取报告列表
|
|
|
@Override
|
|
|
- public HttpRespMsg getReportList(Integer pageIndex, Integer pageSize, Integer creatorId, Integer reportType,
|
|
|
+ public HttpRespMsg getReportList(Integer pageIndex, Integer pageSize, Integer creatorId, Integer projectId,
|
|
|
String startDate, String endDate) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
QueryWrapper<Report> queryWrapper = new QueryWrapper<>();
|
|
|
if (creatorId != null) {
|
|
|
queryWrapper.eq("creator_id", creatorId);
|
|
|
}
|
|
|
- if (reportType != null) {
|
|
|
- queryWrapper.eq("report_type", reportType);
|
|
|
+ if (projectId != null) {
|
|
|
+ queryWrapper.eq("project_id", projectId);
|
|
|
}
|
|
|
if (startDate != null && endDate != null) {
|
|
|
queryWrapper.between("create_date", startDate, endDate);
|
|
@@ -54,35 +44,30 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 基于id修改报告内容
|
|
|
- *
|
|
|
- * @param reportId
|
|
|
- * @param content
|
|
|
- * @return
|
|
|
- */
|
|
|
+ //新增或编辑报告
|
|
|
@Override
|
|
|
- public HttpRespMsg editReport(Integer reportId, String content) {
|
|
|
+ public HttpRespMsg editReport(Report report) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- Report report = reportMapper.selectById(reportId);
|
|
|
- if (report != null) {
|
|
|
- report.setContent(content);
|
|
|
+ if (report.getId() == null) {
|
|
|
+ //新增报告时 需要检查项目和人员id
|
|
|
+ if (report.getCreatorId() == null || report.getProjectId() == null) {
|
|
|
+ httpRespMsg.setError("请填写完整信息");
|
|
|
+ } else {
|
|
|
+ Integer impactedRows = reportMapper.insert(report);
|
|
|
+ if (impactedRows == 0) {
|
|
|
+ httpRespMsg.setError("操作失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
Integer impactedRows = reportMapper.updateById(report);
|
|
|
if (impactedRows == 0) {
|
|
|
httpRespMsg.setError("操作失败");
|
|
|
}
|
|
|
- } else {
|
|
|
- httpRespMsg.setError("未找到相应报告");
|
|
|
}
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 基于id删除报告
|
|
|
- *
|
|
|
- * @param reportId
|
|
|
- * @return
|
|
|
- */
|
|
|
+ //删除报告
|
|
|
@Override
|
|
|
public HttpRespMsg deleteReport(Integer reportId) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|