add: 习惯curd

This commit is contained in:
kkunkka
2025-10-10 15:58:20 +08:00
parent 82e1f2deb4
commit 8a120a7223
3 changed files with 22 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package com.dota.nexus.controller;
import com.dota.nexus.entity.HabitRecord;
import com.dota.nexus.entity.R;
import com.dota.nexus.service.HabitRecordService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -16,6 +17,14 @@ public class HabitRecordController {
this.habitRecordService = habitRecordService;
}
/**
* 根据目标id查询习惯记录
*/
@GetMapping
public R getHabitRecords(Integer id) {
return R.ok(habitRecordService.getHabitRecordsByGoalId(id));
}
@PostMapping()
public R addHabitRecord(Integer id) {
var habit = new HabitRecord();