新增公司
This commit is contained in:
parent
49996f6530
commit
4ce1078a1b
|
|
@ -108,6 +108,10 @@ public class SysDept extends BaseEntity {
|
||||||
|
|
||||||
private SysUser sysUser;
|
private SysUser sysUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*角色名称
|
||||||
|
*/
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
public void setCity(String city) {
|
public void setCity(String city) {
|
||||||
this.city = city;
|
this.city = city;
|
||||||
|
|
@ -178,6 +182,14 @@ public class SysDept extends BaseEntity {
|
||||||
this.sysUser = sysUser;
|
this.sysUser = sysUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子部门
|
* 子部门
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.system.mapper;
|
package com.bonus.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.bonus.system.api.domain.SysDept;
|
import com.bonus.system.api.domain.SysDept;
|
||||||
|
|
||||||
|
|
@ -123,4 +125,11 @@ public interface SysDeptMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById(Long deptId);
|
public int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公司管理员详情
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SysUser selectDeptAndUserById(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,10 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||||
updateParentDeptStatusNormal(dept);
|
updateParentDeptStatusNormal(dept);
|
||||||
}
|
}
|
||||||
|
//判断是否是修改公司信息并判断是否关联用户信息
|
||||||
|
if (Objects.nonNull(dept.getParentId()) && dept.getParentId().equals(0L)){
|
||||||
|
updateCompanyAdminUserAndRole(dept);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -508,5 +512,23 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
sysRoleMenulist.add(rm8);
|
sysRoleMenulist.add(rm8);
|
||||||
roleMenuMapper.batchRoleMenu(sysRoleMenulist);
|
roleMenuMapper.batchRoleMenu(sysRoleMenulist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公司管理员用户和角色信息
|
||||||
|
* @param dept
|
||||||
|
*/
|
||||||
|
private void updateCompanyAdminUserAndRole(SysDept dept) {
|
||||||
|
SysUser user = dept.getSysUser();
|
||||||
|
user.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
user.setDeptId(dept.getDeptId());
|
||||||
|
SysRole role = new SysRole();
|
||||||
|
role.setRoleName(dept.getRoleName());
|
||||||
|
role.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
SysUser oldSysUser = deptMapper.selectDeptAndUserById(dept.getDeptId());
|
||||||
|
role.setRoleId(oldSysUser.getRoleId());
|
||||||
|
user.setUserId(oldSysUser.getUserId());
|
||||||
|
userMapper.updateUser(user);
|
||||||
|
roleMapper.updateRole(role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,4 +236,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="selectDeptAndUserById" resultType="com.bonus.system.api.domain.SysUser">
|
||||||
|
select su.nick_name as nickName,su.user_name as userName,su.password as password,su.phonenumber as phonenumber,
|
||||||
|
sr.role_name as roleName,su.user_id as userId,sr.role_id as roleId, sd.dept_id as deptId
|
||||||
|
from sys_dept sd
|
||||||
|
left join sys_role_dept srd on sd.dept_id = srd.dept_id
|
||||||
|
left join sys_role sr on srd.role_id = sr.role_id and sr.role_key LIKE '%admin%'
|
||||||
|
left join sys_user_role sur on sur.role_id = sr.role_id
|
||||||
|
left join sys_user su on su.user_id = sur.user_id
|
||||||
|
where sd.dept_id = #{deptId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue