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("添加失败");
|
}
|
|
}
|