|
@@ -1,14 +1,18 @@
|
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.management.platform.entity.Report;
|
|
|
import com.management.platform.mapper.ReportMapper;
|
|
|
import com.management.platform.service.ReportService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.management.platform.util.HttpRespMsg;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author 吴涛涛
|
|
@@ -17,4 +21,61 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements ReportService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ReportMapper reportMapper;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取报告列表
|
|
|
+ * 可以基于报告者id 报告种类 报告日期来筛选
|
|
|
+ * @param creatorId
|
|
|
+ * @param reportType
|
|
|
+ * @param startDate
|
|
|
+ * @param end
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getReportList(Integer creatorId, Integer reportType, String startDate, String end) {
|
|
|
+ //以上筛选目前都没卵用
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ httpRespMsg.data = reportMapper.selectList(new QueryWrapper<>());
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 基于id修改报告内容
|
|
|
+ * @param reportId
|
|
|
+ * @param content
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg editReport(Integer reportId, String content) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ Report report = reportMapper.selectById(reportId);
|
|
|
+ if (report != null) {
|
|
|
+ report.setContent(content);
|
|
|
+ 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();
|
|
|
+ Integer impactedRows = reportMapper.deleteById(reportId);
|
|
|
+ if (impactedRows == 0) {
|
|
|
+ httpRespMsg.setError("操作失败");
|
|
|
+ }
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
}
|