whywhyo
2023-08-09 ab24e68f152f9031a5ddfe4be7e82a5c84eb7476
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.ruoyi.web.controller.zhang;
 
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.dto.UserInfoDto;
import com.ruoyi.service.ZfFamilyService;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
/**
 * @Author Jinquan_Ou
 * @Description
 * @Date 2023-07-14 14:43
 * @Version 1.0.0
 **/
 
@RestController
@RequestMapping("/family")
public class ZfFamilyController {
    @Resource
    ZfFamilyService zfFamilyService;
 
    @GetMapping("/all")
    public AjaxResult getAllFamily(){
        return AjaxResult.success(zfFamilyService.list());
    }
 
    /**
     * 根据家庭id查询家庭成员
     */
    @GetMapping("/{fid}")
    public AjaxResult getByFamilyId(@PathVariable Long fid){
        return AjaxResult.success(zfFamilyService.getByFamilyId(fid));
    }
 
    /**
     * 查看当前用户当前家庭的家庭成员
     */
 
    @GetMapping("/now")
    public AjaxResult getNowMember(){
        return AjaxResult.success(zfFamilyService.getNowMember());
    }
 
    /**
     * 新增家庭成员
     */
    @PostMapping()
    public AjaxResult addFamilyMember(@RequestBody UserInfoDto userInfoDto){
        return zfFamilyService.addMember(userInfoDto);
 
    }
 
    /**
     * 删除家庭成员
     */
 
    @DeleteMapping()
    public AjaxResult removeFamilyMember(@RequestBody UserInfoDto userInfoDto){
        return zfFamilyService.removeMember(userInfoDto);
    }
 
 
 
 
}