liujie
2025-12-12 17b8fad8bbf13dd6f6e2c1e300856c52dce4f3ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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("添加失败");
    }
 
}