upd: 编码规范

This commit is contained in:
2025-04-09 19:16:53 +08:00
parent 69838f466d
commit a4f6f259b5
3 changed files with 19 additions and 19 deletions
@@ -12,13 +12,13 @@ import java.util.Set;
@Mapper
public interface MenuMapper extends BaseMapper<Menu> {
List<Menu> selectMenuByCriteria(@Param("criteria") QueryMenuRequest criteria);
List<Menu> queryMenuListByArgs(@Param("criteria") QueryMenuRequest criteria);
LinkedHashSet<Menu> selectMenuByRoleIdsAndType(@Param("roleIds") Set<Long> roleIds, @Param("type") Integer type);
LinkedHashSet<Menu> queryMenuSetByRoleIdsAndType(@Param("roleIds") Set<Long> roleIds, @Param("type") Integer type);
List<Menu> selectMenuByPidIsNullOrderByMenuSort();
List<Menu> queryMenuListByPidIsNullOrderByMenuSort();
List<Menu> selectMenuByPidOrderByMenuSort(@Param("pid") Long pid);
List<Menu> queryMenuListByPidOrderByMenuSort(@Param("pid") Long pid);
Menu getMenuByTitle(@Param("title") String title);
@@ -26,5 +26,5 @@ public interface MenuMapper extends BaseMapper<Menu> {
Integer getMenuCountByPid(@Param("pid") Long pid);
void updateSubCntById(@Param("count") int count, @Param("menuId") Long menuId);
void updateSubCntByMenuId(@Param("count") int count, @Param("menuId") Long menuId);
}
@@ -71,7 +71,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
}
}
}
return menuMapper.selectMenuByCriteria(criteria);
return menuMapper.queryMenuListByArgs(criteria);
}
@Override
@@ -98,7 +98,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
if (CollUtil.isEmpty(menus)) {
List<Role> roles = roleService.selectRoleByUsersId(currentUserId);
Set<Long> roleIds = roles.stream().map(Role::getId).collect(Collectors.toSet());
menus = new ArrayList<>(menuMapper.selectMenuByRoleIdsAndType(roleIds, 2));
menus = new ArrayList<>(menuMapper.queryMenuSetByRoleIdsAndType(roleIds, 2));
redisHelper.set(key, menus, 1, TimeUnit.DAYS);
}
return menus;
@@ -186,7 +186,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
public Set<Menu> selectChildMenus(List<Menu> menuList, Set<Menu> menuSet) {
for (Menu menu : menuList) {
menuSet.add(menu);
List<Menu> menus = menuMapper.selectMenuByPidOrderByMenuSort(menu.getId());
List<Menu> menus = menuMapper.queryMenuListByPidOrderByMenuSort(menu.getId());
if (CollUtil.isNotEmpty(menus)) {
selectChildMenus(menus, menuSet);
}
@@ -210,9 +210,9 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
public List<Menu> selectMenuByPid(Long pid) {
List<Menu> menus;
if (pid != null && !pid.equals(0L)) {
menus = menuMapper.selectMenuByPidOrderByMenuSort(pid);
menus = menuMapper.queryMenuListByPidOrderByMenuSort(pid);
} else {
menus = menuMapper.selectMenuByPidIsNullOrderByMenuSort();
menus = menuMapper.queryMenuListByPidIsNullOrderByMenuSort();
}
return menus;
}
@@ -220,10 +220,10 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
@Override
public List<Menu> selectSuperiorMenu(Menu menu, List<Menu> menus) {
if (menu.getPid() == null) {
menus.addAll(menuMapper.selectMenuByPidIsNullOrderByMenuSort());
menus.addAll(menuMapper.queryMenuListByPidIsNullOrderByMenuSort());
return menus;
}
menus.addAll(menuMapper.selectMenuByPidOrderByMenuSort(menu.getPid()));
menus.addAll(menuMapper.queryMenuListByPidOrderByMenuSort(menu.getPid()));
return selectSuperiorMenu(getMenuById(menu.getPid()), menus);
}
@@ -315,7 +315,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
private void updateSubCnt(Long menuId) {
if (menuId != null) {
int count = menuMapper.getMenuCountByPid(menuId);
menuMapper.updateSubCntById(count, menuId);
menuMapper.updateSubCntByMenuId(count, menuId);
}
}
@@ -21,7 +21,7 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<select id="selectMenuByCriteria" resultMap="BaseResultMap">
<select id="queryMenuListByArgs" resultMap="BaseResultMap">
select
menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count,
i_frame, create_by, update_by, create_time, update_time
@@ -46,7 +46,7 @@
</where>
order by menu_sort
</select>
<select id="selectMenuByRoleIdsAndType" resultMap="BaseResultMap">
<select id="queryMenuSetByRoleIdsAndType" resultMap="BaseResultMap">
SELECT m.* FROM sys_menu m, sys_roles_menus r
WHERE m.menu_id = r.menu_id AND r.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
@@ -55,7 +55,7 @@
AND type != #{type}
order by m.menu_sort
</select>
<select id="selectMenuByPidIsNullOrderByMenuSort" resultMap="BaseResultMap">
<select id="queryMenuListByPidIsNullOrderByMenuSort" resultMap="BaseResultMap">
SELECT menu_id,
title,
name,
@@ -78,7 +78,7 @@
where pid is null
order by menu_sort
</select>
<select id="selectMenuByPidOrderByMenuSort" resultMap="BaseResultMap">
<select id="queryMenuListByPidOrderByMenuSort" resultMap="BaseResultMap">
SELECT menu_id,
title,
name,
@@ -111,12 +111,12 @@
FROM sys_menu
WHERE name = #{name}
</select>
<select id="getMenuCountByPid">
<select id="getMenuCountByPid" resultType="java.lang.Integer">
SELECT count(*)
FROM sys_menu
WHERE pid = #{pid}
</select>
<update id="updateSubCntById">
<update id="updateSubCntByMenuId">
update sys_menu
set sub_count = #{count}
where menu_id = #{menuId}