1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

小程序端添加 删除今日填表

This commit is contained in:
2023-04-17 23:35:39 +08:00
parent 918917868f
commit 7a425c6241
8 changed files with 143 additions and 39 deletions

View File

@@ -109,6 +109,26 @@ public class ReportController {
return Res.success(records);
}
/**
* 删除最近一次用户填报信息
*
* @param userId
* @return
*/
@PostMapping("/withdraw")
@ResponseBody
public Res withdrawLatestRecord(@RequestParam("userId") Integer userId) {
User user = userService.getUserById(userId);
if (user == null) {
return Res.error("用户不存在");
}
Report records = reportService.getLatestRecordByUserId(user.getId());
if (records != null) {
reportService.removeRecord(records.getId());
}
return Res.success(records);
}
/**
* 获取体温数据列表

View File

@@ -17,4 +17,6 @@ public interface ReportDao {
Report getLatestReportByUserId(Integer userId);
public List<Report> getReportList(ReportQuery reportQuery);
public void remove(Integer id);
}

View File

@@ -3,7 +3,6 @@ package com.cxyxiaomo.epp.access.service;
import com.cxyxiaomo.epp.access.dao.ReportDao;
import com.cxyxiaomo.epp.common.pojo.Report;
import com.cxyxiaomo.epp.common.query.ReportQuery;
import com.cxyxiaomo.epp.common.vo.ReportVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,6 +19,12 @@ public class ReportServiceImpl implements ReportService {
reportDao.insert(report);
}
public void removeRecord(Integer id) {
if (id != null) {
reportDao.remove(id);
}
}
@Override
public List<Report> getRecordListByUserId(Integer userId) {
return reportDao.getReportListByUserId(userId);

View File

@@ -47,4 +47,9 @@
</if>
ORDER BY time desc
</select>
<delete id="remove">
DELETE
FROM report
WHERE id = #{id}
</delete>
</mapper>