From 9523c03faedd6138a1ecc84af5f23a8a2d6f60b0 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 10 十一月 2025 09:57:56 +0800
Subject: [PATCH] 小程序接口
---
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/PensionController.java | 75 +++++++++++++++++++++++++++++++++++++
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/ChildcareController.java | 45 ++++++++++++++++++++++
2 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/ChildcareController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/ChildcareController.java
new file mode 100644
index 0000000..2e77394
--- /dev/null
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/ChildcareController.java
@@ -0,0 +1,45 @@
+package com.ruoyi.web.controller.api;
+
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.model.TChildcareServices;
+import com.ruoyi.system.service.TChildcareServicesService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+@RequestMapping("/childcare")
+@Api(tags = "托育模块")
+public class ChildcareController {
+
+ private final TChildcareServicesService childcareServicesService;
+ private final TokenService tokenService;
+
+
+ public ChildcareController(TChildcareServicesService childcareServicesService, TokenService tokenService) {
+ this.childcareServicesService = childcareServicesService;
+ this.tokenService = tokenService;
+ }
+
+
+
+ // 添加托育模块
+ @PostMapping("/addChildcare")
+ @ApiOperation(value = "添加托育服务")
+ public R<String> addChildcare(@RequestBody TChildcareServices tChildcareServices) {
+ String userId = tokenService.getLoginUserApplet().getUserId();
+ tChildcareServices.setAppUserId(userId);
+ boolean save = childcareServicesService.save(tChildcareServices);
+ if (save) {
+ return R.ok("添加成功");
+ }
+ return R.fail("添加失败");
+ }
+
+}
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/PensionController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/PensionController.java
new file mode 100644
index 0000000..e2d3fee
--- /dev/null
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/PensionController.java
@@ -0,0 +1,75 @@
+package com.ruoyi.web.controller.api;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.BaseModel;
+import com.ruoyi.common.core.domain.BasePage;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.model.TAssistedDining;
+import com.ruoyi.system.model.THelpNeeds;
+import com.ruoyi.system.model.TPartyBuilding;
+import com.ruoyi.system.query.AssistedDiningListQuery;
+import com.ruoyi.system.service.TAssistedDiningService;
+import com.ruoyi.system.service.THelpNeedsService;
+import com.ruoyi.system.service.TPartyBuildingService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+@Slf4j
+@RestController
+@RequestMapping("/pension")
+@Api(tags = "养老服务")
+public class PensionController {
+
+ private final TAssistedDiningService tAssistedDiningService;
+ private final THelpNeedsService tHelpNeedsService;
+ private final TokenService tokenService;
+
+ public PensionController(TAssistedDiningService tAssistedDiningService, THelpNeedsService tHelpNeedsService, TokenService tokenService) {
+ this.tAssistedDiningService = tAssistedDiningService;
+ this.tHelpNeedsService = tHelpNeedsService;
+ this.tokenService = tokenService;
+ }
+
+
+ @PostMapping("/getAssistedDiningList")
+ @ApiOperation(value = "养老服务--助餐",response = TAssistedDining.class)
+ public R<PageInfo<TAssistedDining>> getAssistedDiningList(@RequestBody AssistedDiningListQuery query) {
+ PageInfo<TAssistedDining> pageInfo = tAssistedDiningService.pageList(query);
+ return R.ok(pageInfo);
+ }
+
+ @PostMapping("/getAssistedDiningDetail/{id}")
+ @ApiOperation(value = "养老服务--助餐详情")
+ public R<TAssistedDining> getAssistedDiningDetail(@PathVariable String id) {
+ TAssistedDining tAssistedDining = tAssistedDiningService.getById(id);
+ return R.ok(tAssistedDining);
+ }
+
+
+
+ @PostMapping("/getHelpNeedsList")
+ @ApiOperation(value = "养老服务--助需",response = TPartyBuilding.class)
+ public R<Page<THelpNeeds>> getHelpNeedsList(@RequestBody BasePage basePage) {
+ String userId = tokenService.getLoginUserApplet().getUserId();
+ Page<THelpNeeds> page = new Page<>(basePage.getPageNum(), basePage.getPageSize());
+ Page<THelpNeeds> helpNeedsPage = tHelpNeedsService.page(page, Wrappers.<THelpNeeds>lambdaQuery().eq(THelpNeeds::getAppUserId, userId).orderByDesc(BaseModel::getCreateTime));
+ return R.ok(helpNeedsPage);
+ }
+
+ @PostMapping("/addHelpNeeds")
+ @ApiOperation(value = "养老服务--添加助需")
+ public R<String> addHelpNeeds(@RequestBody THelpNeeds tHelpNeeds) {
+ String userId = tokenService.getLoginUserApplet().getUserId();
+ tHelpNeeds.setAppUserId(userId);
+ boolean save = tHelpNeedsService.save(tHelpNeeds);
+ if (save) {
+ return R.ok("添加成功");
+ }
+ return R.fail("添加失败");
+ }
+}
--
Gitblit v1.7.1