新增公司

This commit is contained in:
sxu 2025-01-05 10:19:04 +08:00
parent fa3016819b
commit 79bf7f5f4a
5 changed files with 27 additions and 5 deletions

View File

@ -65,6 +65,11 @@ public class SysRole extends BaseEntity
/** 部门组(数据权限) */
private Long[] deptIds;
/**
* 所属公司ID
*/
private Long companyId;
/** 角色菜单权限 */
private Set<String> permissions;
@ -216,6 +221,14 @@ public class SysRole extends BaseEntity
this.deptIds = deptIds;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public Set<String> getPermissions()
{
return permissions;

View File

@ -9,14 +9,14 @@ import lombok.Data;
public class UserMenuParams {
private Long userId;
private Long systemType;
private Long menuTemplateId;
private Long templateId;
UserMenuParams(){}
public UserMenuParams(Long userId, Long systemType, Long menuTemplateId){
public UserMenuParams(Long userId, Long systemType, Long templateId){
this.userId = userId;
this.systemType = systemType;
this.menuTemplateId = menuTemplateId;
this.templateId = templateId;
}
}

View File

@ -73,6 +73,7 @@ public class SysRoleServiceImpl implements ISysRoleService
String str = role.getRoleKey().replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_");
role.setRoleKey(str);
}
role.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
return roleMapper.selectRoleList(role);
}
@ -253,6 +254,7 @@ public class SysRoleServiceImpl implements ISysRoleService
public int insertRole(SysRole role)
{
// 新增角色信息
role.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
roleMapper.insertRole(role);
return insertRoleMenu(role);
}

View File

@ -111,7 +111,7 @@
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0 AND FIND_IN_SET(#{systemType}, m.system_type)
<if test="templateId != null">
AND exists (
select 0 from sys_template_menu stm where stm.temp_id = #{menuTemplateId} and stm.menu_id = m.menu_id
select 0 from sys_template_menu stm where stm.temp_id = #{templateId} and stm.menu_id = m.menu_id
)
</if>
order by m.parent_id, m.order_num

View File

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dataScope" column="data_scope" />
<result property="menuCheckStrictly" column="menu_check_strictly" />
<result property="deptCheckStrictly" column="dept_check_strictly" />
<result property="companyId" column="company_id" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
@ -24,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark, r.is_built_in
r.company_id, r.status, r.del_flag, r.create_time, r.remark, r.is_built_in
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
@ -40,6 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="companyId != null">
AND r.company_id = #{companyId}
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
@ -103,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="companyId != null">company_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
@ -116,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="companyId != null">#{companyId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
@ -133,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>