add: 周年纪念日

This commit is contained in:
jsh
2025-10-11 16:18:18 +08:00
parent 8a120a7223
commit ef224aa546
10 changed files with 136 additions and 14 deletions

View File

@@ -0,0 +1,34 @@
package com.dota.nexus.controller;
import com.dota.nexus.entity.Anniversary;
import com.dota.nexus.entity.R;
import com.dota.nexus.service.AnniversaryService;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("anniversary")
public class AnniversaryController {
AnniversaryService anniversaryService;
public AnniversaryController(AnniversaryService anniversaryService) {
this.anniversaryService = anniversaryService;
}
@PostMapping
public R add(Anniversary anniversary) {
anniversaryService.save(anniversary);
return R.ok();
}
@DeleteMapping
public R del(Integer id) {
anniversaryService.removeById(id);
return R.ok();
}
@PutMapping
public R update(Anniversary anniversary) {
anniversaryService.saveOrUpdate(anniversary);
return R.ok();
}
}

View File

@@ -3,12 +3,10 @@ package com.dota.nexus.controller;
import com.dota.nexus.entity.Goal;
import com.dota.nexus.entity.R;
import com.dota.nexus.service.GoalService;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController("goal")
@RestController
@RequestMapping("goal")
public class GoalController {
GoalService goalService;
@@ -19,7 +17,7 @@ public class GoalController {
/**
* 新增目标
*/
@GetMapping
@PostMapping
public R addGoal(Goal goal) {
goalService.save(goal);
return R.ok();

View File

@@ -5,11 +5,13 @@ 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
@RestController("habit_record")
@RestController
@RequestMapping("habit")
public class HabitRecordController {
HabitRecordService habitRecordService;
@@ -25,7 +27,7 @@ public class HabitRecordController {
return R.ok(habitRecordService.getHabitRecordsByGoalId(id));
}
@PostMapping()
@PostMapping
public R addHabitRecord(Integer id) {
var habit = new HabitRecord();
habit.setCreateTime(LocalDateTime.now());