小程序端添加 删除今日填表
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取体温数据列表
|
||||
|
@@ -17,4 +17,6 @@ public interface ReportDao {
|
||||
Report getLatestReportByUserId(Integer userId);
|
||||
|
||||
public List<Report> getReportList(ReportQuery reportQuery);
|
||||
|
||||
public void remove(Integer id);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -47,4 +47,9 @@
|
||||
</if>
|
||||
ORDER BY time desc
|
||||
</select>
|
||||
<delete id="remove">
|
||||
DELETE
|
||||
FROM report
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user