zqy
2025-01-07 6cc2e27994e273bb470eaa570e84596b4b0aec93
数据共享,暂时只写了个人记事本
9个文件已修改
6个文件已添加
1个文件已删除
530 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ShareOtherClan.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfShareData.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfShareOther.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/mapper/ZfShareDataMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -193,7 +193,7 @@
        //System.out.println(sysUserRole.getRoleId());
        System.out.println("你好呀");
        System.out.println(user.getRoleId());
        if (user.getRoleId().equals(102L)){
        if (user.getRoleId() != null && user.getRoleId().equals(102L)){
        ZInfoUser infoUser = new ZInfoUser();
        infoUser.setUserId(user.getUserId());
        infoUser.setOldName(user.getUserName());
@@ -201,7 +201,7 @@
        infoUser.setIsMyFamily(user.getIsMyFamily());
        infoUser.setMomId(user.getMid());
        infoUser.setFatherId(user.getFid());
        infoUser.setSex(Integer.valueOf(user.getSex()));
        if (user.getSex() != null)infoUser.setSex(Integer.valueOf(user.getSex()));
//        infoUser.setFamilyId(user.getFamilyId());
        infoUser.setSysId(user.getSysId());
@@ -261,11 +261,11 @@
        }
        if(infoUser.getFamilyId()!=null)
        if(infoUser.getIsMyFamily() == 1)
            zInfoUserService.saveOrUpdate(infoUser);
        else {
            System.out.println("家庭成员不能修改为普通用户");
            return AjaxResult.success("家庭成员不能修改为普通用户");
            return AjaxResult.error("家庭成员不能修改为普通用户");
        }
        //更新配偶信息
        if(user.getSpouseId()!=null) {
@@ -306,7 +306,7 @@
        }
        else {
            System.out.println("daniuni");
            return AjaxResult.success("家庭成员不能修改为普通用户");
            return AjaxResult.error("家庭成员不能修改为普通用户");
        }
      //  zInfoUserService.update(infoUser);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -421,9 +421,16 @@
     * 分享给其他家族数据,通过输入名字查找所有的同名用户和家族号
    */
    @PostMapping("/byName")
    public AjaxResult listByNickNameDate(@RequestBody ZInfoUser zInfoUser)
    public AjaxResult listByUserNameDate(@RequestBody SysUser sysUser)
    {
        return zInfoUserService.findInfoUserNameAClan(zInfoUser.getNickName());
        List<SysUser> strings = sysUserMapper.getUserByUserName(sysUser.getUserName());
        List<String> strings1= new ArrayList<>();
        for (SysUser s:strings){
            strings1.add(s.getNickName());
        }
        return zInfoUserService.findUserNameAClan(strings1);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java
New file
@@ -0,0 +1,122 @@
package com.ruoyi.web.controller.zhang;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfShareOther;
import com.ruoyi.domain.ZfShareData;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfClanService;
import com.ruoyi.service.ZfShareDataService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/zfShareData")
public class ZfShareDataController extends BaseController {
    @Resource
    private ZfShareDataService zfShareDataService;
    @Resource
    private ZInfoUserService zInfoUserService;
    @Resource
    private ZfClanService zfClanService;
    /**
     * 共享给了谁
     * @param zfShareData
     * @return
     */
    @GetMapping("/all")
    public List<ZfShareOther> listAll(ZfShareData zfShareData) {
        List<ZfShareData> zfShareData2 = zfShareDataService.selectList();
        List<ZfShareOther> zfShareOtherList = new ArrayList<>();
        for (ZfShareData zfShareData1 :zfShareData2){
            System.out.println("1111111111111111111111");
            ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getSharedId().longValue());
            ZfShareOther zfShareOther = new ZfShareOther();
            zfShareOther.setUserId(infoBysysId.getSysId().intValue());
            zfShareOther.setUserName(infoBysysId.getNickName());
            zfShareOther.setClanId(infoBysysId.getClanId());
            zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
            zfShareOtherList.add(zfShareOther);
        }
        return zfShareOtherList;
    }
    /**
     * 通过id查找
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(zfShareDataService.getById(id));
    }
    /**
     * 新增共享
     */
//    @PreAuthorize("@ss.hasPermi('system:property:add')")
    @Log(title = "共享记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZfShareOther zfShareData) {
        return zfShareDataService.addData(zfShareData.getIds());
    }
    /**
     * 批量删除家庭大事件记录
     */
    @Log(title = "共享记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return zfShareDataService.deleteData(ids);
    }
    /**
     * 共享者 输入userid
     * @param
     * @return
     */
    @GetMapping("/come/{id}")
    public List<ZfShareOther> list(@PathVariable Long id) {
        List<ZfShareData> shareId = zfShareDataService.getShareId(id);
        List<ZfShareOther> zfShareOtherList = new ArrayList<>();
        for (ZfShareData zfShareData1 : shareId){
            System.out.println("1111111111111111111111");
            ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(zfShareData1.getUserId().longValue());
            ZfShareOther zfShareOther = new ZfShareOther();
            zfShareOther.setUserId(infoBysysId.getSysId().intValue());
            zfShareOther.setUserName(infoBysysId.getNickName());
            zfShareOther.setClanId(infoBysysId.getClanId());
            zfShareOther.setClanName(zfClanService.getById(infoBysysId.getClanId()).getClanName());
            zfShareOtherList.add(zfShareOther);
        }
        return zfShareOtherList;
    }
    /**
     * 设置主账户 修改MasterAccount值
     */
    @Log(title = "共享记录", businessType = BusinessType.UPDATE)
    @PutMapping("/setAdminAccount")
    public AjaxResult edit(@RequestBody ZfShareData zfShareData) {
        return zfShareDataService.setAdmin(zfShareData.getMasterAccount().longValue());
    }
//
    /**
     * 设置为所有用户可以查看 传入userid
     */
    @Log(title = "共享记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit2(@RequestBody ZfShareData zfShareData) {
        return zfShareDataService.allUser(zfShareData.getUserId().longValue());
    }
//
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -53,6 +53,9 @@
     */
    public SysUser selectUserByUserName(String userName);
    public List<SysUser> getUserByUserName(String userName);
    public SysUser selectUserByNickName(String nickName);
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -167,6 +167,11 @@
        where u.user_name = #{userName} and u.del_flag = '0'
    </select>
    <select id="getUserByUserName" parameterType="String" resultMap="SysUserResult">
        <include refid="selectUserVo"/>
        where u.user_name = #{userName} and u.del_flag = '0'
    </select>
    <select id="selectUserByNickName" parameterType="String" resultMap="SysUserResult">
        <include refid="selectUserVo"/>
zhang-content/src/main/java/com/ruoyi/domain/ShareOtherClan.java
File was deleted
zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
@@ -250,8 +250,4 @@
     */
    @TableField(exist = false)
    private List<ZInfoUser> childList;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfShareData.java
New file
@@ -0,0 +1,35 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("zf_share_data")
public class ZfShareData {
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 分享者的id
     */
    private Integer userId;
    /**
     * 被分享者的id
     */
    private Integer sharedId;
    /**
     * 主账户
     */
    private Integer masterAccount;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfShareOther.java
New file
@@ -0,0 +1,27 @@
package com.ruoyi.domain;
import lombok.Data;
@Data
public class ZfShareOther {
    /**
     * 分享者的id
     */
    private Integer userId;
    /**
     * 被分享者的名字
     */
    private String userName;
    /**
     * 被分享者家族id
     */
    private Integer clanId;
    /**
     * 被分享者家族名字
     */
    private String clanName;
    private Long[] ids;
}
zhang-content/src/main/java/com/ruoyi/mapper/ZfShareDataMapper.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ZfShareData;
public interface ZfShareDataMapper extends BaseMapper<ZfShareData> {
}
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
@@ -1,6 +1,7 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfRelation;
@@ -26,7 +27,7 @@
    List<ZInfoUser> selectByClanId(Integer clanId);
    AjaxResult findInfoUserNameAClan(String nickName);
    AjaxResult findUserNameAClan(List<String> nickNames);
    List<ZInfoUser> getDataBySex(Integer sex,Integer clanId);
zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java
New file
@@ -0,0 +1,29 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfShareData;
import com.ruoyi.domain.ZfShareOther;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface ZfShareDataService extends IService<ZfShareData> {
    List<ZfShareData> selectList();
    List<ZfShareData> selectByIds(Long[] ids);
    AjaxResult addData(Long[] userIds);
    AjaxResult deleteData(Long[] ids);
    AjaxResult setAdmin(Long id);
    AjaxResult allUser(Long id);
    List<ZfShareData> getShareId(Long id);
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
@@ -13,10 +13,7 @@
import com.ruoyi.domain.*;
import com.ruoyi.domain.dto.*;
import com.ruoyi.mapper.ZInfoUserMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfFamilyService;
import com.ruoyi.service.ZfRelationService;
import com.ruoyi.service.ZfRoleService;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +23,6 @@
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
 * <p>
 *  服务实现类
@@ -51,6 +47,10 @@
    @Resource
    private ZfRoleService zfRoleService;
    @Resource
    private ZfClanService zfClanService;
    @Override
    public AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize) {
@@ -100,22 +100,25 @@
//    }
    @Override
    public AjaxResult findInfoUserNameAClan(String nickName)
    public AjaxResult findUserNameAClan(List<String> nickNames)
    {
        List<ZfShareOther> shareOtherClans = new ArrayList<>();
        for (String nickName:nickNames) {
        ZInfoUser zInfoUser = new ZInfoUser();
        zInfoUser.setNickName(nickName);
        LambdaQueryWrapper<ZInfoUser> lqw = buildCondition(zInfoUser);
        List<ZInfoUser> zInfoUsers = list(lqw);
        List<ShareOtherClan> shareOtherClans = new ArrayList<>();
        for (ZInfoUser zInfoUser1: zInfoUsers) {
            ShareOtherClan shareOtherClan = new ShareOtherClan();
            shareOtherClan.setNickName(zInfoUser1.getNickName());
            ZfShareOther shareOtherClan = new ZfShareOther();
            shareOtherClan.setUserName(zInfoUser1.getNickName());
            shareOtherClan.setUserId(zInfoUser1.getUserId().intValue());
            shareOtherClan.setClanId(zInfoUser1.getClanId());
            shareOtherClan.setClanName(zfClanService.getById(zInfoUser1.getClanId()).getClanName());
            shareOtherClans.add(shareOtherClan);
        }
        }}
        return AjaxResult.success(shareOtherClans);
    }
@@ -786,6 +789,8 @@
    }
    private void recursionFindUser(List<ZInfoUser> treeList) {
        if (treeList == null || treeList.isEmpty()) {
            return;
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java
@@ -11,10 +11,9 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZSelfNote;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZSelfNoteMapper;
import com.ruoyi.service.EsService;
import com.ruoyi.service.ZSelfNoteService;
import com.ruoyi.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -22,6 +21,7 @@
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
 * <p>
@@ -38,7 +38,16 @@
    ZSelfNoteService zSelfNoteService;
    @Resource
    ZfShareDataService zfShareDataService;
    @Resource
    private EsService esSer;
    @Resource
    private ZInfoUserService zInfoUserService;
    @Resource
    private ZfClanService zfClanService;
    private LambdaQueryWrapper<ZSelfNote> uniqueCondition(ZSelfNote zSelfNote) {
        LambdaQueryWrapper<ZSelfNote> lqw = new LambdaQueryWrapper<>();
@@ -51,9 +60,9 @@
        return lqw;
    }
    private LambdaQueryWrapper<ZSelfNote> buildCondition(ZSelfNote zSelfNote, Long userId) {
    private LambdaQueryWrapper<ZSelfNote> buildCondition(ZSelfNote zSelfNote) {
        LambdaQueryWrapper<ZSelfNote> lqw = new LambdaQueryWrapper<>();
        lqw.eq(userId != null, ZSelfNote::getUid, userId)
        lqw.in(ZSelfNote::getUid, getAll())
                .like(StringUtils.isNotEmpty(zSelfNote.getPeople()), ZSelfNote::getPeople, zSelfNote.getPeople())
                .like(StringUtils.isNotEmpty(zSelfNote.getTitle()), ZSelfNote::getTitle, zSelfNote.getTitle())
                .like(StringUtils.isNotEmpty(zSelfNote.getAddress()),ZSelfNote::getAddress,zSelfNote.getAddress())
@@ -63,19 +72,62 @@
        return lqw;
    }
    public List<Long> getAll(){
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        List<ZfShareData> shareId = zfShareDataService.getShareId(userId);
        List<ZfShareData> zfShareDataList = zfShareDataService.selectList();
        List<Long> all = new ArrayList<>();
        all.add(userId);
        if(shareId.size() >0 ) {
            if (shareId.get(0).getMasterAccount() == 0 || shareId.get(0).getMasterAccount() == userId.intValue()) {
                all.add(shareId.get(0).getUserId().longValue());
            }
            else {
                all.clear();
                all.add(0L);
                return all;
            }
        }
        if (zfShareDataList.size()>0 && (zfShareDataList.get(0).getMasterAccount() == 0 || zfShareDataList.get(0).getMasterAccount() == userId.intValue())){
            for (ZfShareData zfShareOther: zfShareDataList) {
                all.add(zfShareOther.getSharedId().longValue());
            }
        }
        return all;
    }
    /**
     * 分页查找
     */
    @Override
    public AjaxResult selectDataList(ZSelfNote zSelfNote, Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote);
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote, userId);
        List<ZfShareData> zfShareOtherList = zfShareDataService.selectList();
        List<ZfShareData> shareId = zfShareDataService.getShareId(userId);
        if (list(lqw).size()==0) {
            Integer masterAccount = 0;
            if(zfShareOtherList.size()>0 ){
             masterAccount = zfShareOtherList.get(0).getMasterAccount();}
            if(shareId.size()>0){
                masterAccount = shareId.get(0).getMasterAccount();
            }
            ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(masterAccount.longValue());
            if (infoBysysId !=null)
            { ZfClan byId = zfClanService.getById(infoBysysId.getClanId());
            return AjaxResult.success("请前往家族名称为"+byId.getClanName()+",用户名为"+infoBysysId.getNickName()+"的用户账号下查看");
            }
        }
        Page<ZSelfNote> pageBean = new Page<>(pageNum, pageSize);
        Page<ZSelfNote> pageResult = page(pageBean, lqw);
        List<ZSelfNote> beanRecords = pageResult.getRecords();//得到查询出来的数据
        HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
        return AjaxResult.success(data);
@@ -121,7 +173,7 @@
        Long userId = user.getUserId();
        ZSelfNote zSelfNote = new ZSelfNote();
        LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote, userId);
        LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote);
        return list(lqw);
    }
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -230,6 +230,7 @@
        List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
        //加上自己家庭的id
        idList.add(familyId);
        System.out.println(authority);
        //加上父母家族id
        idList.add(fatherFaId);
zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java
New file
@@ -0,0 +1,161 @@
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsModel;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZfShareDataMapper;
import com.ruoyi.service.EsService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfClanService;
import com.ruoyi.service.ZfShareDataService;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@Service
public class ZfShareDataServiceImpl extends ServiceImpl<ZfShareDataMapper, ZfShareData> implements ZfShareDataService {
    @Resource
    private ZInfoUserService zInfoUserService;
    @Resource
    private RestHighLevelClient restHighLevelClient;
    @Resource
    private ZfClanService zfClanService;
    @Resource
    private EsService esSer;
    private LambdaQueryWrapper<ZfShareData> buildCondition(Long userId) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfShareData::getId);
        lqw.eq(ZfShareData::getUserId,userId);
        return lqw;
    }
    private LambdaQueryWrapper<ZfShareData> uniqueCondition(ZfShareData zfShareData) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfShareData::getId);
        lqw.eq(ZfShareData::getSharedId,zfShareData.getSharedId());
        return lqw;
    }
    @Override
    public List<ZfShareData> selectList() {
        LambdaQueryWrapper<ZfShareData> lqw = buildCondition(getUserId());
        return list(lqw);
    }
    @Override
    public List<ZfShareData> selectByIds(Long[] ids) {
        List<ZfShareData> list = new ArrayList<>();
        if(ids.length!=0)
            list = listByIds(Arrays.asList(ids));
        else
            list = list();
        return list;
    }
    public Long getUserId(){
        ZInfoUser myself = zInfoUserService.getMyself();
        return myself.getUserId();
    }
//    public Long getSource(Long userId){
//        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
//        lqw.orderByDesc(ZfShareData::getId);
//        lqw.eq(ZfShareData::getSharedId,userId);
//        if (list(lqw).size() == 0){
//            return userId;
//        }
//        return getSource(userId);
//    }
    @Override
    public AjaxResult addData(Long[] userIds) {
            for (Long userId : userIds) {
                ZfShareData zfShareData = new ZfShareData();
                zfShareData.setUserId(getUserId().intValue());
                zfShareData.setSharedId(userId.intValue());
                zfShareData.setMasterAccount(0);
                for(ZfShareData zfShareData1:list(buildCondition(getUserId()))){
                    System.out.println(zfShareData1);
                }
                if (list(uniqueCondition(zfShareData)).size() == 0) save(zfShareData);
                else return AjaxResult.error("请勿重复共享");
            }
            return AjaxResult.success("数据共享成功");
    }
    @Override
    public AjaxResult deleteData(Long[] ids) {
        List<ZfShareData> meetings = listByIds(Arrays.asList(ids));
        if (removeByIds(Arrays.asList(ids))) {
            //删除es中的数据
            meetings.forEach(meeting -> {
                EsModel esModel = esSer.findByCtId((meeting.getId().intValue()), "数据共享");
                if (esModel != null){
                    DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
                    try {
                        restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            });
            return AjaxResult.success();
        }else {
            return AjaxResult.error();
        }
    }
    @Override
    public AjaxResult setAdmin(Long id) {
        List<ZfShareData> list = list(buildCondition(getUserId()));
        list.addAll(getShareId(getUserId()));
        for (ZfShareData zfShareData1:list){
            zfShareData1.setMasterAccount(id.intValue());
            updateById(zfShareData1);
        }
        return AjaxResult.success();
    }
    @Override
    public AjaxResult allUser(Long id) {
        List<ZfShareData> list = list(buildCondition(id));
        list.addAll(getShareId(id));
        for (ZfShareData zfShareData1:list){
            zfShareData1.setMasterAccount(0);
            updateById(zfShareData1);
        }
        return AjaxResult.success();
    }
    @Override
    public List<ZfShareData> getShareId(Long id) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfShareData::getId);
        lqw.eq(ZfShareData::getSharedId,id);
        return list(lqw);
    }
}