修改多租户
parent
e892f77673
commit
a408dec2ef
|
@ -0,0 +1,71 @@
|
||||||
|
package com.yanzhu.system.domain;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.annotation.Excel;
|
||||||
|
import com.yanzhu.common.core.web.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统用户扩展对象 sys_user_ext
|
||||||
|
*
|
||||||
|
* @author yanzhu
|
||||||
|
* @date 2025-01-09
|
||||||
|
*/
|
||||||
|
public class SysUserCom extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 项目ID */
|
||||||
|
private Long comId;
|
||||||
|
|
||||||
|
/** 状态 */
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private Long isActive;
|
||||||
|
|
||||||
|
private String comName;
|
||||||
|
|
||||||
|
public String getComName() {
|
||||||
|
return comName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComName(String comName) {
|
||||||
|
this.comName = comName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getComId() {
|
||||||
|
return comId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComId(Long comId) {
|
||||||
|
this.comId = comId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(Long isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
package com.yanzhu.system.domain;
|
package com.yanzhu.system.domain;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.annotation.Excel;
|
||||||
|
import com.yanzhu.common.core.web.domain.BaseEntity;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import Excel;
|
|
||||||
import BaseEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户扩展对象 sys_user_ext
|
* 系统用户扩展对象 sys_user_ext
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.yanzhu.system.mapper;
|
||||||
|
|
||||||
|
import com.yanzhu.system.domain.SysUserCom;
|
||||||
|
import com.yanzhu.system.domain.SysUserExt;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统用户扩展Mapper接口
|
||||||
|
*
|
||||||
|
* @author yanzhu
|
||||||
|
* @date 2025-01-09
|
||||||
|
*/
|
||||||
|
public interface SysUserComMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户的租户
|
||||||
|
* @param sysUserCom
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<SysUserCom> selectUserComs(SysUserCom sysUserCom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 激活租户
|
||||||
|
* @param sysUserCom
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int updateActive (SysUserCom sysUserCom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新状态
|
||||||
|
* @param sysUserCom
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int updateStatus (SysUserCom sysUserCom);
|
||||||
|
|
||||||
|
public int updateActiveTo0(SysUserCom sysUserCom);
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ public interface SysUserExtMapper
|
||||||
* @param userId 系统用户扩展主键
|
* @param userId 系统用户扩展主键
|
||||||
* @return 系统用户扩展
|
* @return 系统用户扩展
|
||||||
*/
|
*/
|
||||||
public SysUserExt selectSysUserExtByUserId(Long userId);
|
public SysUserExt selectSysUserExtById(SysUserExt userExt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询系统用户扩展列表
|
* 查询系统用户扩展列表
|
||||||
|
@ -45,17 +45,8 @@ public interface SysUserExtMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除系统用户扩展
|
* 删除系统用户扩展
|
||||||
*
|
|
||||||
* @param userId 系统用户扩展主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
public int deleteSysUserExtByUserId(Long userId);
|
public int deleteSysUserExtById(SysUserExt sysUserExt);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除系统用户扩展
|
|
||||||
*
|
|
||||||
* @param userIds 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteSysUserExtByUserIds(Long[] userIds);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.yanzhu.system.mapper;
|
package com.yanzhu.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
import com.yanzhu.system.domain.SysUserPost;
|
import com.yanzhu.system.domain.SysUserPost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,4 +43,6 @@ public interface SysUserPostMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int batchUserPost(List<SysUserPost> userPostList);
|
public int batchUserPost(List<SysUserPost> userPostList);
|
||||||
|
|
||||||
|
void deleteUserPostByUser(SysUserPost user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.yanzhu.system.mapper.SysUserComMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysUserCom" id="SysUserComResult">
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="comId" column="com_id" />
|
||||||
|
<result property="comName" column="com_name" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="isActive" column="is_active" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectUserComs" parameterType="SysUserCom" resultMap="SysUserComResult">
|
||||||
|
select uc.*,sd.dept_name com_name
|
||||||
|
from sys_user_com uc left join sys_dept sd on uc.com_id=sd.dept_id
|
||||||
|
<where>
|
||||||
|
<if test="userId != null and userId != 0"> and uc.user_id = #{userId}</if>
|
||||||
|
<if test="comId != null and comId != 0"> and uc.com_id = #{comId}</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<update id="updateActiveTo0" parameterType="SysUserCom">
|
||||||
|
update sys_user_com set is_active=0 where user_id=#{userId}
|
||||||
|
</update>
|
||||||
|
<update id="updateActive" parameterType="SysUserCom">
|
||||||
|
update sys_user_com set is_active=#{isActive} where user_id=#{userId} and com_id=#{comId}
|
||||||
|
</update>
|
||||||
|
<update id="updateStatus" parameterType="SysUserCom">
|
||||||
|
update sys_user_com set status=#{status} where user_id=#{userId} and com_id=#{comId}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
|
@ -23,9 +23,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSysUserExtByUserId" parameterType="Long" resultMap="SysUserExtResult">
|
<select id="selectSysUserExtById" parameterType="Long" resultMap="SysUserExtResult">
|
||||||
<include refid="selectSysUserExtVo"/>
|
<include refid="selectSysUserExtVo"/>
|
||||||
where user_id = #{userId}
|
where user_id = #{userId} and project_id=#{projectId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertSysUserExt" parameterType="SysUserExt">
|
<insert id="insertSysUserExt" parameterType="SysUserExt">
|
||||||
|
@ -54,14 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteSysUserExtByUserId" parameterType="Long">
|
<delete id="deleteSysUserExtById" parameterType="SysUserExt">
|
||||||
delete from sys_user_ext where user_id = #{userId}
|
delete from sys_user_ext where user_id = #{userId} and project_id=#{projectId}
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteSysUserExtByUserIds" parameterType="String">
|
|
||||||
delete from sys_user_ext where user_id in
|
|
||||||
<foreach item="userId" collection="array" open="(" separator="," close=")">
|
|
||||||
#{userId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<resultMap type="SysUserPost" id="SysUserPostResult">
|
<resultMap type="SysUserPost" id="SysUserPostResult">
|
||||||
<result property="userId" column="user_id" />
|
<result property="userId" column="user_id" />
|
||||||
<result property="postId" column="post_id" />
|
<result property="postId" column="post_id" />
|
||||||
|
<result property="projectId" column="project_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<delete id="deleteUserPostByUserId" parameterType="Long">
|
<delete id="deleteUserPostByUserId" parameterType="Long">
|
||||||
|
@ -23,11 +24,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteUserPostByUser" parameterType="SysUserPost">
|
||||||
|
delete from sys_user_post where user_id=#{userId} and project_id=#{projectId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="batchUserPost">
|
<insert id="batchUserPost">
|
||||||
insert into sys_user_post(user_id, post_id) values
|
insert into sys_user_post(user_id, post_id,project_id) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
(#{item.userId},#{item.postId})
|
(#{item.userId},#{item.postId},#{item.projectId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
package com.yanzhu.system.controller;
|
package com.yanzhu.system.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.yanzhu.system.domain.SysUserCom;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.yanzhu.common.core.domain.R;
|
import com.yanzhu.common.core.domain.R;
|
||||||
import com.yanzhu.common.core.utils.StringUtils;
|
import com.yanzhu.common.core.utils.StringUtils;
|
||||||
|
@ -155,4 +151,17 @@ public class SysProfileController extends BaseController
|
||||||
}
|
}
|
||||||
return error("上传图片异常,请联系管理员");
|
return error("上传图片异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getUserComps/{userId}")
|
||||||
|
public AjaxResult getUserComs(@PathVariable Long userId){
|
||||||
|
if(userId==null||userId.longValue()==0){
|
||||||
|
userId=SecurityUtils.getLoginUser().getUserid();
|
||||||
|
}
|
||||||
|
return AjaxResult.success(userService.getUserComs(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/activeUserCom")
|
||||||
|
public AjaxResult activeUserCom(@RequestBody SysUserCom userCom){
|
||||||
|
return AjaxResult.success(userService.activeUserCom(userCom));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.yanzhu.system.service;
|
package com.yanzhu.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
import com.yanzhu.system.domain.SysUserExt;
|
import com.yanzhu.system.domain.SysUserExt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,11 +15,8 @@ public interface ISysUserExtService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询系统用户扩展
|
* 查询系统用户扩展
|
||||||
*
|
|
||||||
* @param userId 系统用户扩展主键
|
|
||||||
* @return 系统用户扩展
|
|
||||||
*/
|
*/
|
||||||
public SysUserExt selectSysUserExtByUserId(Long userId);
|
public SysUserExt selectSysUserExtById(SysUserExt sysUserExt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询系统用户扩展列表
|
* 查询系统用户扩展列表
|
||||||
|
@ -43,19 +42,11 @@ public interface ISysUserExtService
|
||||||
*/
|
*/
|
||||||
public int updateSysUserExt(SysUserExt sysUserExt);
|
public int updateSysUserExt(SysUserExt sysUserExt);
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除系统用户扩展
|
|
||||||
*
|
|
||||||
* @param userIds 需要删除的系统用户扩展主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteSysUserExtByUserIds(Long[] userIds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除系统用户扩展信息
|
* 删除系统用户扩展信息
|
||||||
*
|
|
||||||
* @param userId 系统用户扩展主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
public int deleteSysUserExtByUserId(Long userId);
|
public int deleteSysUserExtById(SysUserExt sysUserExt);
|
||||||
|
|
||||||
|
public void updateBySysUser(SysUser sysUser);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.yanzhu.system.service;
|
package com.yanzhu.system.service;
|
||||||
|
|
||||||
import com.yanzhu.system.api.domain.SysUser;
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
|
import com.yanzhu.system.domain.SysUserCom;
|
||||||
import com.yanzhu.system.vo.AlertUserPassVo;
|
import com.yanzhu.system.vo.AlertUserPassVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -260,4 +261,8 @@ public interface ISysUserService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int updataUserPassWord(AlertUserPassVo alertUserPassVo);
|
public int updataUserPassWord(AlertUserPassVo alertUserPassVo);
|
||||||
|
|
||||||
|
public List<SysUserCom> getUserComs(Long userId);
|
||||||
|
|
||||||
|
public int activeUserCom(SysUserCom userCom);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.yanzhu.system.service.impl;
|
package com.yanzhu.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.system.mapper.SysUserExtMapper;
|
import com.yanzhu.system.mapper.SysUserExtMapper;
|
||||||
|
@ -21,14 +24,11 @@ public class SysUserExtServiceImpl implements ISysUserExtService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询系统用户扩展
|
* 查询系统用户扩展
|
||||||
*
|
|
||||||
* @param userId 系统用户扩展主键
|
|
||||||
* @return 系统用户扩展
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUserExt selectSysUserExtByUserId(Long userId)
|
public SysUserExt selectSysUserExtById(SysUserExt userExt)
|
||||||
{
|
{
|
||||||
return sysUserExtMapper.selectSysUserExtByUserId(userId);
|
return sysUserExtMapper.selectSysUserExtById(userExt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,27 +67,30 @@ public class SysUserExtServiceImpl implements ISysUserExtService
|
||||||
return sysUserExtMapper.updateSysUserExt(sysUserExt);
|
return sysUserExtMapper.updateSysUserExt(sysUserExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除系统用户扩展
|
|
||||||
*
|
|
||||||
* @param userIds 需要删除的系统用户扩展主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteSysUserExtByUserIds(Long[] userIds)
|
|
||||||
{
|
|
||||||
return sysUserExtMapper.deleteSysUserExtByUserIds(userIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除系统用户扩展信息
|
* 删除系统用户扩展信息
|
||||||
*
|
|
||||||
* @param userId 系统用户扩展主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysUserExtByUserId(Long userId)
|
public int deleteSysUserExtById(SysUserExt sysUserExt)
|
||||||
{
|
{
|
||||||
return sysUserExtMapper.deleteSysUserExtByUserId(userId);
|
return sysUserExtMapper.deleteSysUserExtById(sysUserExt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBySysUser(SysUser sysUser) {
|
||||||
|
SysUserExt where=new SysUserExt();
|
||||||
|
where.setUserId(sysUser.getUserId());
|
||||||
|
where.setProjectId(sysUser.getDeptId());
|
||||||
|
SysUserExt old=selectSysUserExtById(where);
|
||||||
|
if(Objects.nonNull(old)){
|
||||||
|
old.setUserType(sysUser.getUserType());
|
||||||
|
old.setStatus(sysUser.getStatus());
|
||||||
|
updateSysUserExt(old);
|
||||||
|
}else{
|
||||||
|
where.setUserType(sysUser.getUserType());
|
||||||
|
where.setStatus(sysUser.getStatus());
|
||||||
|
insertSysUserExt(where);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,9 @@ import com.yanzhu.system.api.RemoteProService;
|
||||||
import com.yanzhu.system.api.RemoteUserService;
|
import com.yanzhu.system.api.RemoteUserService;
|
||||||
import com.yanzhu.system.api.domain.SysDept;
|
import com.yanzhu.system.api.domain.SysDept;
|
||||||
import com.yanzhu.system.api.domain.SysRoleDept;
|
import com.yanzhu.system.api.domain.SysRoleDept;
|
||||||
import com.yanzhu.system.domain.SysPost;
|
import com.yanzhu.system.domain.*;
|
||||||
import com.yanzhu.system.domain.SysUserPost;
|
|
||||||
import com.yanzhu.system.domain.SysUserRole;
|
|
||||||
import com.yanzhu.system.mapper.*;
|
import com.yanzhu.system.mapper.*;
|
||||||
|
import com.yanzhu.system.service.ISysUserExtService;
|
||||||
import com.yanzhu.system.vo.AlertUserPassVo;
|
import com.yanzhu.system.vo.AlertUserPassVo;
|
||||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||||
|
@ -80,6 +79,10 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
@Autowired
|
@Autowired
|
||||||
protected Validator validator;
|
protected Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserExtService userExtService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserComMapper userComMapper;
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
*
|
*
|
||||||
|
@ -343,6 +346,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
sysUser.setUpdateTime(user.getUpdateTime());
|
sysUser.setUpdateTime(user.getUpdateTime());
|
||||||
sysUser.setPassword(user.getPassword());
|
sysUser.setPassword(user.getPassword());
|
||||||
rows=userMapper.updateUser(sysUser);
|
rows=userMapper.updateUser(sysUser);
|
||||||
|
userExtService.updateBySysUser(sysUser);
|
||||||
}else{//此电话号码未注册
|
}else{//此电话号码未注册
|
||||||
user.setCreateBy(user.getUpdateBy());
|
user.setCreateBy(user.getUpdateBy());
|
||||||
user.setCreateTime(user.getUpdateTime());
|
user.setCreateTime(user.getUpdateTime());
|
||||||
|
@ -350,6 +354,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
rows=userMapper.insertUser(user);
|
rows=userMapper.insertUser(user);
|
||||||
user.setIsActive(1l);
|
user.setIsActive(1l);
|
||||||
userMapper.insertUserCom(user);
|
userMapper.insertUserCom(user);
|
||||||
|
userExtService.updateBySysUser(user);
|
||||||
}
|
}
|
||||||
//int rows = userMapper.insertUser(user);
|
//int rows = userMapper.insertUser(user);
|
||||||
// 新增用户岗位关联
|
// 新增用户岗位关联
|
||||||
|
@ -735,9 +740,13 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
SysUserPost up = new SysUserPost();
|
SysUserPost up = new SysUserPost();
|
||||||
up.setUserId(user.getUserId());
|
up.setUserId(user.getUserId());
|
||||||
up.setPostId(postId);
|
up.setPostId(postId);
|
||||||
|
up.setProjectId(user.getDeptId());
|
||||||
list.add(up);
|
list.add(up);
|
||||||
}
|
}
|
||||||
|
SysUserPost delUp=new SysUserPost();
|
||||||
|
delUp.setUserId(user.getUserId());
|
||||||
|
delUp.setProjectId(user.getDeptId());
|
||||||
|
userPostMapper.deleteUserPostByUser(delUp);
|
||||||
userPostMapper.batchUserPost(list);
|
userPostMapper.batchUserPost(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -898,4 +907,22 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
return userMapper.updateUser(sysUser);
|
return userMapper.updateUser(sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUserCom> getUserComs(Long userId) {
|
||||||
|
SysUserCom where=new SysUserCom();
|
||||||
|
where.setUserId(userId);
|
||||||
|
return userComMapper.selectUserComs(where);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int activeUserCom(SysUserCom userCom) {
|
||||||
|
userCom.setIsActive(1l);
|
||||||
|
int cnt= userComMapper.updateActiveTo0(userCom);
|
||||||
|
cnt+= userComMapper.updateActive(userCom);
|
||||||
|
SysUser user=selectUserById(userCom.getUserId());
|
||||||
|
user.setComId(userCom.getComId());
|
||||||
|
cnt+= userMapper.updateUser(user);
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,4 +161,19 @@ export function deptFirTreeSelect() {
|
||||||
url: '/system/user/deptTree',
|
url: '/system/user/deptTree',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUserComs(userId){
|
||||||
|
return request({
|
||||||
|
url: '/system/user/profile/getUserComps/'+userId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function activeUserCom(userCom){
|
||||||
|
return request({
|
||||||
|
url:'/system/user/profile/activeUserCom',
|
||||||
|
method:'post',
|
||||||
|
data:userCom
|
||||||
|
})
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
<div class="right-menu">
|
<div class="right-menu">
|
||||||
<template v-if="appStore.device !== 'mobile'">
|
<template v-if="appStore.device !== 'mobile'">
|
||||||
|
<el-tag class="cur-comp" v-if="data.comName">当前租户:{{ data.comName }}</el-tag>
|
||||||
<current-project id="current-project" class="right-menu-item"/>
|
<current-project id="current-project" class="right-menu-item"/>
|
||||||
|
|
||||||
<header-search id="header-search" class="right-menu-item" />
|
<header-search id="header-search" class="right-menu-item" />
|
||||||
|
@ -57,7 +58,9 @@ import useSettingsStore from '@/store/modules/settings'
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
|
const data=reactive({
|
||||||
|
comName:'',
|
||||||
|
})
|
||||||
function toggleSideBar() {
|
function toggleSideBar() {
|
||||||
appStore.toggleSideBar();
|
appStore.toggleSideBar();
|
||||||
userStore.getTasks(); // 动态获取用户代办任务
|
userStore.getTasks(); // 动态获取用户代办任务
|
||||||
|
@ -92,6 +95,8 @@ const emits = defineEmits(['setLayout'])
|
||||||
function setLayout() {
|
function setLayout() {
|
||||||
emits('setLayout');
|
emits('setLayout');
|
||||||
}
|
}
|
||||||
|
data.comName=userStore.currentComName
|
||||||
|
console.log("---->",userStore)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@ -102,6 +107,12 @@ function setLayout() {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||||
|
|
||||||
|
.cur-comp{
|
||||||
|
position: relative;
|
||||||
|
top: 11px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
.hamburger-container {
|
.hamburger-container {
|
||||||
line-height: 46px;
|
line-height: 46px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
@ -56,8 +56,8 @@ const useUserStore = defineStore(
|
||||||
this.nickName = user.nickName;
|
this.nickName = user.nickName;
|
||||||
this.compInfo=user.comp;
|
this.compInfo=user.comp;
|
||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
this.currentComId = user.activeComId;
|
this.currentComId = user.comp?.deptId||user.activeComId;
|
||||||
this.currentComName = user.activeComName;
|
this.currentComName =user.comp?.deptName|| user.activeComName;
|
||||||
this.currentPrjId = user.activeProjectId;
|
this.currentPrjId = user.activeProjectId;
|
||||||
this.currentProName = user.activeProjectName;
|
this.currentProName = user.activeProjectName;
|
||||||
resolve(res)
|
resolve(res)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container user-profile">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="6" :xs="24">
|
<el-col :span="6" :xs="24">
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
|
@ -57,22 +57,44 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<el-card style="margin-top:10px;">
|
||||||
|
<template v-slot:header>
|
||||||
|
<div class="clearfix">
|
||||||
|
<span>租户信息</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div class="user-coms">
|
||||||
|
<div v-for="(it,idx) in state.coms" :key="idx" class="user-com" :class="it.isActive==1?'is-active':''">
|
||||||
|
<span style="display: inline-block;margin-right:10px;">
|
||||||
|
{{ it.comName }}
|
||||||
|
</span>
|
||||||
|
<el-tag type="success" class="is-active-tag" v-if="it.isActive==1">已激活</el-tag>
|
||||||
|
<el-button v-else type="primary" @click="toggleCom(it)">切换</el-button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Profile">
|
<script setup name="Profile">
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
import userAvatar from "./userAvatar";
|
import userAvatar from "./userAvatar";
|
||||||
import userInfo from "./userInfo";
|
import userInfo from "./userInfo";
|
||||||
import resetPwd from "./resetPwd";
|
import resetPwd from "./resetPwd";
|
||||||
import { getUserProfile } from "@/api/system/user";
|
import { getUserProfile ,getUserComs,activeUserCom} from "@/api/system/user";
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
const userStore = useUserStore()
|
||||||
const activeTab = ref("userinfo");
|
const activeTab = ref("userinfo");
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
user: {},
|
user: {},
|
||||||
roleGroup: {},
|
roleGroup: {},
|
||||||
postGroup: {}
|
postGroup: {},
|
||||||
|
coms:[]
|
||||||
});
|
});
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
|
@ -82,6 +104,40 @@ function getUser() {
|
||||||
state.postGroup = response.postGroup;
|
state.postGroup = response.postGroup;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
function loadUserComs(){
|
||||||
|
let userId=userStore.uid;
|
||||||
|
if(!userId){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getUserComs(userId).then(d=>{
|
||||||
|
state.coms=d.data||[];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCom(com){
|
||||||
|
activeUserCom(com).then(d=>{
|
||||||
|
if(d.code==200){
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
loadUserComs();
|
||||||
getUser();
|
getUser();
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.app-container.user-profile{
|
||||||
|
.user-coms{
|
||||||
|
.user-com{
|
||||||
|
&.is-active{
|
||||||
|
color: #00a4e6;
|
||||||
|
}
|
||||||
|
line-height:40px;
|
||||||
|
.is-active-tag{
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue