liujie
2025-11-10 9523c03faedd6138a1ecc84af5f23a8a2d6f60b0
小程序接口
2个文件已添加
120 ■■■■■ 已修改文件
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/ChildcareController.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/PensionController.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/ChildcareController.java
New file
@@ -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("添加失败");
    }
}
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/PensionController.java
New file
@@ -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("添加失败");
    }
}