新增公司

This commit is contained in:
sxu 2025-01-04 23:05:13 +08:00
parent 508a4bd302
commit c8f8231ec8
3 changed files with 20 additions and 5 deletions

View File

@ -6,8 +6,10 @@ import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.InnerAuth;
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
import com.bonus.system.api.domain.SysDept;
import com.bonus.system.api.domain.SysMenu;
import com.bonus.system.domain.UserMenuParams;
import com.bonus.system.service.ISysDeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@ -40,6 +42,9 @@ public class SysMenuController extends BaseController
@Autowired
private ISysMenuService menuService;
@Autowired
private ISysDeptService deptService;
/**
* 获取当前用户的菜单列表
*/
@ -199,7 +204,8 @@ public class SysMenuController extends BaseController
try{
Long userId = SecurityUtils.getUserId();
UserMenuParams userMenuParams = new UserMenuParams(userId, systemType);
SysDept sysDept = deptService.selectDeptById(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
UserMenuParams userMenuParams = new UserMenuParams(userId, systemType, sysDept.getTemplateId());
List<SysMenu> menus = menuService.selectMenuTreeByUserIdAndSystemType(userMenuParams);
return success(menuService.buildMenus(menus));
}catch (Exception e){

View File

@ -11,12 +11,14 @@ import lombok.Setter;
public class UserMenuParams {
private Long userId;
private Long systemType;
private Long templateId;
UserMenuParams(){}
public UserMenuParams(Long userId, Long systemType){
public UserMenuParams(Long userId, Long systemType, Long templateId){
this.userId = userId;
this.systemType = systemType;
this.templateId = templateId;
}
}

View File

@ -93,9 +93,11 @@
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
AND exists (
select 0 from sys_template_menu stm where stm.temp_id = #{templateId} and stm.menu_id = m.menu_id
)
<if test="templateId != null">
AND exists (
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
</select>
@ -107,6 +109,11 @@
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
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 = #{templateId} and stm.menu_id = m.menu_id
)
</if>
order by m.parent_id, m.order_num
</select>