| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.entity.sysUserInfo; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfFamily; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import com.ruoyi.service.ZfFamilyService; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | @Resource |
| | | private ZInfoUserService zInfoUserService; |
| | | @Resource |
| | | private ZfFamilyService zfFamilyService; |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) |
| | | public AjaxResult add(@Validated @RequestBody sysUserInfo userAll) |
| | | { |
| | | SysUser user = new SysUser(); |
| | | user.setUserId(userAll.getUserId()); |
| | | user.setAvatar(userAll.getAvatar()); |
| | | user.setPassword(userAll.getPassword()); |
| | | user.setNickName(userAll.getNickName()); |
| | | user.setUserName(userAll.getUserName()); |
| | | user.setPhonenumber(userAll.getPhonenumber()); |
| | | user.setRoleId(userAll.getRoleId()); |
| | | user.setRoleIds(userAll.getRoleIds()); |
| | | user.setStatus(userAll.getStatus()); |
| | | user.setSex(userAll.getSex()); |
| | | user.setRemark(userAll.getRemark()); |
| | | user.setUpdateBy(userAll.getUpdateBy()); |
| | | user.setPostIds(userAll.getPostIds()); |
| | | // user.set |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | //写入到 新建立的信息表里面 |
| | | ZfFamily zfFamily = zfFamilyService.getByFamId(userAll.getFamilyId()); |
| | | ZInfoUser infoUser = new ZInfoUser(); |
| | | infoUser.setUserId(user.getUserId()); |
| | | infoUser.setNickName(user.getNickName()); |
| | | infoUser.setPhoneNumber(user.getPhonenumber()); |
| | | infoUser.setSex(user.getSex()=="男"?1:0); |
| | | infoUser.setFamilyId(userAll.getFamilyId()); |
| | | if(zfFamily!=null) { |
| | | infoUser.setFatherId(zfFamily.getFid()); |
| | | // infoUser.setMomId(zfFamily.getMid()); |
| | | } |
| | | System.out.println("-----"); |
| | | System.out.println(userAll.getIsMyFamily()); |
| | | infoUser.setIsMyFamily(userAll.getIsMyFamily()); |
| | | if(userAll.getSpouseId()==0) |
| | | infoUser.setSpouseId(null); |
| | | else |
| | | infoUser.setSpouseId(userAll.getSpouseId()); |
| | | //前端保证了角色不为空 |
| | | if(user.getRoleIds()[0]==102) |
| | | infoUser.setRoleId(3L); |
| | | // infoUser.setRoleName(user.g); |
| | | if(userAll.getFamilyId()!=-1) { |
| | | zInfoUserService.saveOrUpdate(infoUser); |
| | | } |
| | | return toAjax(userService.insertUser(user)); |
| | | } |
| | | |
| | |
| | | { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | zInfoUserService.removeByUserName( userService.findUserNames(userIds)); |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.domain.ZAuthority; |
| | | import com.ruoyi.domain.dto.AuthorityDto; |
| | | import com.ruoyi.domain.dto.AuthorityDto2; |
| | | import com.ruoyi.domain.dto.EmpowerDto; |
| | | import com.ruoyi.service.ZAuthorityService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | return zAuthorityService.getOtherAuthority(authorityDto); |
| | | } |
| | | |
| | | // /** |
| | | // * 授权(只有家庭管理员才能调用这个接口) |
| | | // */ |
| | | // @PostMapping("/empower") |
| | | // public AjaxResult empower(){ |
| | | // |
| | | // } |
| | | /** |
| | | * 授权(只有家庭管理员才能调用这个接口) |
| | | */ |
| | | @PostMapping("/empower") |
| | | public AjaxResult empower(@RequestBody EmpowerDto zAuthority){ |
| | | return zAuthorityService.saveZa(zAuthority); |
| | | } |
| | | /** |
| | | * 根据authorityId和家庭id查看已经授权给那些人 |
| | | */ |
| | | @PostMapping("/getInfoByAidFid") |
| | | public AjaxResult empowerGetInfo(@RequestBody ZAuthority zAuthority){ |
| | | return zAuthorityService.listByFidAid(zAuthority); |
| | | } |
| | | /** |
| | | * 根据authorityId和家庭id收回已经授权给那些人 |
| | | */ |
| | | @PostMapping("/deleteInfoByAidFid") |
| | | public AjaxResult deleteEmpower(@RequestBody EmpowerDto zAuthority){ |
| | | return zAuthorityService.deleteZa(zAuthority); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | Long userId = user.getUserId(); |
| | | return AjaxResult.success(zInfoUserService.getInfoById(userId)); |
| | | } |
| | | @GetMapping("/{id}") |
| | | public AjaxResult getInfoById(@PathVariable("id") Long id) { |
| | | // SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = id; |
| | | return AjaxResult.success(zInfoUserService.getInfoById(userId)); |
| | | } |
| | | // |
| | | |
| | | /** |
| | |
| | | public AjaxResult listAllPeopleWithTree(@PathParam("depth") Integer depth){ |
| | | return zInfoUserService.listWithTree(depth); |
| | | } |
| | | |
| | | /** |
| | | * 根据家庭成员找到所有人 |
| | | */ |
| | | @GetMapping("/allFamInfo") |
| | | public AjaxResult listAllFamilyPeople() |
| | | { |
| | | return zInfoUserService.listAllFamilyPeople(); |
| | | } |
| | | |
| | | /** |
| | | * 找到所有的成员 |
| | |
| | | package com.ruoyi.web.controller.zhang; |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.ZfEvent; |
| | | import com.ruoyi.domain.ZfFamily; |
| | | import com.ruoyi.domain.dto.UserInfoDto; |
| | | import com.ruoyi.service.ZfFamilyService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author Jinquan_Ou |
| | |
| | | public AjaxResult getByFamilyId(@PathVariable Long fid){ |
| | | return AjaxResult.success(zfFamilyService.getByFamilyId(fid)); |
| | | } |
| | | @GetMapping("/findByfid/{fid}") |
| | | public AjaxResult getByFId(@PathVariable("fid") Long fid){ |
| | | return AjaxResult.success(zfFamilyService.getByFid(fid)); |
| | | } |
| | | @GetMapping("/findByFname/{name}") |
| | | public AjaxResult getByFName(@PathVariable("name") String name){ |
| | | return AjaxResult.success(zfFamilyService.getByName(name)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看当前用户当前家庭的家庭成员 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导出家庭大事件记录列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:export')") |
| | | @Log(title = "家庭大事件记录", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | List<ZfFamily> list = zfFamilyService.list(); |
| | | System.out.println("------------------"); |
| | | ExcelUtil<ZfFamily> util = new ExcelUtil<>(ZfFamily.class); |
| | | util.exportExcel(response, list, "家庭大事件记录数据"); |
| | | |
| | | } |
| | | |
| | | @Log(title = "家庭大事件记录", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/deleteFam/{ids}") |
| | | public AjaxResult deleteFamily(@PathVariable Long[] ids) { |
| | | return zfFamilyService.deleteFam(ids); |
| | | } |
| | | /** |
| | | * |
| | | * @param zfFamily |
| | | * @return |
| | |
| | | * @param zfFamily |
| | | * @return |
| | | */ |
| | | @PostMapping("/findInfo") |
| | | public AjaxResult findFamilyMember(@RequestBody ZfFamily zfFamily){ |
| | | |
| | | return AjaxResult.success(zfFamilyService.getByNameAndUser(zfFamily)); |
| | | |
| | | } |
| | | /** |
| | | * |
| | | * @param zfFamily |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateFam") |
| | | public AjaxResult updateFamily(@RequestBody ZfFamily zfFamily){ |
| | | |
New file |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.annotation.Excels; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.xss.Xss; |
| | | |
| | | import javax.validation.constraints.Email; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class sysUserInfo extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 用户ID */ |
| | | @Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号") |
| | | private Long userId; |
| | | |
| | | /** 部门ID */ |
| | | @Excel(name = "部门编号", type = Excel.Type.IMPORT) |
| | | private Long deptId; |
| | | |
| | | /** 用户账号 */ |
| | | @Excel(name = "登录名称") |
| | | private String userName; |
| | | |
| | | /** 用户昵称 */ |
| | | @Excel(name = "用户名称") |
| | | private String nickName; |
| | | |
| | | /** 用户邮箱 */ |
| | | @Excel(name = "用户邮箱") |
| | | private String email; |
| | | |
| | | /** 手机号码 */ |
| | | @Excel(name = "手机号码") |
| | | private String phonenumber; |
| | | |
| | | /** 用户性别 */ |
| | | @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") |
| | | private String sex; |
| | | |
| | | /** 用户头像 */ |
| | | private String avatar; |
| | | |
| | | /** 密码 */ |
| | | private String password; |
| | | |
| | | public static long getSerialVersionUID() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | public long getFamilyId() { |
| | | return familyId; |
| | | } |
| | | |
| | | public void setFamilyId(long familyId) { |
| | | this.familyId = familyId; |
| | | } |
| | | |
| | | public long getSpouseId() { |
| | | return spouseId; |
| | | } |
| | | |
| | | public void setSpouseId(long spouseId) { |
| | | this.spouseId = spouseId; |
| | | } |
| | | |
| | | public int getIsMyFamily() { |
| | | return isMyFamily; |
| | | } |
| | | |
| | | public void setIsMyFamily(int isMyFamily) { |
| | | this.isMyFamily = isMyFamily; |
| | | } |
| | | |
| | | public long getFatherId() { |
| | | return fatherId; |
| | | } |
| | | |
| | | public void setFatherId(long fatherId) { |
| | | this.fatherId = fatherId; |
| | | } |
| | | |
| | | public long getMomId() { |
| | | return momId; |
| | | } |
| | | |
| | | public void setMomId(long momId) { |
| | | this.momId = momId; |
| | | } |
| | | |
| | | private long familyId; |
| | | |
| | | private long spouseId; |
| | | |
| | | private int isMyFamily; |
| | | |
| | | public long getFid() { |
| | | return fid; |
| | | } |
| | | |
| | | public void setFid(long fid) { |
| | | this.fid = fid; |
| | | } |
| | | |
| | | private long fatherId; |
| | | |
| | | private long momId; |
| | | |
| | | private long fid; |
| | | /** 帐号状态(0正常 1停用) */ |
| | | @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | /** 删除标志(0代表存在 2代表删除) */ |
| | | private String delFlag; |
| | | |
| | | /** 最后登录IP */ |
| | | @Excel(name = "最后登录IP", type = Excel.Type.EXPORT) |
| | | private String loginIp; |
| | | |
| | | /** 最后登录时间 */ |
| | | @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT) |
| | | private Date loginDate; |
| | | |
| | | /** 部门对象 */ |
| | | @Excels({ |
| | | @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT), |
| | | @Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT) |
| | | }) |
| | | private SysDept dept; |
| | | |
| | | /** 角色对象 */ |
| | | private List<SysRole> roles; |
| | | |
| | | /** 角色组 */ |
| | | private Long[] roleIds; |
| | | |
| | | /** 岗位组 */ |
| | | private Long[] postIds; |
| | | |
| | | /** 角色ID */ |
| | | private Long roleId; |
| | | |
| | | public sysUserInfo() |
| | | { |
| | | |
| | | } |
| | | |
| | | public sysUserInfo(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Long getUserId() |
| | | { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public boolean isAdmin() |
| | | { |
| | | return isAdmin(this.userId); |
| | | } |
| | | |
| | | public static boolean isAdmin(Long userId) |
| | | { |
| | | //1号用户就是管理员 |
| | | return userId != null && 1L == userId; |
| | | } |
| | | |
| | | public Long getDeptId() |
| | | { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Long deptId) |
| | | { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | @Xss(message = "用户昵称不能包含脚本字符") |
| | | @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") |
| | | public String getNickName() |
| | | { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) |
| | | { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | @Xss(message = "用户账号不能包含脚本字符") |
| | | @NotBlank(message = "用户账号不能为空") |
| | | @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") |
| | | public String getUserName() |
| | | { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) |
| | | { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | @Email(message = "邮箱格式不正确") |
| | | @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |
| | | public String getEmail() |
| | | { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) |
| | | { |
| | | this.email = email; |
| | | } |
| | | |
| | | @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") |
| | | public String getPhonenumber() |
| | | { |
| | | return phonenumber; |
| | | } |
| | | |
| | | public void setPhonenumber(String phonenumber) |
| | | { |
| | | this.phonenumber = phonenumber; |
| | | } |
| | | |
| | | public String getSex() |
| | | { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(String sex) |
| | | { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getAvatar() |
| | | { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) |
| | | { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getLoginIp() |
| | | { |
| | | return loginIp; |
| | | } |
| | | |
| | | public void setLoginIp(String loginIp) |
| | | { |
| | | this.loginIp = loginIp; |
| | | } |
| | | |
| | | public Date getLoginDate() |
| | | { |
| | | return loginDate; |
| | | } |
| | | |
| | | public void setLoginDate(Date loginDate) |
| | | { |
| | | this.loginDate = loginDate; |
| | | } |
| | | |
| | | public SysDept getDept() |
| | | { |
| | | return dept; |
| | | } |
| | | |
| | | public void setDept(SysDept dept) |
| | | { |
| | | this.dept = dept; |
| | | } |
| | | |
| | | public List<SysRole> getRoles() |
| | | { |
| | | return roles; |
| | | } |
| | | |
| | | public void setRoles(List<SysRole> roles) |
| | | { |
| | | this.roles = roles; |
| | | } |
| | | |
| | | public Long[] getRoleIds() |
| | | { |
| | | return roleIds; |
| | | } |
| | | |
| | | public void setRoleIds(Long[] roleIds) |
| | | { |
| | | this.roleIds = roleIds; |
| | | } |
| | | |
| | | public Long[] getPostIds() |
| | | { |
| | | return postIds; |
| | | } |
| | | |
| | | public void setPostIds(Long[] postIds) |
| | | { |
| | | this.postIds = postIds; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | | { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | } |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>zhang-content</artifactId> |
| | | <version>1.0</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-extension</artifactId> |
| | | <version>3.5.2</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | */ |
| | | public interface SysUserMapper |
| | | { |
| | | public List<String> findUserNames(Long[] ids); |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | | * |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysUserService |
| | | public interface ISysUserService extends IService<SysUser> |
| | | { |
| | | |
| | | |
| | | public List<String> findUserNames(Long [] ids); |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | | * |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Validator; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysUserServiceImpl implements ISysUserService |
| | | { |
| | | public class SysUserServiceImpl implements ISysUserService { |
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | protected Validator validator; |
| | | |
| | | @Resource |
| | | private ZInfoUserService zInfoUserService; |
| | | |
| | | @Override |
| | | public List<String> findUserNames(Long[] ids) { |
| | | List<String> usNames = userMapper.findUserNames(ids); |
| | | System.out.println(usNames); |
| | | //.stream().map(SysUser::getUserName).collect(Collectors.toList()); |
| | | return usNames; |
| | | } |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | |
| | | insertUserPost(user); |
| | | // 新增用户与角色管理 |
| | | insertUserRole(user); |
| | | |
| | | |
| | | return rows; |
| | | } |
| | | |
| | |
| | | userPostMapper.deleteUserPostByUserId(userId); |
| | | // 新增用户与岗位管理 |
| | | insertUserPost(user); |
| | | |
| | | //更新用户信息表 |
| | | |
| | | return userMapper.updateUser(user); |
| | | } |
| | | |
| | |
| | | } |
| | | return successMsg.toString(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveBatch(Collection<SysUser> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdateBatch(Collection<SysUser> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateBatchById(Collection<SysUser> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdate(SysUser entity) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public SysUser getOne(Wrapper<SysUser> queryWrapper, boolean throwEx) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getMap(Wrapper<SysUser> queryWrapper) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public <V> V getObj(Wrapper<SysUser> queryWrapper, Function<? super Object, V> mapper) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BaseMapper<SysUser> getBaseMapper() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Class<SysUser> getEntityClass() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | <select id="selectMenuTreeAll" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time |
| | | from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0 and m.menu_id in (1, 100,101, 118) |
| | | from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0 and m.menu_id in (1, 100, 118) |
| | | order by m.parent_id, m.order_num |
| | | </select> |
| | | |
| | |
| | | <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap id="deptResult" type="SysDept"> |
| | | <id property="deptId" column="dept_id" /> |
| | | <result property="parentId" column="parent_id" /> |
| | |
| | | <result property="dataScope" column="data_scope" /> |
| | | <result property="status" column="role_status" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
| | | r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status |
| | | from sys_user u |
| | |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role r on r.role_id = ur.role_id |
| | | </sql> |
| | | |
| | | <select id="findUserNames" parameterType="Long" resultMap="SysUserResult"> |
| | | SELECT |
| | | user_name |
| | | from sys_user |
| | | WHERE user_id IN |
| | | <foreach collection="array" item="id" index="index" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into sys_user( |
| | | <if test="userId != null and userId != 0">user_id,</if> |
| | |
| | | /** |
| | | * 家庭名称 |
| | | */ |
| | | @Excel(name="家庭号") |
| | | |
| | | private String name; |
| | | |
| | | |
| | | /** |
| | | * 家庭名称 |
| | | */ |
| | | @Excel(name="父亲id") |
| | | |
| | | private Long fid; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public class EmpowerDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Long [] uids; |
| | | |
| | | /** |
| | | * 家庭id |
| | | */ |
| | | private Long fid; |
| | | |
| | | /** |
| | | * 权限码 |
| | | */ |
| | | private Long[] authoritys; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.domain.ZAuthority; |
| | | import com.ruoyi.domain.dto.AuthorityDto; |
| | | import com.ruoyi.domain.dto.AuthorityDto2; |
| | | import com.ruoyi.domain.dto.EmpowerDto; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | AjaxResult managerAuthority(AuthorityDto2 authorityDto); |
| | | |
| | | AjaxResult getOtherAuthority(AuthorityDto authorityDto); |
| | | |
| | | AjaxResult saveZa(EmpowerDto zAuthority); |
| | | |
| | | AjaxResult deleteZa(EmpowerDto empowerDto); |
| | | AjaxResult listByFidAid(ZAuthority zAuthority); |
| | | } |
| | |
| | | |
| | | List<ZInfoUser> selectByCondition(ZInfoUser zInfoUser); |
| | | |
| | | AjaxResult removeByUserName(List userName); |
| | | List<ZInfoUser> selectByFamId(long fid); |
| | | AjaxResult searchMyRelation(); |
| | | |
| | | AjaxResult addRelation(ZfRelation zfRelation); |
| | |
| | | AjaxResult addParent(Long fatherId, Long motherId); |
| | | |
| | | AjaxResult listAllExceptAdmin(); |
| | | |
| | | AjaxResult listAllFamilyPeople(); |
| | | AjaxResult listMySelfAndSpouse(Long id); |
| | | |
| | | AjaxResult listGenealogy(Genealogy genealogy,Integer pageNum,Integer pageSize); |
| | |
| | | @Service |
| | | public interface ZfFamilyService extends IService<ZfFamily> { |
| | | |
| | | ZfFamily getByNameAndUser(ZfFamily zfFamily); |
| | | /** |
| | | * 根据家庭名字查询家庭 |
| | | */ |
| | | ZfFamily getByName(String familyName); |
| | | |
| | | |
| | | ZfFamily getByFid(Long fid); |
| | | ZfFamily getByFamId(Long fid); |
| | | List<UserInfoDto> getByFamilyId(Long fid); |
| | | |
| | | List<UserInfoDto> getNowMember(); |
| | |
| | | AjaxResult addFamily(ZfFamily zfFamily); |
| | | |
| | | AjaxResult updateFam(ZfFamily zfFamily); |
| | | |
| | | AjaxResult deleteFam(Long []ids); |
| | | } |
| | |
| | | import com.ruoyi.domain.dto.AuthorityDto; |
| | | import com.ruoyi.domain.dto.AuthorityDto2; |
| | | import com.ruoyi.domain.dto.AuthorityDtoWithName; |
| | | import com.ruoyi.domain.dto.EmpowerDto; |
| | | import com.ruoyi.mapper.ZAuthorityMapper; |
| | | import com.ruoyi.service.ZAuthorityService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | |
| | | |
| | | } |
| | | |
| | | public void addData(ZAuthority za) |
| | | { |
| | | //判断是否重复授权 |
| | | |
| | | // |
| | | zAuthorityService.save(za); |
| | | |
| | | } |
| | | public AjaxResult saveZa(EmpowerDto zAuthority) |
| | | { |
| | | // boolean bl = zAuthorityService.saveOrUpdate(zAuthority); |
| | | Long [] uids = zAuthority.getUids(); |
| | | Long [] authoritys = zAuthority.getAuthoritys(); |
| | | for(Long uid : uids) |
| | | for(Long auri: authoritys) |
| | | { |
| | | ZAuthority za = new ZAuthority(); |
| | | za.setAuthority(auri); |
| | | za.setFid(zAuthority.getFid()); |
| | | za.setUid(uid); |
| | | addData(za); |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | | return AjaxResult.success("权限新增成功!"); |
| | | // else |
| | | // return AjaxResult.error("权限新增失败!"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteZa(EmpowerDto empowerDto) { |
| | | Long [] uids = empowerDto.getUids(); |
| | | Long [] authoritys = empowerDto.getAuthoritys(); |
| | | for(Long uid : uids) |
| | | for(Long auri: authoritys) |
| | | { |
| | | |
| | | LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZAuthority::getFid,empowerDto.getFid()) |
| | | .eq(ZAuthority::getAuthority, auri) |
| | | .eq(ZAuthority::getUid, uid); |
| | | |
| | | zAuthorityService.remove(lqw); |
| | | // addData(za); |
| | | } |
| | | return AjaxResult.success("权限收回成功!"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listByFidAid(ZAuthority zAuthority) { |
| | | //找到对应家庭以及权限模块对应的用户 |
| | | LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZAuthority::getFid,zAuthority.getFid()) |
| | | .eq(ZAuthority::getAuthority, zAuthority.getAuthority()); |
| | | |
| | | List<ZAuthority> authorityList = list(lqw); |
| | | |
| | | List<Long> allUserListId = authorityList.stream().map(ZAuthority::getUid).collect(Collectors.toList());//授权用户数组数组 |
| | | |
| | | |
| | | LambdaQueryWrapper<ZInfoUser> lq = new LambdaQueryWrapper<>(); |
| | | lq.in(ZInfoUser::getUserId, allUserListId); |
| | | |
| | | List<ZInfoUser> userInfo = zInfoUserService.list(lq); |
| | | // Map<Long, String> usi = userInfo.stream().collect(Collectors.toMap(ZInfoUser::getUserId,ZInfoUser::getNickName)); |
| | | return AjaxResult.success(userInfo); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfEvent; |
| | | import com.ruoyi.domain.ZfFamily; |
| | | import com.ruoyi.domain.ZfRelation; |
| | | import com.ruoyi.domain.dto.*; |
| | | import com.ruoyi.mapper.ZInfoUserMapper; |
| | |
| | | log.info("返回的数据为:{}", list); |
| | | return list; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult removeByUserName(List userName) { |
| | | LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.in(ZInfoUser::getNickName, userName); |
| | | List<Long> ids = list(lqw).stream().map(ZInfoUser::getUserId).collect(Collectors.toList()); |
| | | removeByIds(ids); |
| | | return AjaxResult.success("删除成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZInfoUser> selectByFamId(long fid) { |
| | | LambdaQueryWrapper<ZfFamily> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfFamily::getId, fid); |
| | | ZfFamily zfFamily = zfFamilyService.list(lqw).get(0); |
| | | LambdaQueryWrapper<ZInfoUser> lqws = new LambdaQueryWrapper<>(); |
| | | lqws.eq(ZInfoUser::getFatherId, zfFamily.getFid()); |
| | | // lqws.eq(ZInfoUser::getMomId, zfFamily.getMid()); |
| | | List<ZInfoUser> list = list(lqws); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | List<ZInfoUser> myFamilyPeopleList = allPeopleList.stream().filter(people -> people.getUserId() != 1 && people.getIsMyFamily() == 1).collect(Collectors.toList()); |
| | | |
| | | |
| | | result = allPeopleList.stream().filter(people -> people.getUserId() != 1 && (people.getFatherId() == 0 || people.getMomId() == 0) && people.getIsMyFamily() == 1) |
| | | result = allPeopleList.stream().filter(people -> people!=null && people.getUserId() != 1 && ((people.getFatherId()!=null &&people.getFatherId() == 0 )|| (people.getMomId()!=null&&people.getMomId() == 0)) && people.getIsMyFamily() == 1) |
| | | .map(people -> { |
| | | // System.out.println("======================================="); |
| | | // System.out.println(people); |
| | | if (depth > 1) { |
| | | people.setIdentity(1); |
| | | //根据配偶id查询配偶的数据,封装好一起返回 |
| | | Long spouseId = people.getSpouseId(); |
| | | ZInfoUser spouse = zInfoUserService.getById(spouseId); |
| | | spouse.setIdentity(1); |
| | | people.setSpouse(spouse); |
| | | people.setChildList(fillChildren(people, myFamilyPeopleList, depth - 1)); |
| | | if(people!=null) { |
| | | people.setIdentity(1); |
| | | //根据配偶id查询配偶的数据,封装好一起返回 |
| | | Long spouseId = people.getSpouseId(); |
| | | if (spouseId != null) { |
| | | ZInfoUser spouse = zInfoUserService.getById(spouseId); |
| | | spouse.setIdentity(1); |
| | | people.setSpouse(spouse); |
| | | } |
| | | people.setChildList(fillChildren(people, myFamilyPeopleList, depth - 1)); |
| | | } |
| | | } |
| | | // System.out.println("+++++++++++++++++++++++++++++"); |
| | | // System.out.println(people); |
| | | return people; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | |
| | | //System.out.println("--------------++++++++++++++++--------------"); |
| | | return AjaxResult.success(result); |
| | | |
| | | } |
| | |
| | | @Override |
| | | public ZInfoUser getInfoById(Long userId) { |
| | | ZInfoUser user = getById(userId); |
| | | Long familyId = user.getFamilyId(); |
| | | String familyName = zfFamilyService.getById(familyId).getName(); |
| | | String roleName = zfRoleService.getById(user.getRoleId()).getName(); |
| | | user.setFamilyName(familyName); |
| | | user.setRoleName(roleName); |
| | | |
| | | |
| | | if(user!=null) |
| | | { |
| | | Long familyId = user.getFamilyId(); |
| | | // System.out.println("dddddddddddddddddddd"); |
| | | |
| | | String roleName = zfRoleService.getById(user.getRoleId()).getName(); |
| | | |
| | | user.setRoleName(roleName); |
| | | System.out.println("dddddddddddddddddddd"); |
| | | System.out.println(familyId); |
| | | if(familyId!=-1) |
| | | { |
| | | String familyName = zfFamilyService.getById(familyId).getName(); |
| | | user.setFamilyName(familyName); |
| | | } |
| | | } |
| | | return user; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listAllFamilyPeople() { |
| | | List<ZInfoUser> collect = list().stream().filter(zInfoUser -> zInfoUser.getRoleId()== 3).collect(Collectors.toList()); |
| | | return AjaxResult.success(collect); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult listMySelfAndSpouse(Long id) { |
| | | LambdaQueryWrapper<ZInfoUser> lqw1 = new LambdaQueryWrapper<>(); |
| | | lqw1.eq(ZInfoUser::getUserId, id); |
| | |
| | | // ).collect(Collectors.toList()); |
| | | |
| | | List<ZInfoUser> collect = allPeopleList.stream().filter( |
| | | one -> (one.getFatherId() == people.getUserId() || one.getMomId() == people.getUserId()) && (people.getIsMyFamily() == 1) |
| | | one -> ((one.getFamilyId()!=null && one.getFatherId() == people.getUserId()) || (one.getMomId()!=null&&one.getMomId() == people.getUserId())) && (people.getIsMyFamily() == 1) |
| | | ).map( |
| | | one -> { |
| | | if (depth == 1) { |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Resource |
| | | ZfFamilyMapper zfFamilyMapper; |
| | | @Resource |
| | | ZfFamilyService zfFamilyService; |
| | | |
| | | @Override |
| | | public ZfFamily getByNameAndUser(ZfFamily zfFamily) { |
| | | LambdaQueryWrapper<ZfFamily> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfFamily::getName,zfFamily.getName()).or().eq(ZfFamily::getFid, zfFamily.getFid()); |
| | | return getOne(lqw); |
| | | } |
| | | |
| | | @Override |
| | | public ZfFamily getByName(String familyName) { |
| | | LambdaQueryWrapper<ZfFamily> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfFamily::getName,familyName); |
| | | return getOne(lqw); |
| | | } |
| | | |
| | | @Override |
| | | public ZfFamily getByFid(Long fid) { |
| | | LambdaQueryWrapper<ZfFamily> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfFamily::getFid,fid); |
| | | return getOne(lqw); } |
| | | |
| | | @Override |
| | | public ZfFamily getByFamId(Long fid) { |
| | | LambdaQueryWrapper<ZfFamily> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZfFamily::getId,fid); |
| | | return getOne(lqw); |
| | | } |
| | | |
| | |
| | | }else |
| | | return AjaxResult.error("修改失败,家庭号不能重复"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteFam(Long[] ids) { |
| | | if (zfFamilyService.removeByIds(Arrays.asList(ids))) { |
| | | return AjaxResult.success(); |
| | | } |
| | | else |
| | | return AjaxResult.error(); |
| | | |
| | | |
| | | } |
| | | } |