@@ -15,4 +15,7 @@ public interface MenuMapper extends BaseMapper<Menu> { | |||
List<Menu> getOpMenusByRoleId(@Param("roleId") Integer roleId,@Param("clientId") String clientId); | |||
List<Menu> getChildrenMenuByPid(@Param("parentId") Integer id,@Param("clientId") String clientId); | |||
List<Menu> getMenuListByRoleId(@Param("roleId") Integer roleId); | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.service.accident.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.conver.AccidentConverMapper; | |||
@@ -124,6 +125,9 @@ public class QueryAccidentCardListService { | |||
* @return | |||
*/ | |||
private Map<String, String> getDeptMap(List<Accident> accidentList) { | |||
if (CollectionUtil.isEmpty(accidentList)) { | |||
return null; | |||
} | |||
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList()); | |||
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList); | |||
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll); | |||
@@ -143,6 +147,9 @@ public class QueryAccidentCardListService { | |||
} | |||
private Map<String, InspectionFile> getInspectionFileMap(List<Accident> accidentList) { | |||
if (CollectionUtil.isEmpty(accidentList)) { | |||
return null; | |||
} | |||
List<String> inspectionFileIdList = accidentList.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | |||
.in(InspectionFile::getId, inspectionFileIdList) |
@@ -1,8 +1,10 @@ | |||
package com.tuoheng.admin.service.third.oidc; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.tuoheng.admin.dto.RolePermissionDto; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.MenuMapper; | |||
import com.tuoheng.admin.query.RoleClientQuery; | |||
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest; | |||
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest; | |||
@@ -40,7 +42,7 @@ public class OidcServiceImpl implements OidcService { | |||
@Autowired | |||
private IRoleService roleService; | |||
@Autowired | |||
private OpPermissionsService opPermissionsService; | |||
private MenuMapper menuMapper; | |||
public JsonResult addUser(User user, String password, Tenant tenant) { | |||
@@ -83,16 +85,16 @@ public class OidcServiceImpl implements OidcService { | |||
} | |||
/** | |||
* 获取角色对应的菜单 | |||
* 查询角色对应的菜单 | |||
* | |||
* @param roleId | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getMenuList(Integer roleId) { | |||
RoleClientQuery query = new RoleClientQuery(); | |||
query.setRoleId(roleId); | |||
return opPermissionsService.getRolePermissionByRoleId(query); | |||
RolePermissionDto rolePermissionDto = new RolePermissionDto(); | |||
rolePermissionDto.setOpMenusList(menuMapper.getMenuListByRoleId(roleId)); | |||
rolePermissionDto.setRoleId(roleId); | |||
return JsonResult.success(rolePermissionDto); | |||
} | |||
} |
@@ -48,6 +48,16 @@ | |||
where mark = 1 and status = 1 and parent_id = #{parentId} and client_id = #{clientId} | |||
order by sort asc | |||
</select> | |||
<!-- 根据roleId 查询出所有的菜单--> | |||
<select id="getMenuListByRoleId" resultType="com.tuoheng.admin.entity.Menu"> | |||
select | |||
<include refid="Base_Column_List"/> | |||
from op_menus | |||
where mark = 1 | |||
and status = 1 | |||
and id in (select menu_id from op_role_menu where role_id = #{roleId} and mark = 1) | |||
order by sort asc | |||
</select> | |||
</mapper> |