whywhyo
2023-05-03 ab06f7043e4192556c4d9881b0430bcb6cc75f50
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -11,6 +11,8 @@
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfRelation;
import com.ruoyi.domain.dto.EmpowerDto;
import com.ruoyi.service.ZInfoUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -18,8 +20,10 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.websocket.server.PathParam;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
@@ -98,7 +102,6 @@
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        return AjaxResult.success(zInfoUserService.getById(userId));
    }
//
@@ -109,6 +112,9 @@
    @Log(title = "个人详细信息记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZInfoUser zInfoUser) {
        if (!Pattern.matches("^[\\d]+(?:,[\\d]+)*$",zInfoUser.getFamilyId())) {
            throw new RuntimeException("请输入只有数字和英文逗号的字符串,且数字和逗号必须交替出现");
        }
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        zInfoUser.setUserId(userId);
@@ -143,7 +149,6 @@
    /**
     * 查询家庭主要成员及关系
     */
    @GetMapping("/relation")
    public AjaxResult listMyRelation() {
        SysUser user = SecurityUtils.getLoginUser().getUser();
@@ -151,6 +156,63 @@
        return zInfoUserService.searchMyRelation(userId);
    }
    @PostMapping("/relation")
    public AjaxResult addRelation(@RequestBody ZfRelation zfRelation){
        return zInfoUserService.addRelation(zfRelation);
    }
    @PutMapping("/relation")
    public AjaxResult updateRelation(@RequestBody ZfRelation zfRelation){
        return zInfoUserService.updateRelation(zfRelation);
    }
    @DeleteMapping("/relation/{ids}")
    public AjaxResult deleteRelation(@PathVariable Long[] ids){
        return zInfoUserService.deleteRelation(ids);
    }
    /**
     * 授权
     */
    @PostMapping("/empower")
    public AjaxResult empower(@RequestBody EmpowerDto empowerDto){
        return zInfoUserService.empower(empowerDto);
    }
    /**
     * 家根网
     */
    @GetMapping("/root")
    public AjaxResult listAllPeopleWithTree(){
        return zInfoUserService.listWithTree();
    }
    /**
     * 找到所有的成员
     */
    @GetMapping("/all")
    public AjaxResult listAllPeople(){
        return zInfoUserService.listAllExceptAdmin();
    }
    /**
     * 新增、修改父子关系
     */
    @PutMapping("/setParent")
    public AjaxResult addParent(@PathParam("fatherId")Long fatherId,@PathParam("motherId")Long motherId){
        return zInfoUserService.addParent(fatherId,motherId);
    }
}