|
@@ -0,0 +1,83 @@
|
|
|
|
|
+package cn.iocoder.yudao.module.system.controller.admin.home;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeElderlyInfoPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeElderlyInfoPageRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.home.vo.HomeElderlyInfoSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.home.HomeElderlyInfoDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.service.home.HomeElderlyInfoService;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
+
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 居家长者信息")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/home/elderly-info")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class HomeElderlyInfoController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private HomeElderlyInfoService homeElderlyInfoService;
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
|
+ @Operation(summary = "获得居家长者信息分页")
|
|
|
|
|
+ @TenantIgnore
|
|
|
|
|
+ public CommonResult<PageResult<HomeElderlyInfoPageRespVO>> page(@Valid HomeElderlyInfoPageReqVO pageReqVO) {
|
|
|
|
|
+ if (pageReqVO.getTenantId() == null) {
|
|
|
|
|
+ pageReqVO.setTenantId(TenantContextHolder.getTenantId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (pageReqVO.getTenantIds() == null) {
|
|
|
|
|
+ pageReqVO.setTenantIds(new Long[]{TenantContextHolder.getTenantId()});
|
|
|
|
|
+ }
|
|
|
|
|
+ PageResult<HomeElderlyInfoPageRespVO> pageResult = homeElderlyInfoService.getHomeElderlyInfoPage(pageReqVO);
|
|
|
|
|
+ return success(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
|
+ @Operation(summary = "新增居家长者信息")
|
|
|
|
|
+ @TenantIgnore
|
|
|
|
|
+ public CommonResult<Long> create(@Valid @RequestBody HomeElderlyInfoSaveReqVO createReqVO) {
|
|
|
|
|
+ if (createReqVO.getTenantId() == null) {
|
|
|
|
|
+ createReqVO.setTenantId(TenantContextHolder.getTenantId());
|
|
|
|
|
+ }
|
|
|
|
|
+ return success(homeElderlyInfoService.createHomeElderlyInfo(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
|
+ @Operation(summary = "修改居家长者信息")
|
|
|
|
|
+ @TenantIgnore
|
|
|
|
|
+ public CommonResult<Boolean> update(@Valid @RequestBody HomeElderlyInfoSaveReqVO updateReqVO) {
|
|
|
|
|
+ if (updateReqVO.getTenantId() == null) {
|
|
|
|
|
+ updateReqVO.setTenantId(TenantContextHolder.getTenantId());
|
|
|
|
|
+ }
|
|
|
|
|
+ homeElderlyInfoService.updateHomeElderlyInfo(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
|
+ @Operation(summary = "删除居家长者信息")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1")
|
|
|
|
|
+ @TenantIgnore
|
|
|
|
|
+ public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
|
|
|
|
|
+ homeElderlyInfoService.deleteHomeElderlyInfo(id);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @Operation(summary = "获得居家长者信息详情")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1")
|
|
|
|
|
+ @TenantIgnore
|
|
|
|
|
+ public CommonResult<HomeElderlyInfoDO> get(@RequestParam("id") Long id) {
|
|
|
|
|
+ return success(homeElderlyInfoService.getHomeElderlyInfo(id));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|