菜单重复添加修改

This commit is contained in:
张松
2025-09-30 18:02:53 +08:00
parent 970994b51a
commit be5ea6498b
2 changed files with 18 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;
/**
* 角色菜单关联 实体类。
@@ -41,5 +42,21 @@ public class SysRolesMenus implements Serializable {
* 0 管理端及小程序 1收银机
*/
private Integer type;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof SysRolesMenus that)) {
return false;
}
return Objects.equals(menuId, that.menuId) &&
Objects.equals(roleId, that.roleId) &&
Objects.equals(type, that.type);
}
@Override
public int hashCode() {
return Objects.hash(menuId, roleId, type);
}
}

View File

@@ -181,6 +181,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
}
}
// Step 4: 批量保存(如有数据)
return rolesMenus.isEmpty() || sysRolesMenusService.saveBatch(rolesMenus);
}